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.