https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78304
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If without -Wsystem-headers the warning is suppressed just because the particular part of the concatenated string comes from system header, then I'd say that is a clear bug. For whether -Wsystem-headers applies or not in this case I'd say it should matter whether any part of the concatenated string comes from non-system header, or perhaps even whether the corresponding argument comes from non-system header. If the whole call is in a system header, -Wsystem-headers should apply, but in this case that looks wrong. Also, when the % comes from one place and the following u comes from another, picking the u location rather than % location is quite unfortunate: In file included from pr78304.c:1:0: pr78304.c: In function ‘main’: /usr/include/inttypes.h:104:19: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=] # define PRIu32 "u" If the entire %u comes from there, perhaps (but it is still very hard to decipher, as no macro context is printed), but for the mixed case I think it is better to go with the location (if any) that can be found both in the macro context of one of the parts and the other spot.