Bug 149214

Summary: #defined (linux) macro not supported when program compiled in ANSI mode
Product: Red Hat Enterprise Linux 3 Reporter: Tushar Telichari <tushar>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tushar
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
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:
Cloudforms Team: ---
Description Flags
Test case to reproduce the bug none

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:

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.