Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 1997 17:03:48 -0500 (EST)
From:      Peter Dufault <dufault@hda.com>
To:        pst@jnx.com (Paul Traina)
Cc:        hans@brandinnovators.com, bugs@FreeBSD.ORG
Subject:   Re: bin/2979: Make gcc shut up about extensions when compiling `-pedantic -ansi'
Message-ID:  <199703132203.RAA07964@hda.hda.com>
In-Reply-To: <7yhgifihds.fsf@base.jnx.com> from Paul Traina at "Mar 13, 97 01:58:23 pm"

next in thread | previous 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.
> 
> I agree with you that this sucks, because all you're really likely to
> care about is the portability of YOUR code,  not the system code,
> but I'm concerned about changing it.

I bumped into this exact problem in the last couple of days and
removed a -Werror because of it and was glad to see this work
around.  ntohl on a BSD system can't be considered an extension and
is well enough defined that there is no way that
the FreeBSD header should generate a warning - that is just going to
cause lazy/busy people to do what I did and turn off warnings.

In this case this is an appropriate solution.  To be totally pedantic,
one could add an #if defined(DONT_HIDE_IMPLEMENTATION) around the
definition for warnings related to porting issues, or whatever it
is that we decide this warning is still needed for.

-- 
Peter Dufault (dufault@hda.com)   Realtime Machine Control and Simulation
HD Associates, Inc.               Voice: 508 433 6936



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