This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-19980715 doesn't recognize '__linux__' in C++ code
- To: Byeong-ryeol Kim <jinbo21 at soback dot kornet21 dot net>
- Subject: Re: egcs-19980715 doesn't recognize '__linux__' in C++ code
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 21 Jul 1998 00:23:32 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <Pine.LNX.4.00.9807181340400.2148-100000@progress.plw.net>you writ:
> I compilled, installed egcs-19980715(egcs-2.91.50) on i586-pc-linux-gnu
> system(RH5.1, glibc-2.0.94-4, libg++-2.8.2-980708, ...).
> It compiles linux kernel 2.1.108, 2.1.109, and compiled kernels boots
> OK.
> But 'make -k check' shows gcc(egcs-19980715) cannot recognize
> '__linux__' in libg++/etc/lf/screen.cc and fails to compile screen.cc.
> It works well with 'LINUX' or '__LINUX__', but, I think, these are not
> used frequently on linux system.
Huh? __linux__ is defined by default on linux systems. Look at the
output from running g++ -v on a file:
g++ -v foo.C
Reading specs from /usr/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.50/specs
gcc version egcs-2.91.50 19980714 (gcc2 ss-980609 experimental)
/usr/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.50/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ foo.C /tmp/cckT6dPW.ii
Note carefully -D__linux__.
This is the desired behavior.
> This problem seems to appear for the first time in this version of egcs.
>
>
> 1. the code of screen.cc
> --------------------------------------------------------------------
> #if !defined(hpux) && !defined(__linux__) && !defined(_AIX41)
> extern "C" int tgetent(void *, const char *);
> extern "C" int tgetnum(const char*);
> extern "C" char *tgetstr(const char *, char**);
> #endif
> --------------------------------------------------------------------
This code says *NOT* to provide prototypes for those functions on a
linux system. But the code still uses those functions. This is a bug
in the libg++ test code, not egcs.
jeff