Bug 149214 - #defined (linux) macro not supported when program compiled in ANSI mode
Summary: #defined (linux) macro not supported when program compiled in ANSI mode
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc   
(Show other bugs)
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-21 12:09 UTC by Tushar Telichari
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

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


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

Description Tushar Telichari 2005-02-21 12:09:08 UTC
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 12:11:16 UTC
Created attachment 111251 [details]
Test case to reproduce the bug

Comment 2 Tushar Telichari 2005-02-21 12:19:33 UTC
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 12:20:49 UTC
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.