[libcxx-commits] [PATCH] D153902: [libc++][hardening][NFC] Add macros to enable hardened mode.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 6 11:33:29 PDT 2023
ldionne added inline comments.
================
Comment at: libcxx/test/libcxx/assertions/modes/debug.pass.cpp:1
+//===----------------------------------------------------------------------===//
+//
----------------
I think we should add a test like this:
```
// This test ensures that we can disable the debug mode on a per-TU basis regardless of how the library was built.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_DEBUG_MODE=0
// now check that _LIBCPP_ASSERT_UNCATEGORIZED doesn't fire.
```
We should do the same for the hardened mode too.
================
Comment at: libcxx/test/libcxx/assertions/modes/debug.pass.cpp:3
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
----------------
We also need one like this:
```
// This test ensures that we can enable the debug mode on a per-TU basis regardless of how the library was built.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_DEBUG_MODE=1
// now check that _LIBCPP_ASSERT_UNCATEGORIZED fires.
```
We should do the same for the hardened mode too.
================
Comment at: libcxx/test/libcxx/assertions/modes/debug.pass.cpp:8-9
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: !libcpp-has-debug-mode
+
----------------
Similar comments should also be added to the hardened mode tests.
================
Comment at: libcxx/test/libcxx/assertions/modes/debug_mode_not_1_or_0.verify.cpp:13-17
+int main(int, char**) {
+ // expected-error@*:* {{_LIBCPP_ENABLE_DEBUG_MODE must be set to 0 or 1.}}
+
+ return 0;
+}
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153902/new/
https://reviews.llvm.org/D153902
More information about the libcxx-commits
mailing list