Skip to content

macros: generate uniq variable name in _G_BOOLEAN_EXPR()/G_LIKELY()

Ray Strode requested to merge old-fixes-solve-new-problems into main

This avoids a -Wshadow warning when nesting G_LIKELY() inside each other due to g_boolean_var.

This can be easily encountered when using macros:

    #define GET_VALUE(arg) \
        ({ \
           typeof (arg) _arg = (arg); \
           g_assert (_arg); \
           get_value (_arg); \
    g_assert (GET_VALUE (a) > 5);

COUNTER is a GCC extension, but the definition of _G_BOOLEAN_EXPR() is already inside a

#if defined(GNUC) && (GNUC > 2) && defined(OPTIMIZE)


Closes: #1211 (closed)

Merge request reports