Bug 11201 - g++ -pedantic -O fails compile #include <cstdio>
Summary: g++ -pedantic -O fails compile #include <cstdio>
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.3
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-16 00:42 UTC by Takumi ASAKI
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takumi ASAKI 2003-06-16 00:42:24 UTC
g++ fails to compile source includes <cstdio> when set pedantic and O option. 
 
% cat a.cpp 
#include <cstdio> 
int main() 
{ return 0; } 
 
[OK]% g++ a.cpp 
[OK]% g++ -pedantic a.cpp 
[OK]% g++ -O a.cpp 
[NG]% g++ -pedantic -O a.cpp 
In file included from /usr/include/stdio.h:827, 
                 from /usr/include/c++/3.2.3/cstdio:52, 
                 from a.cpp:1: 
/usr/include/bits/stdio.h: In function `int getchar()': 
/usr/include/bits/stdio.h:42: declaration of `int getchar() throw ()' throws  
   different exceptions 
/usr/include/stdio.h:444: than previous declaration `int getchar()' 
/usr/include/bits/stdio.h: In function `int getc_unlocked(FILE*)': 
/usr/include/bits/stdio.h:51: declaration of `int getc_unlocked(FILE*) throw 
() 
   ' throws different exceptions 
/usr/include/stdio.h:456: than previous declaration `int getc_unlocked(FILE*)' 
/usr/include/bits/stdio.h: In function `int getchar_unlocked()': 
/usr/include/bits/stdio.h:58: declaration of `int getchar_unlocked() throw ()'  
   throws different exceptions 
/usr/include/stdio.h:457: than previous declaration `int getchar_unlocked()' 
/usr/include/bits/stdio.h: In function `int putchar(int)': 
/usr/include/bits/stdio.h:67: declaration of `int putchar(int) throw ()' 
throws  
   different exceptions 
/usr/include/stdio.h:483: than previous declaration `int putchar(int)' 
/usr/include/bits/stdio.h: In function `int fputc_unlocked(int, FILE*)': 
/usr/include/bits/stdio.h:76: declaration of `int fputc_unlocked(int, FILE*)  
   throw ()' throws different exceptions 
/usr/include/stdio.h:497: than previous declaration `int fputc_unlocked(int,  
   FILE*)' 
/usr/include/bits/stdio.h: In function `int putc_unlocked(int, FILE*)': 
/usr/include/bits/stdio.h:86: declaration of `int putc_unlocked(int, FILE*)  
   throw ()' throws different exceptions 
/usr/include/stdio.h:505: than previous declaration `int putc_unlocked(int,  
   FILE*)' 
/usr/include/bits/stdio.h: In function `int putchar_unlocked(int)': 
/usr/include/bits/stdio.h:93: declaration of `int putchar_unlocked(int) throw  
   ()' throws different exceptions 
/usr/include/stdio.h:506: than previous declaration `int 
putchar_unlocked(int)' 
/usr/include/bits/stdio.h: In function `__ssize_t getline(char**, size_t*,  
   FILE*)': 
/usr/include/bits/stdio.h:103: declaration of `__ssize_t getline(char**,  
   size_t*, FILE*) throw ()' throws different exceptions 
/usr/include/stdio.h:573: than previous declaration `__ssize_t getline(char**,  
   size_t*, FILE*)' 
 
% rpm -q gcc 
gcc-3.2.3-0vl2 
 
% gcc -v 
Reading specs from /usr/lib/gcc-lib/i386-vine-linux/3.2.3/specs 
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --with-system-zlib --enable-__cxa_atexit 
--host=i386-vine-linux 
Thread model: posix 
gcc version 3.2.3
Comment 1 Andrew Pinski 2003-06-16 00:57:33 UTC
This is not a gcc bug because it does not provide the headers for stdio.h, that means this is glibc 
bug, also I do not see the bug on glibc 2.2.5 or glibc 2.3.1 with gcc 3.2.3 or the mainline 
(20030615).
Comment 2 Takumi ASAKI 2003-06-16 01:59:37 UTC
Thanks. 
My glibc is 2.3.2. 
I'll check glibc. 
 
% rpm -q glibc 
glibc-2.3.2-37vl2