[llvm] Warnings from system libraries should be private for them (PR #138826)

Valery Mironov via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 12:27:04 PST 2025


https://github.com/MBkkt updated https://github.com/llvm/llvm-project/pull/138826

>From c4a87fd5cc82f15c825ec281de43b8c93744d7b8 Mon Sep 17 00:00:00 2001
From: Valery Mironov <valera.mironow at gmail.com>
Date: Wed, 7 May 2025 11:42:57 +0300
Subject: [PATCH] Warnings from system libraries should be private for them

Otherwise these define will be produced to user targets
---
 runtimes/cmake/Modules/WarningFlags.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runtimes/cmake/Modules/WarningFlags.cmake b/runtimes/cmake/Modules/WarningFlags.cmake
index 43ef76561cc54..c253b9b117bc4 100644
--- a/runtimes/cmake/Modules/WarningFlags.cmake
+++ b/runtimes/cmake/Modules/WarningFlags.cmake
@@ -2,7 +2,7 @@ include(HandleFlags)
 
 # Warning flags ===============================================================
 function(cxx_add_warning_flags target enable_werror enable_pedantic)
-  target_compile_definitions(${target} PUBLIC -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+  target_compile_definitions(${target} PRIVATE -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
   if (MSVC)
     # -W4 is the cl.exe/clang-cl equivalent of -Wall. (In cl.exe and clang-cl,
     # -Wall is equivalent to -Weverything in GCC style compiler drivers.)



More information about the llvm-commits mailing list