[Bug libstdc++/57691] freestanding libstdc++ has compile error

bernd.edlinger at hotmail dot de gcc-bugzilla@gcc.gnu.org
Mon Jun 24 12:29:00 GMT 2013


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].



More information about the Gcc-bugs mailing list