https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178
Paul Eggert <eggert at cs dot ucla.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eggert at cs dot ucla.edu --- Comment #16 from Paul Eggert <eggert at cs dot ucla.edu> --- I ran into a similar problem when using GCC pre-15 to compile the Time Zone Database code, which does this: #define TZDIR "/user/share/zoneinfo" ... static char const tzdirslash[sizeof TZDIR] = TZDIR "/"; where tzdirslash is a char array, not a string. I'd like to be able to tell GCC 15 "This is valid code and we know what we're doing here" without disabling the warning in general (a pragma push/pop should work but that's wayy to intrusive). Another possiblity, if the __attribute__((nonstring)) idea is too heavyweight, is to not issue the warning if the initialization ends in an empty string literal, e.g.: static char const tzdirslash[sizeof TZDIR] = TZDIR "/" ""; where the empty string literal tells GCC "don't warn". However, the __attribute__((nonstring)) approach would be cleaner if you have time to implement it.