This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: C++ and feature guards Warning Question
- From: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- To: newlib at sourceware dot org
- Date: Thu, 6 Apr 2017 00:25:28 -0500
- Subject: Re: C++ and feature guards Warning Question
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cygwin.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=yselkowitz at cygwin dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 02C267E9DA
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 02C267E9DA
- References: <ec0af940-6d74-30a4-0e8d-c81ffe449e99@oarcorp.com>
On 2017-04-05 16:18, Joel Sherrill wrote:
Trying to compile an open source package for RTEMS, I
came across something I need help to figure out how
best to address. The package is in C++ and giving a
lot of warnings on methods which I would have thought
are prototyped. But clearly the compiler settings
are tripping the guards different than the package
authors expect.
Native GCC on CentOS 7 with glibc gives no warnings.
G++ defines _GNU_SOURCE on glibc targets, meaning that -std=c++NN is,
contrary to the documentation, *not* strict ISO C++:
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/gnu-user.h#L105
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749
Per my comments in that BZ, I believe there is a better way of doing
this, but it will require patches to both gcc and glibc. Once this is
done -- and while it's on my wishlist, I don't know when I'll have time
to work on it -- software will finally stop taking -std=c++NN for
granted. In the meantime, building for newlib/Cygwin/RTEMS is going to
be different from glibc in some cases.
In any case, the fix is either to use proper feature test macros, or use
-std=gnu++NN instead. I have had to do this on a number of occasions
while building software for Cygwin.
--
Yaakov