[flang-commits] [flang] [llvm] [flang] Try -Werror by default (take 2) (PR #175819)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Tue Jan 13 12:08:54 PST 2026
https://github.com/klausler updated https://github.com/llvm/llvm-project/pull/175819
>From dc7fc5ab6062ad002508bc36a9213afba94c7704 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Mon, 12 Jan 2026 17:11:22 -0800
Subject: [PATCH] [flang] Try -Werror by default (take 2)
Fix two legitimate warnings found by build bots the last time that
I tried to re-enable -Werror builds of flang-new by default, and
turn it back on for another try.
---
flang/CMakeLists.txt | 2 +-
flang/include/flang/Semantics/dump-expr.h | 2 +-
llvm/include/llvm/ProfileData/InstrProf.h | 10 ++++++----
3 files changed, 8 insertions(+), 6 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/include/flang/Semantics/dump-expr.h b/flang/include/flang/Semantics/dump-expr.h
index 5a78e13b19e5d..83f9be889d734 100644
--- a/flang/include/flang/Semantics/dump-expr.h
+++ b/flang/include/flang/Semantics/dump-expr.h
@@ -203,7 +203,7 @@ class DumpEvaluateExpr {
}
void Show(const evaluate::Relational<evaluate::SomeType> &x);
template <typename T> void Show(const evaluate::Expr<T> &x) {
- Indent("expr <" + std::string(TypeOf<T>::name) + ">");
+ Indent("expr <"s + std::string(TypeOf<T>::name) + ">");
Show(x.u);
Outdent();
}
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index f59ddc3e59324..7f5c16936ef28 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -1024,8 +1024,9 @@ struct InstrProfRecord {
getValueSitesForKind(uint32_t ValueKind) const {
if (!ValueData)
return {};
- assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
- "Unknown value kind!");
+ if constexpr (IPVK_First > 0)
+ assert(IPVK_First <= ValueKind && "Unknown value kind!");
+ assert(ValueKind <= IPVK_Last && "Unknown value kind!");
return (*ValueData)[ValueKind - IPVK_First];
}
@@ -1033,8 +1034,9 @@ struct InstrProfRecord {
getOrCreateValueSitesForKind(uint32_t ValueKind) {
if (!ValueData)
ValueData = std::make_unique<ValueProfData>();
- assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
- "Unknown value kind!");
+ if constexpr (IPVK_First > 0)
+ assert(IPVK_First <= ValueKind && "Unknown value kind!");
+ assert(ValueKind <= IPVK_Last && "Unknown value kind!");
return (*ValueData)[ValueKind - IPVK_First];
}
More information about the flang-commits
mailing list