This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ and feature guards Warning Question


Hi

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.
It could easily be a GCC version side-effect.

==========================
#include <stdlib.h>

int f(char *s)
{
  return mkstemp(s);
}
==========================

Warnings with i386-rtems GCC and newilb:

$ i386-rtems4.12-gcc -c j.cc
$ i386-rtems4.12-gcc -std=c++11 -c j.cc
j.cc: In function 'int f(char*)':
j.cc:5:19: error: 'mkstemp' was not declared in this scope
   return mkstemp(s);
$ i386-rtems4.12-gcc -std=c++03 -c j.cc
j.cc: In function 'int f(char*)':
j.cc:5:19: error: 'mkstemp' was not declared in this scope
   return mkstemp(s);
$ i386-rtems4.12-gcc --version
i386-rtems4.12-gcc (GCC) 6.3.0 20161221 (RTEMS 4.12, RSB 4c5eb8969451c4ea0997b3caa98bfe80fe15da69, Newlib 2.5.0.20170228)

Native GCC and glibc results:

$ gcc -std=c++03 -c j.cc
$ gcc -std=c++11 -c j.cc
$ gcc -std=c++11 ^C j.cc
$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)

Suggestions on what to do to eliminate the warnings is
appreciated.

Thanks.

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35806
Support Available                (256) 722-9985


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]