[libcxx-commits] [libcxx] 091fc81 - [libc++][hardening] Check that `_LIBCPP_HARDENING_MODE_DEFAULT` is defined (#80353)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 6 13:45:35 PST 2024


Author: Konstantin Varlamov
Date: 2024-02-06T13:45:31-08:00
New Revision: 091fc81d485594d4b751c10518230769c905430c

URL: https://github.com/llvm/llvm-project/commit/091fc81d485594d4b751c10518230769c905430c
DIFF: https://github.com/llvm/llvm-project/commit/091fc81d485594d4b751c10518230769c905430c.diff

LOG: [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).

Added: 
    

Modified: 
    libcxx/include/__config

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index d356960e9e62b..0797880cb2f5d 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
 


        


More information about the libcxx-commits mailing list