From 7a6a455f182722a42fcba5a2fc57c0cd524c4764 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:04:55 -0700 Subject: Allow a compiler warning on MacOS (#7561) This PR is to allow a compiler warning even when all warnings are requested to be treated as errors. The following pattern is very common in Slang code base: if (auto var = as<...>(...)) And when `var` is not used, the compiler prints a warning. Alternatively we can remove `auto var =` part but there are too many. Co-authored-by: Jay Kwak --- cmake/CompilerFlags.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index 2019b554b..afd0760f6 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -112,10 +112,13 @@ function(set_default_compile_options target) -Wno-invalid-offsetof -Wno-newline-eof -Wno-return-std-move - # Enabled warnings: + # Allowed warnings: # If a function returns an address/reference to a local, we want it to # produce an error, because it probably means something very bad. -Werror=return-local-addr + # Allow unused variables with a pattern of `if (auto v = as<...>(...))`. + # This pattern is very common in Slang code base. + -Wno-error=unused-but-set-variable # Some warnings which are on by default in MSVC -Wnarrowing ) -- cgit v1.2.3