Subject: Re: the "warned_unix" hack in GCC's preprocessor is poorly concieved....
To: NetBSD Toolchain Technical Discussion List <tech-toolchain@NetBSD.ORG>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 03/31/2003 19:28:36
[ On , March 31, 2003 at 17:11:57 (-0500), Perry E. Metzger wrote: ]
> Subject: Re: the "warned_unix" hack in GCC's preprocessor is poorly concieved....
> Todd Vierling <email@example.com> writes:
> > On Sun, 30 Mar 2003, Greg A. Woods wrote:
> > : The warning I'm particularly concerned with today is:
> > :
> > : file.h:999: warning: deprecated symbol "unix" is no longer predefined
> > The intent of this (since I wrote it 8-) was for it to last about one to two
> > major releases of NetBSD. This hack could be nuked altogether in -current,
> > as pkgsrc ahs done an outstanding job of fixing "unix" symbol references in
> > various packages.
> > However, I'm no longer a developer, so "someone else do it."
> I think it is still useful.
It _is_ useful to the extent that lots of software might want to use the
fact that UNIX systems have supplied "-Dunix" by default for decades but
NetBSD doesn't and so having the ability to notice when such a
dependency is being broken is indeed a good thing.
However the way this hack is implemented is rather simplistic, perhaps
it is even necessarily so, and as a result it will produce warnings that
are bogus for portable software which may still use defined(unix).
Now as I've already stated the work-around of adding -Dunix is liable to
cause unnecessary problems and complications rather than just eliminate
the bogus warnings. So since lots of software developers will
undoutably wish to use NetBSD's default supplied compiler while
developing and testing portable software for other systems it would seem
quite appropriate to have some means of controlling this warning
directly, just as almost all other portability warnings can be
controlled in GCC.
The real question here is back to whether I should supply a patch to
implement such an option, or whether such a change would best come from
an already approved GCC hacker. I'm now guessing that this hack won't
be submitted back to the master GCC repository, especially not as-is,
and so perhaps such a change won't go beyond the NetBSD repository.
Alternately maybe, just maybe, I can convince Perry and any other
remining advocates of this warning (or at least the latter group, if
any) that they can still get the same result, and perhaps an even better
result, if they were to use -Wundef instead.
(The drawback of -Wundef is that it exposes a lot of what could arguably
be already broken preprocessor expressions, and it also makes a few
mistakes too, though I think it would be easier to fix some of the most
annoying mistakes it makes than it would be to make this warned_unix
hack smart enough to avoid the problems I described.)
Greg A. Woods
+1 416 218-0098; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>