[clang] df69a30 - [Headers] Don't declare unreachable() from stddef.h in C++ (#86748)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 4 13:01:53 PDT 2024
Author: Ian Anderson
Date: 2024-04-04T13:01:49-07:00
New Revision: df69a305253f1d1b4a4066055a07101a4cc03e55
URL: https://github.com/llvm/llvm-project/commit/df69a305253f1d1b4a4066055a07101a4cc03e55
DIFF: https://github.com/llvm/llvm-project/commit/df69a305253f1d1b4a4066055a07101a4cc03e55.diff
LOG: [Headers] Don't declare unreachable() from stddef.h in C++ (#86748)
Even if __need_unreachable is set, stddef.h should not declare
unreachable() in C++ because it conflicts with the declaration in
\<utility>.
Added:
Modified:
clang/lib/Headers/__stddef_unreachable.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/__stddef_unreachable.h b/clang/lib/Headers/__stddef_unreachable.h
index 518580c92d3f5d..61df43e9732f8a 100644
--- a/clang/lib/Headers/__stddef_unreachable.h
+++ b/clang/lib/Headers/__stddef_unreachable.h
@@ -7,6 +7,8 @@
*===-----------------------------------------------------------------------===
*/
+#ifndef __cplusplus
+
/*
* When -fbuiltin-headers-in-system-modules is set this is a non-modular header
* and needs to behave as if it was textual.
@@ -15,3 +17,5 @@
(__has_feature(modules) && !__building_module(_Builtin_stddef))
#define unreachable() __builtin_unreachable()
#endif
+
+#endif
More information about the cfe-commits
mailing list