From owner-freebsd-bugs Thu Mar 13 22:43:11 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id WAA01836 for bugs-outgoing; Thu, 13 Mar 1997 22:43:11 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA01823 for ; Thu, 13 Mar 1997 22:42:58 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id RAA14148; Fri, 14 Mar 1997 17:40:09 +1100 Date: Fri, 14 Mar 1997 17:40:09 +1100 From: Bruce Evans Message-Id: <199703140640.RAA14148@godzilla.zeta.org.au> To: hans@brandinnovators.com, pst@jnx.com Subject: Re: bin/2979: Make gcc shut up about extensions when compiling `-pedantic -ansi' Cc: bugs@FreeBSD.ORG Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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