RTEMS + g++ + #include <netinet/in.h>
Chris Johns
cjohns at cybertec.com.au
Tue Dec 19 09:50:17 UTC 2000
Hi,
The simple test program :
------ 8< - tst.cpp ------
#include <sys/types.h>
#include <netinet/in.h>
------ 8< ----------------
gives :
$ m68k-rtems-g++ -c -I /opt/rtems/rtems/bare-5200/lib/include tst.cpp
In file included from tst.cpp:2:
/opt/rtems/rtems/bare-5200/lib/include/netinet/in.h:282: ANSI C++
forbids data member `ip_opts' with same name as enclosing class
This same program compiles without error on FreeBSD. The include
<netinet/in.h> is the same.
I tracked the source of the error down. Looking at the source for gcc in
the C++ file :
gcc/cp/decl.c:11513
the code is :
11513 /* 9.2p13 [class.mem] */
11514 if (declarator == constructor_name
(current_class_type)
11515 /* Divergence from the standard: In extern "C",
we
11516 allow non-static data members here, because C
does
11517 and /usr/include/netinet/in.h uses that. */
11518 && (staticp || ! in_system_header))
11519 cp_pedwarn ("ANSI C++ forbids data member `%D'
with same name as enclosing class",
11520 declarator);
So GCC knows a file is included from a system directory. The result is
<netinet/in.h> compiles on FreeBSD, but fails under RTEMS as we do not
place <netinet/in.h> in a path which GCC sees as a system directory.
Looking at the m68k-rtems-gcc I have, the system include is listed as :
/opt/rtems/lib/gcc-lib/m68k-rtems/2.95.2/../../../../m68k-rtems/include
Should the RTEMS install put this file in the correct spot ?
Comments, solutions welcome.
Regards
--
Chris Johns, mailto:cjohns at cybertec.com.au mailto:ccj at acm.org
More information about the users
mailing list