This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: autoconf and gcc 3.0.1
- To: Stefan Seefeld <seefeld at sympatico dot ca>
- Subject: Re: autoconf and gcc 3.0.1
- From: Craig Rodrigues <rodrigc at mediaone dot net>
- Date: Mon, 20 Aug 2001 23:19:16 -0400
- Cc: gcc at gcc dot gnu dot org
- References: <3B81D667.7000104@sympatico.ca>
On Mon, Aug 20, 2001 at 10:32:55PM -0500, Stefan Seefeld wrote:
> extern "C" void exit(int);
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
>
> Compiling the above four lines with gcc 3.0.1 yields the
> error:
>
> bash$ g++ -c ~/foo.cc
> In file included from /home/stefan/foo.cc:4:
> /usr/include/stdlib.h:520: declaration of `void exit(int) throw ()' throws
> different exceptions
> /home/stefan/foo.cc:1: than previous declaration `void exit(int)'
> bash$
I assume you are running Linux. Take a look at the method
signature for exit() in stdlib.h:
/* Call all functions registered with `atexit' and `on_exit',
in the reverse of the order in which they were registered
perform stdio cleanup, and terminate program execution with STATUS. */
extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
If compiled with a C++ compiler, the __THROW is converted
to throw().
gcc 3.0 is much more fussy about making sure that
a method declaration and definition have the same exception
specification.
I don't have a copy of the ISO C standard, so I don't
know if exit() should have an exception specification
of throw() in its method signature.
You might want to ask the glibc people about this on
the libc-alpha mailing list.
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@mediaone.net