Cannot compile C++ programs with WARNS > 3 on 4.0_BETA2

Jeremie Le Hen <[email protected]>
Newsgroups gmane.os.netbsd.devel.general
Message-ID <[email protected]>
Hi list,

Sorry if this is the wrong list to post this and feel free to point me
out a more correct one.  Please Cc: me in your replies, I am not
subscribed to this list.

I'm usually developping on FreeBSD but I wanted to test my application
on NetBSD as well.  The good news is they're both using almost the
same makefile framework.

I used to compile my source using WARNS=6 on FreeBSD and the latter
fails on NetBSD 4.0_BETA2:

% #   compile  poolexecutor/zthreadstub.o
% c++ -O2 -Wall -Wpointer-arith -Wno-sign-compare -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -std=gnu99 -Werror   -Wabi -Wold-style-cast -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder  -Wno-deprecated -Wno-non-template-friend  -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -Wsynth     -c    zthreadstub.cc
% cc1plus: warnings being treated as errors
% cc1plus: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
% *** Error code 1


The fix is trivial and the patch is following:

--- 8< --- 8< --- 8< --- 8< --- 8< ---
Index: sys.mk
===================================================================
RCS file: /pub/NetBSD-CVS/src/share/mk/sys.mk,v
retrieving revision 1.88
diff -u -r1.88 sys.mk
--- sys.mk      26 Aug 2006 19:57:03 -0000      1.88
+++ sys.mk      22 Jan 2007 16:45:19 -0000
@@ -44,7 +44,7 @@
 LINK.c?=       ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}

 CXX?=          c++
-CXXFLAGS?=     ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes}
+CXXFLAGS?=     ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-std=gnu99}
 COMPILE.cc?=   ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
 LINK.cc?=      ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
--- 8< --- 8< --- 8< --- 8< --- 8< ---

Thank you for you work guys !
Best regards,
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.