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

Jannik Glückert via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 19 13:25:44 PDT 2024


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

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

This was the case for us on Gentoo.

>From c40f424a0771a86142face130f01f26976c74cd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jannik=20Gl=C3=BCckert?= <jannik.glueckert at gmail.com>
Date: Thu, 19 Sep 2024 22:13:46 +0200
Subject: [PATCH] [libc++][test] fix redefinition of _LIBCPP_HARDENING_MODE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

Signed-off-by: Jannik Glückert <jannik.glueckert at gmail.com>
---
 libcxx/utils/libcxx/test/params.py | 1 +
 1 file changed, 1 insertion(+)

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,



More information about the libcxx-commits mailing list