Skip to content

Commit b90dad5

Browse files
author
MarcoFalke
committed
Merge #17486: build: make Travis catch unused variables
18b18f8 [build] ./configure --enable-werror: add unused-variable (Sjors Provoost) Pull request description: The two macOS Travis machines run with `--enable-werror`. This PR adds `-Werror=unused-variable` to the existing `vla`, `switch` and `thread-safety-analysis` checks. This should prevent the need for fixes like b07b07c, 26a93bc, dd777f3, 99be644, fa39f67, 16bcc1b, bb079a0, bdaed47 and ecf9b25 with minimal nuisance. Thoughts for followups: * Travis starts these macOS machines fairly late, so we should consider setting `--enable-werror` on earlier machines as well. * We should encourage the use of `--enable-werror` by developers. Maybe switch it on by default for `--enable-debug`? * See practicalswift's overview of other checks to consider in #17344 ACKs for top commit: MarcoFalke: ACK 18b18f8 practicalswift: ACK 18b18f8 -- nice! Tree-SHA512: 892b471ca5ea547f3c952ac88190cbebf8110cb7aec6f20466aeb312aeb0910bfe990f914e153c40ecb55709c03775ef30770412ad76f9d532ca77055596c582
2 parents 1ed3e07 + 18b18f8 commit b90dad5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ if test "x$enable_werror" = "xyes"; then
329329
AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]])
330330
AX_CHECK_COMPILE_FLAG([-Werror=switch],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=switch"],,[[$CXXFLAG_WERROR]])
331331
AX_CHECK_COMPILE_FLAG([-Werror=thread-safety-analysis],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=thread-safety-analysis"],,[[$CXXFLAG_WERROR]])
332+
AX_CHECK_COMPILE_FLAG([-Werror=unused-variable],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unused-variable"],,[[$CXXFLAG_WERROR]])
332333
fi
333334

334335
if test "x$CXXFLAGS_overridden" = "xno"; then
@@ -341,6 +342,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
341342
AX_CHECK_COMPILE_FLAG([-Wthread-safety-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety-analysis"],,[[$CXXFLAG_WERROR]])
342343
AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]])
343344
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
345+
AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
344346

345347
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
346348
## unknown options if any other warning is produced. Test the -Wfoo case, and

0 commit comments

Comments
 (0)