[flang-commits] [flang] [llvm] [CMake] Enable warnings for PCH (PR #176566)
Alexis Engelke via flang-commits
flang-commits at lists.llvm.org
Sat Jan 17 05:22:50 PST 2026
https://github.com/aengelke updated https://github.com/llvm/llvm-project/pull/176566
>From eee1d27e8096be7b803900ae602ce42d2c9bc202 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Sat, 17 Jan 2026 13:09:40 +0000
Subject: [PATCH 1/2] [CMake] Enable warnings for PCH
CMake unfortunately disables this by default...
---
llvm/cmake/modules/HandleLLVMOptions.cmake | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 311123084bf58..8b7c8cd4028bd 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1304,6 +1304,13 @@ if (LLVM_BUILD_INSTRUMENTED AND LLVM_BUILD_INSTRUMENTED_COVERAGE)
message(FATAL_ERROR "LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE cannot both be specified")
endif()
+if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
+ # CMake weirdly marks all PCH as system headers. This undocumented variable
+ # can be used to suppress the "#pragma clang system_header".
+ # See: https://gitlab.kitware.com/cmake/cmake/-/issues/21219
+ set(CMAKE_PCH_PROLOGUE "")
+endif()
+
set(LLVM_THINLTO_CACHE_PATH "${PROJECT_BINARY_DIR}/lto.cache" CACHE STRING "Set ThinLTO cache path. This can be used when building LLVM from several different directiories.")
if(LLVM_ENABLE_LTO AND WIN32 AND NOT LINKER_IS_LLD_LINK AND NOT MINGW)
>From 4b4dfe3f898d3b8eee4c5a8fc17a9fbe1df7e871 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Sat, 17 Jan 2026 13:10:56 +0000
Subject: [PATCH 2/2] [Flang][NFC] Fix warning
---
flang/include/flang/Lower/DirectivesCommon.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flang/include/flang/Lower/DirectivesCommon.h b/flang/include/flang/Lower/DirectivesCommon.h
index 8d90b525aefce..195c2f6102066 100644
--- a/flang/include/flang/Lower/DirectivesCommon.h
+++ b/flang/include/flang/Lower/DirectivesCommon.h
@@ -527,8 +527,8 @@ fir::factory::AddrAndBoundsInfo gatherDataOperandAddrAndBounds(
builder, operandLocation, dataExv, dataExvIsAssumedSize,
strideIncludeLowerExtent);
}
- if (genDefaultBounds && fir::characterWithDynamicLen(
- fir::unwrapRefType(info.addr.getType())) ||
+ if ((genDefaultBounds && fir::characterWithDynamicLen(
+ fir::unwrapRefType(info.addr.getType()))) ||
mlir::isa<fir::BoxCharType>(
fir::unwrapRefType(info.addr.getType()))) {
bounds = {fir::factory::genBoundsOpFromBoxChar<BoundsOp, BoundsType>(
More information about the flang-commits
mailing list