This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/57691] freestanding libstdc++ has compile error
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Jun 2013 12:29:51 +0000
- Subject: [Bug libstdc++/57691] freestanding libstdc++ has compile error
- Auto-submitted: auto-generated
- References: <bug-57691-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57691
--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Jonathan Wakely from comment #7)
> (In reply to Paolo Carlini from comment #4)
> > ... by the way, I'm *very* surprised that nobody noticed this over the
> > years: the freestanding atexit is declared like this in <cstdlib> in 4.0.0!?!
>
> It only matters on some less-well-tested targets, because
> NO_IMPLICIT_EXTERN_C is defined for sane targets. It might also not matter
> if the system headers declare:
> int atexit(void (*)(void));
> as GNU Libc does, because then the function is declared portably for both C
> and C++.
>
> Presumably the eCos headers either don't declare atexit or declare it
> without an abominable (void) parameter list.
the eCos stdlib.h declares it the right way:
stdlib.h:/* Type of function used by atexit() */
stdlib.h:typedef void (*__atexit_fn_t)( void );
stdlib.h:atexit( __atexit_fn_t /* func_to_register */ );
but because the cstdlib has this guard block it declares every thing
by itself:
#if !_GLIBCXX_HOSTED
// The C standard does not require a freestanding implementation to
// provide <stdlib.h>. However, the C++ standard does still require
// <cstdlib> -- but only the functionality mentioned in
// [lib.support.start.term].