Hello, attached a patch with the almost trivial fixes for -Wunused-paramter warnings.
The reason I'm sending this as a mail is, that while the patches look trivial I'm not sure that they are always the correct approach: - Why was envp[] part of the main() declaration? - Is adding varattrs.h to rpcapd/rpcapd.c the correct approach to add _U_? - IMO with these silenced, we can add the warning to devel. The remaining warnings need someone with better understanding of the code to fix: - rpcapd/daemon.c:1538:183: warning: unused parameter 'samp_param' could be silenced by removing it, or by removing the #if 0 around "// Apply sampling parameters" - bpf/net/bpf_filter.c:214:61: warning: unused parameter 'aux_data' led to the following questions: + Is it correct to assume that neither KERNEL nor _KERNEL will be defined anymore? + Is it correct to assume that SKF_AD_VLAN_TAG will be defined if SKF_AD_VLAN_TAG_PRESENT is defined? + Is it correct that the sequence "ANCILLARY(VLAN_TAG);ANCILLARY(VLAN_TAG_PRESENT);" doesn't make too much sense, once the "break;" at the end of the macro is expanded? + ==> This file looks like it is containing a bit of no longer needed code. - pcap-rpcap.c:837:81: warning: unused parameter 'mode' also led to some questions: + Why is pcap_stats_ex_rpcap() limited to win32? + Does it make sense to have REMOTE as a compile time flag? In case it does: + Does it make sense to check for REMOTE in pcap-rpcap.c? Kind regards Jörg -- Joerg Mayer <jma...@loplof.de> We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology.
>From 40b9c76ea2abc2a6319d8562b38fc39345e3226e Mon Sep 17 00:00:00 2001 From: Joerg Mayer <jma...@loplof.de> Date: Sat, 31 Mar 2018 13:38:01 +0200 Subject: [PATCH] Fix -Wunused-paramter warnings that are almost trivial and enable the warning Signed-off-by: Joerg Mayer <jma...@loplof.de> --- CMakeLists.txt | 1 + aclocal.m4 | 1 + diag-control.h | 3 ++- rpcapd/rpcapd.c | 11 ++++++----- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23f7036f..955b1685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1674,6 +1674,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel) check_and_add_compiler_option(-Wmissing-noreturn) # Warns about safeguards added in case the enums are extended # check_and_add_compiler_option(-Wcovered-switch-default) + check_and_add_compiler_option(-Wunused-parameter) endif() endif() diff --git a/aclocal.m4 b/aclocal.m4 index a2ee7bb7..23d16221 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -853,6 +853,7 @@ AC_DEFUN(AC_LBL_DEVEL, # Warns about safeguards added in case the enums are # extended # AC_LBL_CHECK_COMPILER_OPT($1, -Wcovered-switch-default) + AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-parameter) fi AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT() # diff --git a/diag-control.h b/diag-control.h index 751faa08..ad5495ce 100644 --- a/diag-control.h +++ b/diag-control.h @@ -76,7 +76,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 a57df161..b1674b11 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 "fileconf.h" // for the configuration file management @@ -146,7 +147,7 @@ static void printusage(void) //! Program main -int main(int argc, char *argv[], char *envp[]) +int main(int argc, char *argv[]) { char savefile[MAX_LINE + 1]; // name of the file on which we have to save the configuration int isdaemon = 0; // Not null if the user wants to run this program as a daemon @@ -560,7 +561,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. @@ -570,7 +571,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. @@ -582,7 +583,7 @@ static void main_reread_config(int sign) #endif #ifdef _WIN32 -static void main_abort(int sign) +static void main_abort(int sign _U_) { struct listen_sock *sock_info; @@ -614,7 +615,7 @@ static void main_abort(int sign) #endif #ifndef _WIN32 -static void main_reap_children(int sign) +static void main_reap_children(int sign _U_) { pid_t pid; int exitstat; -- 2.14.3 (Apple Git-98)
_______________________________________________ tcpdump-workers mailing list tcpdump-workers@lists.tcpdump.org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers