aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Varlamov <varconsteq@gmail.com>2024-02-06 13:45:31 -0800
committerGitHub <noreply@github.com>2024-02-06 13:45:31 -0800
commit091fc81d485594d4b751c10518230769c905430c (patch)
tree305a27856fe5e2da8bc6a8cb4accec6804d4ff26
parente96ba2509d5a1a3ba4ebba806828fc62cd2c34de (diff)
downloadllvm-091fc81d485594d4b751c10518230769c905430c.zip
llvm-091fc81d485594d4b751c10518230769c905430c.tar.gz
llvm-091fc81d485594d4b751c10518230769c905430c.tar.bz2
[libc++][hardening] Check that `_LIBCPP_HARDENING_MODE_DEFAULT` is defined (#80353)
If the `_LIBCPP_HARDENING_MODE_DEFAULT` macro is not defined, `_LIBCPP_HARDENING_MODE` will be considered defined but fail the check for a valid hardening mode, resulting in a slightly less understandable error (that error is really meant more to prevent users from passing incorrect values such as `0` or `1` directly rather than catching configuration issues).
-rw-r--r--libcxx/include/__config6
1 files changed, 6 insertions, 0 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index d356960..0797880 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -325,6 +325,12 @@
// clang-format on
# ifndef _LIBCPP_HARDENING_MODE
+
+# ifndef _LIBCPP_HARDENING_MODE_DEFAULT
+# error _LIBCPP_HARDENING_MODE_DEFAULT is not defined. This definition should be set at configuration time in the \
+`__config_site` header, please make sure your installation of libc++ is not broken.
+# endif
+
# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
# endif