Skip to content
  • Philip Withnall's avatar
    gatomic: Add various casts to use of g_atomic_*()s to fix warnings · 55f9c6d2
    Philip Withnall authored
    When compiling GLib with `-Wsign-conversion`, we get various warnings
    about the atomic calls. A lot of these were fixed by
    3ad375a6, but some remain. Fix them by
    adding appropriate casts at the call sites.
    
    Note that `g_atomic_int_{and,or,xor}()` actually all operate on `guint`s
    rather than `gint`s (which is what the rest of the `g_atomic_int_*()`
    functions operate on). I can’t find any written reasoning for this, but
    assume that it’s because signedness is irrelevant when you’re using an
    integer as a bit field. It’s unfortunate that they’re named a
    `g_atomic_int_*()` rather than `g_atomic_uint_*()` functions.
    
    Tested by compiling GLib as:
    ```
    CFLAGS=-Wsign-conversion jhbuild make -ac |& grep atomic
    ```
    
    I’m not going to add `-Wsign-conversion` to the set of default warnings
    for building GLib, because it mostly produces false positives throughout
    the rest of GLib.
    
    Signed-off-by: Philip Withnall <...
    55f9c6d2