tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: -std=gnu99



On Sun, 18 May 2014, David Holland wrote:

> On Fri, May 16, 2014 at 09:10:12PM +0100, Iain Hibbert wrote:
>  > I mean to change bsd.sys.mk to always provide -std=gnu99 in CFLAGS as per
>  > below patch, as if the code base requires gnu99 then it will require it
>  > whichever compiler is in use.
>
> ...why break the build system so as to pass a gcc (and clang) option
> to potentially arbitrary other compilers that won't understand it?

which other compilers?

don't forget, that we provide a 'tool' compiler to build NetBSD, and this
works with all known options for that. Only the tools need to be built by
a host system, nothing else, and bsd.sys.mk is not used for that.

> AIUI it should be conditionalized on ACTIVE_CC, but it should still be
> conditionalized.

Except for the fact that if it were to be conditional, then yes it should
be using ACTIVE_CC (which is a different WTF itself), I don't agree. The
sources are currently too dependent on GNU C, and you just can't build
NetBSD without GCC compat active.

I have been playing at getting PCC to build most of the tree on i386
(well, mostly I point out the problems and ragge fixes them :) for the
last couple of years and, while it is nearly there now I am not ready to
tackle changing the sources to not depend on __GNUC__, which as Ragge
points out, is a different issue.  While PCC currently has some GCC
compatibility, the aim was to make a C99 compiler and the compat will have
to be activated.

As all known options for tool compilers (including PCC) support an option
of -std=gnu99 and, as the sources require it, I think we should just use
it unconditionally for now.

regards,
iain


Index: bsd.sys.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.sys.mk,v
retrieving revision 1.237
diff -u -p -r1.237 bsd.sys.mk
--- bsd.sys.mk  28 Jan 2014 19:41:52 -0000      1.237
+++ bsd.sys.mk  20 May 2014 17:55:32 -0000
@@ -20,12 +20,8 @@ CPPFLAGS+=   -Wp,-iremap,${DESTDIR}/:/
 CPPFLAGS+=     -Wp,-iremap,${X11SRCDIR}:/usr/xsrc
 .endif

-# Enable c99 mode by default.
-# This has the side effect of complaining for missing prototypes
-# implicit type declarations and missing return statements.
-.if defined(HAVE_GCC) || defined(HAVE_LLVM)
+# NetBSD sources use C99 style, with some GCC extensions.
 CFLAGS+=       -std=gnu99
-.endif

 .if defined(WARNS)
 CFLAGS+=       ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign 
:}


Home | Main Index | Thread Index | Old Index