Subject: What is the right way to specify -Wno-format-contains-nul?

From: Bruce Korb <[email-masked]>
Date: Thu, 09 Aug 2012 12:58:16 -0700

Hi,

It seems that AM_PROG_CC likes to default CFLAGS to "-g -Wall" and
COMPILE puts CFLAGS at the end of the option list.  That means
that -Wall over-rides my AM_CFLAGS setting and chokes and dies.
My library uses a large array of bytes to hold many strings,
some of which are formatting strings and gcc is really clever about
noticing that there are embedded NUL bytes separating each substring.
(I actually added -Wno-format-contains-nul shortly after this new
cleverness was added...)  The deal is that if someone does a:

    make CFLAGS='-Dsomethingforme -Wall'

and I were to add this nul thingey to the end of CFLAGS, then
my effort is for naught.  I think it useful to have a PROJECT_CFLAGS
that always gets stuck at the end in the COMPILE macro.

Meanwhile, I'll specify it twice -- once in CFLAGS and again in AM_CFLAGS
in hopes it remains active regardless.

(Actually, gcc probably ought not override a specifically set option
with a "-Wall", but this the wrong forum for that...)

Thanks - Bruce