diff options
author | Joerg Mayer <jmayer@loplof.de> | 2018-04-02 18:40:34 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-04-02 18:40:34 -0700 |
commit | 0a1a0ed3bce9d3b4fd41b1a0b53e948c15dd525b (patch) | |
tree | e94c47284dc420d292d9c51b7e009e0bc0fb098e | |
parent | d7d31639251c64e32aad97e85ec0b66280ab3c77 (diff) | |
download | libpcap-0a1a0ed3bce9d3b4fd41b1a0b53e948c15dd525b.tar.gz |
Enable -Wunused-parameter and fix warnings that are almost trivial.
Signed-off-by: Joerg Mayer <jmayer@loplof.de>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | aclocal.m4 | 1 | ||||
-rwxr-xr-x | configure | 86 | ||||
-rw-r--r-- | diag-control.h | 3 | ||||
-rwxr-xr-x | rpcapd/rpcapd.c | 7 |
5 files changed, 94 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 754f70d0..7c2444d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1675,6 +1675,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel) # Warns about safeguards added in case the enums are extended # check_and_add_compiler_option(-Wcovered-switch-default) check_and_add_compiler_option(-Wmissing-variable-declarations) + check_and_add_compiler_option(-Wunused-parameter) endif() endif() @@ -854,6 +854,7 @@ AC_DEFUN(AC_LBL_DEVEL, # extended # AC_LBL_CHECK_COMPILER_OPT($1, -Wcovered-switch-default) AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-variable-declarations) + AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-parameter) fi AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT() # @@ -8825,6 +8825,92 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Warns about safeguards added in case the enums are # extended # AC_LBL_CHECK_COMPILER_OPT(V_CCOPT, -Wcovered-switch-default) + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-variable-declarations option" >&5 +$as_echo_n "checking whether the compiler supports the -Wmissing-variable-declarations option... " >&6; } + save_CFLAGS="$CFLAGS" + if expr "x-Wmissing-variable-declarations" : "x-W.*" >/dev/null + then + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-variable-declarations" + elif expr "x-Wmissing-variable-declarations" : "x-f.*" >/dev/null + then + CFLAGS="$CFLAGS -Werror -Wmissing-variable-declarations" + elif expr "x-Wmissing-variable-declarations" : "x-m.*" >/dev/null + then + CFLAGS="$CFLAGS -Werror -Wmissing-variable-declarations" + else + CFLAGS="$CFLAGS -Wmissing-variable-declarations" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$save_CFLAGS" + V_CCOPT="$V_CCOPT -Wmissing-variable-declarations" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$save_CFLAGS" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wunused-parameter option" >&5 +$as_echo_n "checking whether the compiler supports the -Wunused-parameter option... " >&6; } + save_CFLAGS="$CFLAGS" + if expr "x-Wunused-parameter" : "x-W.*" >/dev/null + then + CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wunused-parameter" + elif expr "x-Wunused-parameter" : "x-f.*" >/dev/null + then + CFLAGS="$CFLAGS -Werror -Wunused-parameter" + elif expr "x-Wunused-parameter" : "x-m.*" >/dev/null + then + CFLAGS="$CFLAGS -Werror -Wunused-parameter" + else + CFLAGS="$CFLAGS -Wunused-parameter" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$save_CFLAGS" + V_CCOPT="$V_CCOPT -Wunused-parameter" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$save_CFLAGS" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports generating dependencies" >&5 diff --git a/diag-control.h b/diag-control.h index 761d3cfd..6abd53e5 100644 --- a/diag-control.h +++ b/diag-control.h @@ -78,7 +78,8 @@ PCAP_DO_PRAGMA(clang diagnostic push) \ PCAP_DO_PRAGMA(clang diagnostic ignored "-Wsign-compare") \ PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") \ - PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") + PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") \ + PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunused-parameter") #define DIAG_ON_FLEX \ PCAP_DO_PRAGMA(clang diagnostic pop) #elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6) diff --git a/rpcapd/rpcapd.c b/rpcapd/rpcapd.c index 21217c8b..cdd74754 100755 --- a/rpcapd/rpcapd.c +++ b/rpcapd/rpcapd.c @@ -44,6 +44,7 @@ #include "fmtutils.h" #include "sockutils.h" // for socket calls +#include "varattrs.h" // for _U_ #include "portability.h" #include "rpcapd.h" #include "config_params.h" // configuration file parameters @@ -691,7 +692,7 @@ static BOOL WINAPI main_ctrl_event(DWORD ctrltype) return TRUE; } #else -static void main_terminate(int sign) +static void main_terminate(int sign _U_) { // // Note that the server should shut down. @@ -701,7 +702,7 @@ static void main_terminate(int sign) shutdown_server = 1; } -static void main_reread_config(int sign) +static void main_reread_config(int sign _U_) { // // Note that the server should re-read its configuration file. @@ -711,7 +712,7 @@ static void main_reread_config(int sign) reread_config = 1; } -static void main_reap_children(int sign) +static void main_reap_children(int sign _U_) { pid_t pid; int exitstat; |