From aa13e41e5fd47f386f308cfe38561cfa94c2b16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 16 Jan 2020 14:57:46 +0100 Subject: [PATCH 1/4] [Minor] silence -Wmisleading-indentation in contrib/snowball/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../contrib/snowball/compiler/analyser.c: In function ‘check_name_type’: ../contrib/snowball/compiler/analyser.c:210:19: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 210 | case 'r': if (p->type == t_routine || | ^~ ../contrib/snowball/compiler/analyser.c:211:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 211 | p->type == t_external) return; break; | ^~~~~ ../contrib/snowball/compiler/analyser.c: In function ‘read_program’: ../contrib/snowball/compiler/analyser.c:859:21: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 859 | if (q->used && q->definition == 0) error4(a, q); break; | ^~ ../contrib/snowball/compiler/analyser.c:859:70: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 859 | if (q->used && q->definition == 0) error4(a, q); break; | ^~~~~ ../contrib/snowball/compiler/analyser.c:861:21: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 861 | if (q->used && q->grouping == 0) error4(a, q); break; | ^~ ../contrib/snowball/compiler/analyser.c:861:68: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 861 | if (q->used && q->grouping == 0) error4(a, q); break; | ^~~~~ --- contrib/snowball/compiler/analyser.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/snowball/compiler/analyser.c b/contrib/snowball/compiler/analyser.c index 68c0d2d90..ed712f64f 100644 --- a/contrib/snowball/compiler/analyser.c +++ b/contrib/snowball/compiler/analyser.c @@ -207,8 +207,7 @@ static void check_name_type(struct analyser * a, struct name * p, int type) { case 'i': if (p->type == t_integer) return; break; case 'b': if (p->type == t_boolean) return; break; case 'R': if (p->type == t_grouping) return; - case 'r': if (p->type == t_routine || - p->type == t_external) return; break; + case 'r': if (p->type == t_routine || p->type == t_external) return; break; case 'g': if (p->type == t_grouping) return; break; } error2(a, 33, type); @@ -856,9 +855,9 @@ extern void read_program(struct analyser * a) { until (q == 0) { switch(q->type) { case t_external: case t_routine: - if (q->used && q->definition == 0) error4(a, q); break; + if (q->used && q->definition == 0) { error4(a, q); } break; case t_grouping: - if (q->used && q->grouping == 0) error4(a, q); break; + if (q->used && q->grouping == 0) { error4(a, q); } break; } q = q->next; } From d1410ad779dce6fa65ae3c296044551165d355b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 16 Jan 2020 15:01:19 +0100 Subject: [PATCH 2/4] [Minor] silence redefinition of macro [74/340] Building C object contrib/lua-lpeg/CMakeFiles/rspamd-lpeg.dir/lpprint.c.o In file included from ../contrib/lua-lpeg/lpprint.c:11: ../contrib/lua-lpeg/lptypes.h:15: warning: "NDEBUG" redefined 15 | #define NDEBUG | : note: this is the location of the previous definition [75/340] Building C object contrib/lua-lpeg/CMakeFiles/rspamd-lpeg.dir/lpcap.c.o In file included from ../contrib/lua-lpeg/lpcap.h:9, from ../contrib/lua-lpeg/lpcap.c:9: ../contrib/lua-lpeg/lptypes.h:15: warning: "NDEBUG" redefined 15 | #define NDEBUG | : note: this is the location of the previous definition [77/340] Building C object contrib/lua-lpeg/CMakeFiles/rspamd-lpeg.dir/lpvm.c.o In file included from ../contrib/lua-lpeg/lpcap.h:9, from ../contrib/lua-lpeg/lpvm.c:15: ../contrib/lua-lpeg/lptypes.h:15: warning: "NDEBUG" redefined 15 | #define NDEBUG | : note: this is the location of the previous definition [79/340] Building C object contrib/lua-lpeg/CMakeFiles/rspamd-lpeg.dir/lpcode.c.o In file included from ../contrib/lua-lpeg/lpcode.c:12: ../contrib/lua-lpeg/lptypes.h:15: warning: "NDEBUG" redefined 15 | #define NDEBUG | : note: this is the location of the previous definition [81/340] Building C object contrib/lua-lpeg/CMakeFiles/rspamd-lpeg.dir/lptree.c.o In file included from ../contrib/lua-lpeg/lptree.c:15: ../contrib/lua-lpeg/lptypes.h:15: warning: "NDEBUG" redefined 15 | #define NDEBUG | : note: this is the location of the previous definition --- contrib/lua-lpeg/lptypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lua-lpeg/lptypes.h b/contrib/lua-lpeg/lptypes.h index 9dee116cd..46aac07a9 100644 --- a/contrib/lua-lpeg/lptypes.h +++ b/contrib/lua-lpeg/lptypes.h @@ -11,7 +11,7 @@ #include "config.h" -#if !defined(LPEG_DEBUG) +#if !defined(LPEG_DEBUG) && !defined(NDEBUG) #define NDEBUG #endif From e98f08c797a2159d6f6c328a2a3c680a44c743f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 16 Jan 2020 15:36:53 +0100 Subject: [PATCH 3/4] [Minor] use modern name -Wextra instead of -W --- cmake/CompilerWarnings.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index a9797f539..b9bb7ffde 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -1,5 +1,5 @@ CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL) -CHECK_C_COMPILER_FLAG(-W SUPPORT_W) +CHECK_C_COMPILER_FLAG(-Wextra SUPPORT_WEXTRA) CHECK_C_COMPILER_FLAG(-Wpointer-arith SUPPORT_WPOINTER) CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM) CHECK_C_COMPILER_FLAG(-Wno-unused-function SUPPORT_WFUNCTION) @@ -16,9 +16,9 @@ CHECK_C_COMPILER_FLAG(-Wduplicated-cond SUPPORT_WDUPLICATED_COND) # GCC 7 specific CHECK_C_COMPILER_FLAG(-Wimplicit-fallthrough SUPPORT_WIMPLICIT_FALLTHROUGH) -IF(SUPPORT_W) - ADD_COMPILE_OPTIONS("-W") -ENDIF(SUPPORT_W) +IF(SUPPORT_WEXTRA) + ADD_COMPILE_OPTIONS("-Wextra") +ENDIF(SUPPORT_WEXTRA) IF(SUPPORT_WALL) ADD_COMPILE_OPTIONS("-Wall") ENDIF(SUPPORT_WALL) @@ -69,4 +69,4 @@ ENDIF(SUPPORT_WIMPLICIT_FALLTHROUGH) CHECK_C_COMPILER_FLAG(-fPIC SUPPORT_FPIC) IF(SUPPORT_FPIC) ADD_COMPILE_OPTIONS("-fPIC") -ENDIF(SUPPORT_FPIC) \ No newline at end of file +ENDIF(SUPPORT_FPIC) From 25d8df0b735c6b966b05cc3ce4a8f69cf20b199f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 16 Jan 2020 15:09:46 +0100 Subject: [PATCH 4/4] [Minor] do not pass invalid C warnings to C++ flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cc1plus: warning: command line option ‘-Wno-pointer-sign’ is valid for C/ObjC but not for C++ cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ --- cmake/CompilerWarnings.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index b9bb7ffde..4dd011d98 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -35,10 +35,12 @@ IF(SUPPORT_WUNUSED_VAR) ADD_COMPILE_OPTIONS("-Wunused-variable") ENDIF(SUPPORT_WUNUSED_VAR) IF(SUPPORT_WPOINTER_SIGN) - ADD_COMPILE_OPTIONS("-Wno-pointer-sign") + # only valid for C + ADD_COMPILE_OPTIONS($<$:-Wno-pointer-sign>) ENDIF(SUPPORT_WPOINTER_SIGN) IF(SUPPORT_WSTRICT_PROTOTYPES) - ADD_COMPILE_OPTIONS("-Wstrict-prototypes") + # only valid for C + ADD_COMPILE_OPTIONS($<$:-Wstrict-prototypes>) ENDIF(SUPPORT_WSTRICT_PROTOTYPES) IF(SUPPORT_WSTRICT_ALIASING) ADD_COMPILE_OPTIONS("-Wno-strict-aliasing")