C++ and feature guards Warning Question

Joel Sherrill joel.sherrill@oarcorp.com
Fri Apr 7 16:51:00 GMT 2017

On 4/6/2017 12:25 AM, Yaakov Selkowitz wrote:
> 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.

This was for poppler and this minor change to their configure.ac
improved the build warnings immensely.

These issues are always subtle. Thanks for providing the insight.
I did suspect that newlib might be ahead of the curve on precisely
following the standards.


More information about the Newlib mailing list