commit | ad472c5485fa292346a900c529eb207424486094 | [log] [tgz] |
---|---|---|
author | Jose Dapena Paz <[email protected]> | Thu Feb 29 08:29:17 2024 |
committer | Chromium LUCI CQ <[email protected]> | Thu Feb 29 08:29:17 2024 |
tree | 5d281883373e870105e681205005e137b756e158 | |
parent | 743cb0201cb36d7944286b8ce6f366a351f3bfbb [diff] [blame] |
Enable lightweight libstdc++ assertions Add the GN argument enable_safe_libstdcxx, that enables libstdc++ lightweight assertions, that protect against different bad conditions as invalid array indexes. Bug: 1497935 Change-Id: Icb8e85f47295d258bc5ec7bdd32fa58f06b4dcb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4994044 Commit-Queue: José Dapena Paz <[email protected]> Reviewed-by: Dirk Pranke <[email protected]> Reviewed-by: Nico Weber <[email protected]> Cr-Commit-Position: refs/heads/main@{#1266874}
diff --git a/base/libcpp_hardening_test.cc b/base/libcpp_hardening_test.cc index 4224447..b1f4d99 100644 --- a/base/libcpp_hardening_test.cc +++ b/base/libcpp_hardening_test.cc
@@ -12,7 +12,11 @@ // TODO(thakis): Remove _LIBCPP_ENABLE_ASSERTIONS here once // pnacl-saigo's libc++ is new enough. -#if !_LIBCPP_ENABLE_ASSERTIONS && \ +#if defined(__GLIBCXX__) +#if !defined(_GLIBCXX_ASSERTIONS) +#error "libstdc++ assertions should be enabled" +#endif +#elif !_LIBCPP_ENABLE_ASSERTIONS && \ _LIBCPP_HARDENING_MODE != _LIBCPP_HARDENING_MODE_EXTENSIVE #error "_LIBCPP_HARDENING_MODE not defined" #endif