Skip to content

gstrfuncs: Make _G_STR_NONNULL workaround compatible with g++ < 5

Olivier Blin requested to merge blino/glib:g-str-nonnull-Waddress into main

With glib >= 2.75.0 and g++ 4.8, g_str_has_prefix() from <glib/gstrfuncs.h> triggers -Waddress with a static const char[] argument:

warning: the address of ‘xxx’ will always evaluate as ‘true’ [-Waddress] #define _G_STR_NONNULL(x) ((x) + !(x))

Check (x == NULL) instead of (!x), which still avoids -Wnonnull (gcc <= 10), but does not introduce -Waddress (g++ < 5).

Co-Authored-By: Loïc Yhuel loic.yhuel@softathome.com

Fixes: 48730d2b ("gstrfuncs: Add back x + !x warning workaround")

Merge request reports

Loading