On Fri, 16 Aug 2002, Tim Robbins wrote:

> On Thu, Aug 15, 2002 at 03:18:59PM -0700, Alfred Perlstein wrote:
> > /usr/obj/vol/share/src/i386/usr/include/stdbool.h:41: warning: useless keyword o
> > r type name in empty declaration
> > /usr/obj/vol/share/src/i386/usr/include/stdbool.h:41: warning: empty declaration
> > I get those a lot now... please fix.
> This happens because GCC 3 doesn't define __STDC_VERSION__ unless
> you specify -std=<something>,

Also because ru just removed the special gcc hacks for errors in standard
headers, so the broken <stdbool.h> is now detected.

gcc 3 doesn't define __STDC_VERSION__ for -std=c89 either.  __STDC_VERSION__
is a c99 thing, so this seems right.

- whereas 2.95 defines it to 199409L if no
> -std option is given.

I didn't know that.  gcc 2.29 has the interesting bugs of not putting either
__STDC__ or __STDC_VERSION__ in gcc -E -dM output, so they are hard to see.

- I'm not quite sure how to check for this. Perhaps this
> would work:
> #if __STDC_VERSION__ < 199901L && __GNUC__ < 3
> typedef int _Bool;
> #endif

Seems best.

> GCC 3 appears to declare _Bool regardless of any -std option.

Even gcc -traditional declares it.  This may be a bug.  _Bool is in the
implementation namespace, but still causes problems (a bit like declaring
__STDC__ for nonstandard compilers).

We have a hack in <sys/cdefs.h> related to this.  __func__ is a C99 thing,
so it should be ifdefed using __STDC_VERSION__, but it is also a gcc thing,
so the correct ifdef using __STDC_VERSION__ doesn't work.  We handle
__restrict/restrict a little differently (probably better).


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to