Skip to content

Commit 091fc81

Browse files
authored
[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).
1 parent e96ba25 commit 091fc81

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libcxx/include/__config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@
325325
// clang-format on
326326

327327
# ifndef _LIBCPP_HARDENING_MODE
328+
329+
# ifndef _LIBCPP_HARDENING_MODE_DEFAULT
330+
# error _LIBCPP_HARDENING_MODE_DEFAULT is not defined. This definition should be set at configuration time in the \
331+
`__config_site` header, please make sure your installation of libc++ is not broken.
332+
# endif
333+
328334
# define _LIBCPP_HARDENING_MODE _LIBCPP_HARDENING_MODE_DEFAULT
329335
# endif
330336

0 commit comments

Comments
 (0)