[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 11:24:51 PST 2026


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/175053

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.

>From 0e5eb7582ed900f2a305f5a11567778ee4fa626c 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.
---
 flang/CMakeLists.txt                | 2 +-
 llvm/include/llvm/ADT/SmallVector.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

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/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