This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Your g++ breaks glibc.
- To: jason at cygnus dot com
- Subject: Your g++ breaks glibc.
- From: hjl at varesearch dot com (H.J. Lu)
- Date: Wed, 14 Jul 1999 12:55:21 -0700 (PDT)
- Cc: egcs-bugs at egcs dot cygnus dot com,libc-hacker at sourceware dot cygnus dot com (GNU C Library),egcs at egcs dot cygnus dot com
Hi,
Your change:
1998-12-07 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (init_decl_processing): If neither -fpermissive or -pedantic
were specified, set flag_pedantic_errors.
breaks glibc. That is a code fragment generated by autoconf. With gcc
2.95, I got
# gcc -S bar.cc
In file included from bar.cc:5:
/usr/include/stdlib.h:520: declaration of `exit(int)' throws different exceptions
bar.cc:2: previous declaration here
egcs 1.1.2 only gives a warning. It should be fixed in gcc 2.95.
How does this patch sound?
--- ../../import/gcc-2.95/egcs/gcc/cp/decl.c Fri Jul 9 08:32:50 1999
+++ gcc/cp/decl.c Wed Jul 14 12:51:56 1999
@@ -3516,7 +3516,8 @@ duplicate_decls (newdecl, olddecl)
TREE_TYPE (olddecl) = build_exception_variant (newtype,
TYPE_RAISES_EXCEPTIONS (oldtype));
- if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
+ if ((pedantic || (! DECL_IN_SYSTEM_HEADER (olddecl)
+ && ! DECL_IN_SYSTEM_HEADER (newdecl)))
&& DECL_SOURCE_LINE (olddecl) != 0
&& flag_exceptions
&& ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
extern "C" {
void exit (int);
};
#include <stdlib.h>