tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



> 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		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index