https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93469

--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Another approach would be something like we do for C99 functions on FreeBSD,
where we have a "DYNAMIC" macro that we check during preprocessing each TU, to
see if the functions have disappeared since we ran configure:

#define _GLIBCXX_USE_C99_CHECK 1
#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
#if _GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED
#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 1
#else
#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC 0
#endif
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1
#ifdef _XOPEN_SOURCE
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC 1
#else
#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC 0
#endif

But this results in functions that should be declared (and are actually defined
in the system's libm) being absent. And it's complicated and a bit confusing.

For most targets, if we detect that the function is present during configure,
it's reasonable to assume that the function is still present later even if the
declaration has been hidden. So we could inject any "missing" declarations, as
in comment 17. But macOS SDKs complicate that, because at preprocessing time
the user might have selected an SDK which really is missing a function like
aligned_alloc, and so injecting a declaration would not help. It would just
mean we delay the error until link time.

Reply via email to