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
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc   
(Show other bugs)
Version: 3.0
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
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:
Last Closed: 2005-02-21 12:20:49 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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:

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.