From 9dac5ece77ef75ace284a0b3145f06feb099d0f9 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Wed, 3 Apr 2019 10:44:57 -0700 Subject: [PATCH] build: make compiler warning options compatible with clang This patch updates m4/compiler-warnings.m4 as follows to make it more compatible with clang: * clang doesn't support -Wunused-but-set-variable, which can be replaced with -Wunused-variable as the latter covers unused variables with or without an assigned value and is supported by gcc and clang. * -Wno-unused-function is added to let clang ignore unused functions that are auto-generated. --- m4/compiler_warnings.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/compiler_warnings.m4 b/m4/compiler_warnings.m4 index 2a682684..35d005c2 100644 --- a/m4/compiler_warnings.m4 +++ b/m4/compiler_warnings.m4 @@ -10,8 +10,8 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then for option in -Wmissing-declarations -Wmissing-prototypes \ -Wdeclaration-after-statement -Wstrict-prototypes \ -Wno-unused-parameter -Wno-sign-compare \ - -Wno-deprecated-declarations \ - -Wunused-but-set-variable -Wformat-security; do + -Wno-deprecated-declarations -Wno-unused-function \ + -Wunused-variable -Wformat-security; do SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $option -Werror" AC_MSG_CHECKING([whether gcc understands $option])