svn commit: r303560 - head/usr.sbin/uathload

Bruce Evans brde at optusnet.com.au
Sun Jul 31 00:20:57 UTC 2016


On Sat, 30 Jul 2016, Bjoern A. Zeeb wrote:

> Log:
>  Rename devname to udevname after including stdlib.h in r303445
>  as gcc trips over the devname(3) and reports 'shadows a global declaration'.

You mean "as gcc actually works, so it detects and reports that devname in
the program 'shadows a global declaration'".

>  This should unbreak gcc based world builds.

We asked for this warning using -Wshadow.  -Wshadow sometimes works for
clang too.  But -Wsystem-headers is very broken for clang.  It is the
default for gcc, at least for controlling -Wshadow, and we put it in
CFLAGS at WARNS >= 1, but clang silently ignores it, at least for
controlling -Wshadow.

I don't like changing names, especially to work around namespace pollution,
but pollution in "standard" headers is especially dangerous and hard to
fix since you can't control it.  So renaming to avoid seems least bad.
The bug turns off -Wshadow for headers where it is most needed, since of
of course your headers are better written and you know what is in them.

Even -Wno-system-headers shouldn't turn off -Wshadow, since the -Wshadow
warning is not about internals of system headers but about leakage of
the internals.  You would also want it if you or a system header misused
a reserved or unreserved name like _exit or off64_t.

Looking for such errors, I found the interesting names quot and rem
in <stdlib.h> (these are bad standard struct member names, so
applications must not #define them), and lots of new bugs in <stdio.h>
starting with off64_t polluting even the C90 case.  <stdio.h> also uses
read, write, seek and close as bad nonstandard struct member names,
giving the same restrictions as for quot and rem, but this is only in
the _BSD_VISIBLE case.

Bruce


More information about the svn-src-all mailing list