Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 1997 17:40:09 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        hans@brandinnovators.com, pst@jnx.com
Cc:        bugs@FreeBSD.ORG
Subject:   Re: bin/2979: Make gcc shut up about extensions when compiling `-pedantic -ansi'
Message-ID:  <199703140640.RAA14148@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>	When compiling something which uses statement expressions (e.g
>	machine/endian.h to get at ntohl()), gcc complains that braces
>	are not allowed by ANSI C.
>
>	Below is a diff. for the relevant files.  Insert `__extension__'
>	before the expression.
>
>But this is arguably defeating pedantic.  Not only should your code
>not use extensions, but the code that you're calling should not.  By
>placing __extension__ in, you're allowing your code to use nonportable
>code.

Nope, this is necessary to make -pedantic usable.  Headers are part of
the implementation and should never generate warnings.

Most of the __extension__'s were added to -current 6 months ago.  However,
-pedantic is still unusable because system headers use `long long':

	/sys2/sys/types.h:71: warning: ANSI C does not support `long long'

This was (mostly) non-broken in 1.1.5 where `long long' wasn't used directly:

	typedef int quad_t __attribute (( mode(DI) ));

This was broken if the application #defines `mode' or DI, and one or both
of __mode__ or __DI__ didn't work before gcc-2.7.  The declaration can
now be hidden properly:

	typedef int quad_t __attribute((__mode__(__DI__)));

but no one has implemented this yet.  It wouldn't work in -stale...

Bruce



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