Thanks. I guess clang forked after the clever NUL-in-format-string was added, but before my fix. :( I'll add -Wno-format if I can identify clang over GCC.
On Wed, Jun 20, 2018 at 11:32 AM Jakub Jelinek <ja...@redhat.com> wrote: > On Wed, Jun 20, 2018 at 11:17:50AM -0700, Bruce Korb wrote: > > Years and years ago, I went to a mess of trouble to implement this > > specialized warning so I would not have to see it anymore. I use a code > > generator that puts constant strings into one huge buffer with all the > > contained strings NUL separated. Today, I was trying to build on OS/X: > > > > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../lib -g -O2 > > -Wcast-align -Wmissing-prototypes -Wpointer-arith -Wshadow > > -Wstrict-prototypes -Wwrite-strings -Wno-format-contains-nul > > -fno-strict-aliasing -Wstrict-aliasing=2 -MT libopts_la-libopts.lo -MD > -MP > > -MF .deps/libopts_la-libopts.Tpo -c libopts.c -fno-common -DPIC -o > > .libs/libopts_la-libopts.o > > > > warning: unknown warning option '-Wno-format-contains-nul' > > [-Wunknown-warning-option] > > In file included from libopts.c:26: > > ./enum.c:112:38: warning: format string contains '\0' within the string > > body [-Wformat] > > fprintf(option_usage_fp, ENUM_ERR_LINE, *(paz_names++)); > > ^~~~~~~~~~~~~ > > ./ao-strs.h:70:31: note: expanded from macro 'ENUM_ERR_LINE' > > #define ENUM_ERR_LINE (ao_strs_strtable+304) > > ^~~~~~~~~~~~~~~~~~~~~~ > > ./ao-strs.c:90:20: note: format string is defined here > > /* 304 */ " %s\n\0" > > ~~~~~~~~~~~~~~~~~~~^~~ > > > > > > Did somebody go to a bunch of trouble to undo my work for the OS/X > > platform? :( > > No, you are probably just using clang rather than gcc. > gcc has no -Wunknown-warning-option warning, -Wformat-contains-nul > is a known option and if you used some unknown -Wno-... warning option > and any diagnostics was emitted, the message would be just: > warning: unrecognized command line option ‘-Wno-whatever’ > > Jakub > -- - Bruce