public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* C++ and feature guards Warning Question
@ 2017-04-05 21:18 Joel Sherrill
  2017-04-05 23:39 ` Chris Johns
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Joel Sherrill @ 2017-04-05 21:18 UTC (permalink / raw)
  To: newlib

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-07 21:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 21:18 C++ and feature guards Warning Question Joel Sherrill
2017-04-05 23:39 ` Chris Johns
2017-04-06  5:26 ` Yaakov Selkowitz
2017-04-07 16:51   ` Joel Sherrill
2017-04-07 21:22 ` Jeffrey Walton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).