tech-userlevel archive

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

Re: Adding missing __printflike attributions



On Thu, 01 Mar 2012, Joerg Sonnenberger wrote:
the attached patch addes the missing __printflike attribution for cases
where a function calls a va_list variant like vprintf and passes an
argument as format string down. The benefit of the attribution is
correct format string checking. I'm committed all real fixes outside
src/external, src/crypto/external and src/tests already.

The change seems generally reasonable to me.

-       ATF_CHECK(load(NULL, false, "") == ENOENT);
+       ATF_CHECK(load(NULL, false, "%s", "") == ENOENT);

An empty format string is perfectly valid; there
should be no need to change printflike_function("")
to printflike_function("%s", ""). If this change is
to appease a gcc warning, then I suggest adding
-Wno-format-zero-length to CFLAGS in bsd.sys.mk

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index