Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Aug 2002 23:52:41 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Tim Robbins <tjr@FreeBSD.ORG>
Cc:        Alfred Perlstein <bright@mu.org>, <current@FreeBSD.ORG>
Subject:   Re: world broken
Message-ID:  <20020816233509.E7073-100000@gamplex.bde.org>
In-Reply-To: <20020816164813.A62266@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020816233509.E7073-100000>