[libcxx-commits] [libcxx] [libc++][test] fix redefinition of _LIBCPP_HARDENING_MODE (PR #109330)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 19 13:26:35 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Jannik Glückert (Jannik2099)

<details>
<summary>Changes</summary>

-D_LIBCPP_HARDENING_MODE may be set in clang config files or through CXXFLAGS

This was the case for us on Gentoo.

---
Full diff: https://github.com/llvm/llvm-project/pull/109330.diff


1 Files Affected:

- (modified) libcxx/utils/libcxx/test/params.py (+1) 


``````````diff
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 13c7297fd7304f..732300232c79cf 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -392,6 +392,7 @@ def getSuitableClangTidy(cfg):
         actions=lambda hardening_mode: filter(
             None,
             [
+                AddCompileFlag("-U_LIBCPP_HARDENING_MODE")                                  if hardening_mode != "undefined" else None,
                 AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE")      if hardening_mode == "none" else None,
                 AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST")      if hardening_mode == "fast" else None,
                 AddCompileFlag("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") if hardening_mode == "extensive" else None,

``````````

</details>


https://github.com/llvm/llvm-project/pull/109330


More information about the libcxx-commits mailing list