Re: WARNS > 3 then -Wformat=2: pb with va_list

Mouse <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
> But inetd is compiled with WARNS = 6, and this adds -Wformat=2 that
> adds -Wformat-nonliteral, [...]

> Since the compiler is unable to check in my_syslog(prio, fmt, ...)
> the fmt against the args, it chokes.

> I added:

> CFLAGS+=-Wno-error=format-nonliteral

Did you decorate my_syslog with a suitable
__attribute__((__format__(...)))?

If so, and that didn't help, my preferred reaction would be
-Wno-format-nonliteral.  I believe warnings are there to be servants,
not masters, and when they get in the way of writing clear, correct
code, they should be disabled.

Of course, doing that increases the risk that a future change will
introduce an error that goes uncaught as a result.  It's a judgement
call whether the price is worth the benefit.  You could isolate
my_syslog in its own source file and build only that file with whatever
-W options you pick, if you want to limit the possible risk.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.