svn commit: r310138 - head/lib/libc/stdio

Bruce Evans brde at optusnet.com.au
Sun Dec 18 03:08:47 UTC 2016


On Sat, 17 Dec 2016, Dimitry Andric wrote:

> On 17 Dec 2016, at 12:46, David Chisnall <theraven at FreeBSD.org> wrote:
>>
>> On 16 Dec 2016, at 19:31, Baptiste Daroussin <bapt at FreeBSD.org> wrote:
>>>
>>> Other than that, it makes more difficult to use vanilla gcc with out userland.
>>> and it is adding more complexity to be able to build freebsd from a non freebsd
>>> system which some people are working on.
>>
>> Why?  You’ll get some spurious warnings about printf, but that’s all.
>
> Unfortunately, we compile large parts of the tree with -Werror.  Thus,
> "spurious warnings" will break the build, leaving the user two options:
> disabling -Wformat warnings, or disabling -Werror altogether, neither of
> which are very recommendable.
>
> As far as I know, there is no -Wno-error-on-undefined-printf-specifiers.
> It would also be hard to implement, since after any undefined specifiers
> have been encountered, you cannot reason about the following ones
> anymore either.
>
> IMHO, if people want to use non-standard specifiers, let them define
> their own almost_printf_but_not_quite() functions, and forgo any format
> checking.

That would be worse than breaking format checking for the selected set
of printf()s.  It gives even more unportability.  %b is a BSDism that
would be detected at compile time on systems without support for %b in
printf().  almost_printf_but_not_quite() is a FreeBSDism that would
be detected at compile time on systems without the function.  Using
it breaks portability even to other BSD systems including previous
versions of FreeBSD.

People who want to use non-standard specifiers added support to check
them the compiler.

Bruce


More information about the svn-src-head mailing list