tpoechtrager / cctools-port

Apple cctools port for Linux and *BSD
728 stars 167 forks source link

Adding `throw()` after `__cxa_atexit` redefinition conflicts with cxxabi.h prototype #144

Open Torrekie opened 10 months ago

Torrekie commented 10 months ago
ld.cpp:1702:16: error: exception specification in declaration does not match previous declaration
extern "C" int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) CXA_ATEXIT_THROW;
               ^
/usr/bin/../include/c++/v1/cxxabi.h:140:32: note: previous declaration is here
extern _LIBCXXABI_FUNC_VIS int __cxa_atexit(void (*f)(void *), void *p,
                               ^
18 warnings and 1 error generated.

Latest llvm has been removed __cxa_atexit prototype from cxxabi.h so that this code works, but not for older llvm. Besides, Apple did not add throw() to the redefinition in the original code of ld.cpp

Possible patch is define CXA_ATEXIT_THROW as nothing when __APPLE__