From ceb17676cba178f56d00d21189c3f1765e5c2ae0 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Sat, 15 Jul 2017 20:54:06 +0530 Subject: swrap: Suppress intentional fall through warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Wimplicit-fallthrough compiler flag introduced with gcc v7 results in the following warning during compilation: [ 7%] Building C object src/CMakeFiles/socket_wrapper.dir/socket_wrapper.c.o src/socket_wrapper.c: In function ‘sockaddr_convert_to_un’: src/socket_wrapper.c:1846:18: warning: this statement may fall through [-Wimplicit-fallthrough=] case AF_UNSPEC: { ^ /src/socket_wrapper.c:1866:2: note: here case AF_INET: ^~~~ Default level for -Wimplicit-fallthrough(which is 3) allows us to get rid of the above warning using specific comments made within switch cases matching the regular expressions outlined in gcc docs[1]. But for us the presence of preprocessor directives in the vicinity of such comments nullifies its effect[2]. So our best bet would be to make use of the reliable fallthrough attribute and supress such warnings in future. [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817 Signed-off-by: Anoop C S Reviewed-by: Andreas Schneider Reviewed-by: Michael Adam --- config.h.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'config.h.cmake') diff --git a/config.h.cmake b/config.h.cmake index 2f494a4..b98ceff 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -62,6 +62,7 @@ #cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1 #cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1 #cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1 +#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1 #cmakedefine HAVE_ADDRESS_SANITIZER_ATTRIBUTE 1 #cmakedefine HAVE_SOCKADDR_STORAGE 1 #cmakedefine HAVE_IPV6 1 -- cgit