[flang] [llvm] [llvm][flang] Silence warning, resume -Werror builds of flang (PR #175053)
Peter Klausler via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 8 13:32:21 PST 2026
https://github.com/klausler updated https://github.com/llvm/llvm-project/pull/175053
>From f28e541d8648979fa0598417c0e7e2f5ebd85946 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Thu, 8 Jan 2026 11:20:31 -0800
Subject: [PATCH] [llvm][flang] Silence warning, resume -Werror builds of flang
Add (void) uses of two parameters to dodge a C++ compiler warning
that has broken -Werror builds of flang since 9-28-25, and restore
that option as the default for flang builds.
Also tweak the source to remove a work-around for an MSVC bug
(presumed to have been fixed) that now produces a warning in CI.
---
flang/CMakeLists.txt | 2 +-
flang/lib/Evaluate/fold-real.cpp | 8 +-------
llvm/include/llvm/ADT/SmallVector.h | 2 ++
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index c01eb56d5e496..390cfe749f962 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -37,7 +37,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
`CMakeFiles'. Please delete them.")
endif()
-option(FLANG_ENABLE_WERROR "Fail and stop building flang if a warning is triggered." OFF)
+option(FLANG_ENABLE_WERROR "Fail and stop building flang if a warning is triggered." ON)
# Check for a standalone build and configure as appropriate from
# there.
diff --git a/flang/lib/Evaluate/fold-real.cpp b/flang/lib/Evaluate/fold-real.cpp
index 1ff941053a82e..907d01b005a04 100644
--- a/flang/lib/Evaluate/fold-real.cpp
+++ b/flang/lib/Evaluate/fold-real.cpp
@@ -387,13 +387,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
ScalarFunc<T, T, TBY>(
[&](const Scalar<T> &x, const Scalar<TBY> &y) -> Scalar<T> {
ValueWithRealFlags<Scalar<T>> result{
- x.
-// MSVC chokes on the keyword "template" here in a call to a
-// member function template.
-#ifndef _MSC_VER
- template
-#endif
- SCALE<Scalar<TBY>>(y)};
+ x.template SCALE<Scalar<TBY>>(y)};
if (result.flags.test(RealFlag::Overflow)) {
context.Warn(common::UsageWarning::FoldingException,
"SCALE/IEEE_SCALB intrinsic folding overflow"_warn_en_US);
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 51109d1f416f2..23d40c3e07675 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -211,6 +211,8 @@ class SmallVectorTemplateCommon
this->assertSafeToReferenceAfterResize(From, 0);
this->assertSafeToReferenceAfterResize(To - 1, 0);
}
+ (void)From;
+ (void)To;
}
/// Check whether any part of the range will be invalidated by growing.
More information about the llvm-commits
mailing list