Bug 22913 - gcc -traditional error on stdio.h
Summary: gcc -traditional error on stdio.h
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-12-28 02:06 UTC by Itai Nahshon
Modified: 2016-11-24 15:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-12-28 02:06:09 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2001:001 0 high SHIPPED_LIVE : glibc file read or write access local vulnerability 2001-01-11 05:00:00 UTC

Description Itai Nahshon 2000-12-28 02:06:06 UTC
This problem lives in glibc-2.2-9 and also in earlier versions.

gcc -traditional does not like these recursive macros
in <stdio.h>

/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr

This results in a warning and the output is invalid C code.
Perhaps the above should be wraped with
   #if defined __STDC__ ... #endif

This is also the cause of warnings from /usr/X11R6/bin/makedepend .

BTW: cpp from gcc-2.96-69 does not define the macro __STDC_VERSION__ !!
(when -traditional is not set, 'info cpp' sais it should!), I think
that should be a separate bug report.

Comment 1 Jakub Jelinek 2001-01-11 22:57:41 UTC
I've added #ifdef __STDC__ around these defines.
As for why __STDC_VERSION__ is not defined, info cpp is wrong about
this. __STDC_VERSION__ is defined in ISO C94 and above, and as default
is -std=gnu89, it should not be defined. It will be only if
you request -std=c94, -std=c99 or -std=gnu99.


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