Bug 149214 - #defined (linux) macro not supported when program compiled in ANSI mode
#defined (linux) macro not supported when program compiled in ANSI mode
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-21 07:09 EST by Tushar Telichari
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-02-21 07:20:49 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Test case to reproduce the bug (203 bytes, text/plain)
2005-02-21 07:11 EST, Tushar Telichari
no flags Details

  None (edit)
Description Tushar Telichari 2005-02-21 07:09:08 EST
Description of problem: #defined (linux) macro not supported when program is
compiled in ANSI mode.


Version-Release number of selected component (if applicable):
gcc - 3.2.3-49
glibc - 2.3.2-95.30


How reproducible:

Steps to Reproduce:
1. g++ -ansi ansi.cpp
2. ./a.out
  
Actual results:
Not defined

Expected results:
Defined

Additional info:
works properly when compiled with - g++ ansi.cpp
Comment 1 Tushar Telichari 2005-02-21 07:11:16 EST
Created attachment 111251 [details]
Test case to reproduce the bug
Comment 2 Tushar Telichari 2005-02-21 07:19:33 EST
This macro is being used at many places in our product. Substituting the
#defined (linux) with something else is not a feasible solution. This problem is
seen when the code is compiled in ANSI mode. Could you please suggest a way to
make this macro available (besides sending -Dlinux during make) ?
Comment 3 Jakub Jelinek 2005-02-21 07:20:49 EST
That's on purpose, since linux macro violates the ISO C89/C99/C++98 namaspace.
A conforming ISO C89/C99/C++98 program can e.g. be
int linux;
or void linux (void) {}
See e.g. info gcc, search for -ansi.
You can use __linux or __linux__ macros instead.

Note You need to log in before you can comment on or make changes to this bug.