[clang] c4de358 - [libc] Fix wrapper headers for `at_quick_exit` on GLIBC
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 17:12:34 PDT 2024
Author: Joseph Huber
Date: 2024-08-07T19:12:26-05:00
New Revision: c4de35813a11b311c4bba013d8571f1a7e62e02e
URL: https://github.com/llvm/llvm-project/commit/c4de35813a11b311c4bba013d8571f1a7e62e02e
DIFF: https://github.com/llvm/llvm-project/commit/c4de35813a11b311c4bba013d8571f1a7e62e02e.diff
LOG: [libc] Fix wrapper headers for `at_quick_exit` on GLIBC
Summary:
GLIBC likes to define this with the C++ linkage in the header, which
conflict. For now just hack around it by pretending it's `atexit` since
it has the same signature.
Added:
Modified:
clang/lib/Headers/llvm_libc_wrappers/stdlib.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/llvm_libc_wrappers/stdlib.h b/clang/lib/Headers/llvm_libc_wrappers/stdlib.h
index 7fce5a1a31d52..69afdf4a6897e 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/stdlib.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/stdlib.h
@@ -34,8 +34,16 @@ _Static_assert(__builtin_offsetof(div_t, quot) == 0, "ABI mismatch!");
_Static_assert(__builtin_offsetof(ldiv_t, quot) == 0, "ABI mismatch!");
_Static_assert(__builtin_offsetof(lldiv_t, quot) == 0, "ABI mismatch!");
+#if defined(__GLIBC__) && __cplusplus >= 201703L
+#define at_quick_exit atexit
+#endif
+
#include <llvm-libc-decls/stdlib.h>
+#if defined(__GLIBC__) && __cplusplus >= 201703L
+#undef at_quick_exit
+#endif
+
#pragma omp end declare target
#undef __LIBC_ATTRS
More information about the cfe-commits
mailing list