|
From: Nicholas N. <n.n...@gm...> - 2009-02-24 03:13:16
|
Hi, As a follow-up to the recent thread about -Wextra, I went through all the warnings found by -Wunused-parameters (one of the flags enabled by -Wextra). I removed some of the ones found in r9248. The summary is below. There were a number of strange things that some warnings highlighted, which I've listed under "removable, probably should be, or complicated". As for whether this warning should be enabled permanently: most of things it finds aren't important, but there are a couple of oddities that seem worth investigating. There are also lots of cases where unused params are unavoidable, but they're also easy to workaround with __attribute__((unused)) which could be #defined to VG_UNUSED or similar. Thoughts? Nick ----------------------------------------------------------------------------- removable and removed (r9248) ----------------------------------------------------------------------------- m_main.c:307: warning: unused parameter 'client_auxv' m_mallocfree.c:405: warning: unused parameter 'a' m_mallocfree.c:411: warning: unused parameter 'a' m_mallocfree.c:417: warning: unused parameter 'a' m_mallocfree.c:423: warning: unused parameter 'a' m_transtab.c:1354: warning: unused parameter 'is_self_checking' m_demangle/cplus-dem.c:2161: warning: unused parameter 'work' m_scheduler/scheduler.c:335: warning: unused parameter 'tid' m_syswrap/syswrap-main.c:739: warning: unused parameter 'tid' m_debuginfo/readdwarf.c:964: warning: unused parameter 'di' m_syswrap/syswrap-generic.c:192: warning: unused parameter 'offset' m_syswrap/syswrap-generic.c:507: warning: unused parameter 'tid' m_sigframe/sigframe-x86-linux.c:441: warning: unused parameter 'mask' m_sigframe/sigframe-x86-linux.c:462: warning: unused parameter 'handler' m_sigframe/sigframe-x86-linux.c:520: warning: unused parameter 'handler' mc_malloc_wrappers.c:186: warning: unused parameter 'rzB' mc_main.c:4414: warning: unused parameter 'tid' mc_errors.c:720: warning: unused parameter 'isAddrErr' ----------------------------------------------------------------------------- removable, probably should be, or complicated ----------------------------------------------------------------------------- // If you remove this parameter, it seems as though the 'client_stack_szB' // field isn't necessary -- AFAICT it gets set in various places but never // used, except it's printed in m_signals.c:default_action() if a SEGV // happens. ?? m_signals.c:1660: warning: unused parameter 'maxsize' // Should probably be removed by Josef. debug.c:115: warning: unused parameter 'jumpaddr' sim.c:494: warning: unused parameter 'size' callstack.c:117: warning: unused parameter 'to' callstack.c:150: warning: unused parameter 'from' dump.c:1476: warning: unused parameter 'buf' dump.c:1476: warning: unused parameter 'tid' // Not used, but it seems like it should be -- the caller makes a big deal // about this parameter. libhb_core.c:4209: warning: unused parameter 'uu_normalise' // Seems redundant, Julian should check. h_main.c:3281: warning: unused parameter 'result' // ??? libhb_core.c:4835: warning: unused parameter 'thr' // Not sure about this -- the function claims to clear the iteration flag // but is empty. m_wordfm.c:801: warning: unused parameter 'fm' // Like m_wordfm.c -- this file seems to reimplement m_wordfm.c within it! cg_merge.c:1535: warning: unused parameter 'fm' ----------------------------------------------------------------------------- removable but not removed (and why) ----------------------------------------------------------------------------- // Arguably for consistency. h_main.c:3811: warning: unused parameter 'a3' h_main.c:3811: warning: unused parameter 'a4' // Arguably worth keeping for consistency with symtab_sz. m_debuginfo/readelf.c:540: warning: unused parameter 'strtab_szB' m_debuginfo/readelf.c:638: warning: unused parameter 'strtab_szB' // Arguably worth keeping for consistency with debug_*_sz. m_debuginfo/readdwarf.c:1129: warning: unused parameter 'debug_abbv_sz' m_debuginfo/readdwarf.c:1131: warning: unused parameter 'debug_str_sz' // Arguably worth keeping for consistency with data_a_f. m_debuginfo/readdwarf.c:3033: warning: unused parameter 'code_a_f' // Arguably worth keeping for consistency with the rest of readdwarf3.c. m_debuginfo/storage.c:779: warning: unused parameter 'show' m_debuginfo/readdwarf3.c:816: warning: unused parameter 'td3' m_debuginfo/readdwarf3.c:935: warning: unused parameter 'td3' // Arguably worth keeping for consistency with other post-syscall handlers. m_syswrap/syswrap-linux.c:2680: warning: unused parameter 'res' // Could be used in the future. m_coredump/coredump-x86-linux.c:80: warning: unused parameter 'fpu' m_coredump/coredump-x86-linux.c:81: warning: unused parameter 'arch' m_sigframe/sigframe-x86-linux.c:650: warning: unused parameter 'fpstate' // Arguably worth keeping for consistency, ie. just always pass the args m_syswrap/syswrap-linux.c:2615: warning: unused parameter 'arg0' m_syswrap/syswrap-linux.c:2615: warning: unused parameter 'arg3' m_syswrap/syswrap-linux.c:2625: warning: unused parameter 'arg0' m_syswrap/syswrap-linux.c:2626: warning: unused parameter 'arg3' m_syswrap/syswrap-linux.c:2626: warning: unused parameter 'arg4' m_syswrap/syswrap-linux.c:2637: warning: unused parameter 'arg0' m_syswrap/syswrap-linux.c:2637: warning: unused parameter 'arg2' m_syswrap/syswrap-linux.c:2638: warning: unused parameter 'arg3' m_syswrap/syswrap-linux.c:2638: warning: unused parameter 'arg4' m_syswrap/syswrap-linux.c:2647: warning: unused parameter 'arg0' m_syswrap/syswrap-linux.c:2681: warning: unused parameter 'arg0' m_syswrap/syswrap-linux.c:2762: warning: unused parameter 'status' m_syswrap/syswrap-linux.c:2771: warning: unused parameter 'status' m_syswrap/syswrap-linux.c:2771: warning: unused parameter 'flags' ... lots more like it ... mc_main.c:3726: warning: unused parameter 'part' mc_main.c:3726: warning: unused parameter 'tid' mc_main.c:3765: warning: unused parameter 'part' mc_main.c:3778: warning: unused parameter 'f' mc_main.c:3787: warning: unused parameter 'part' ----------------------------------------------------------------------------- Vex ones I didn't look at ----------------------------------------------------------------------------- priv/ir/iropt.c:2174: warning: unused parameter 'ix1' priv/host-arm/hdefs.c:567: warning: unused parameter 'cond' priv/host-arm/hdefs.c:646: warning: unused parameter 'm' priv/host-arm/hdefs.c:673: warning: unused parameter 'i' priv/host-arm/hdefs.c:673: warning: unused parameter 'src' priv/host-arm/hdefs.c:673: warning: unused parameter 'dst' priv/host-x86/isel.c:3918: warning: unused parameter 'vbi' priv/host-amd64/isel.c:3887: warning: unused parameter 'vbi' priv/host-arm/isel.c:295: warning: unused parameter 'env' priv/host-arm/isel.c:296: warning: unused parameter 'passBBP' priv/host-arm/isel.c:297: warning: unused parameter 'guard' priv/host-arm/isel.c:297: warning: unused parameter 'cee' priv/host-arm/isel.c:297: warning: unused parameter 'args' priv/host-arm/isel.c:687: warning: unused parameter 'env' priv/host-arm/isel.c:687: warning: unused parameter 'e' priv/host-arm/isel.c:714: warning: unused parameter 'env' priv/host-arm/isel.c:714: warning: unused parameter 'e' priv/host-arm/isel.c:733: warning: unused parameter 'env' priv/host-arm/isel.c:733: warning: unused parameter 'e' priv/host-ppc/isel.c:534: warning: unused parameter 'env' priv/guest-generic/bb_to_IR.c:60: warning: unused parameter 'callback_opaque' priv/guest-generic/bb_to_IR.c:60: warning: unused parameter 'a' priv/guest-amd64/ghelpers.c:2070: warning: unused parameter 'portno' priv/guest-amd64/ghelpers.c:2070: warning: unused parameter 'sz' priv/guest-amd64/ghelpers.c:2101: warning: unused parameter 'portno' priv/guest-amd64/ghelpers.c:2101: warning: unused parameter 'data' priv/guest-amd64/ghelpers.c:2101: warning: unused parameter 'sz' priv/guest-arm/ghelpers.c:305: warning: unused parameter 'function_name' priv/guest-arm/ghelpers.c:306: warning: unused parameter 'args' priv/guest-arm/ghelpers.c:392: warning: unused parameter 'minoff' priv/guest-arm/ghelpers.c:393: warning: unused parameter 'maxoff' priv/guest-ppc/ghelpers.c:104: warning: unused parameter 'r269' priv/guest-ppc/ghelpers.c:181: warning: unused parameter 'function_name' priv/guest-ppc/ghelpers.c:182: warning: unused parameter 'args' priv/guest-ppc/ghelpers.c:187: warning: unused parameter 'function_name' priv/guest-ppc/ghelpers.c:188: warning: unused parameter 'args' priv/guest-x86/toIR.c:14458: warning: unused parameter 'abiinfo' priv/guest-amd64/toIR.c:2396: warning: unused parameter 'pfx' priv/guest-arm/toIR.c:178: warning: unused parameter 'byte_accessible' priv/guest-arm/toIR.c:1903: warning: unused parameter 'resteerOK' priv/guest-arm/toIR.c:1904: warning: unused parameter 'resteerOkFn' priv/guest-arm/toIR.c:1907: warning: unused parameter 'whereNext' priv/guest-ppc/toIR.c:3765: warning: unused parameter 'vbi' ----------------------------------------------------------------------------- necessary because higher-order or callback or macro or replacement-func ----------------------------------------------------------------------------- m_errormgr.c:403: warning: unused parameter 'n' m_errormgr.c:1182: warning: unused parameter 'supplocV' m_mallocfree.c:1702: warning: unused parameter 'tid' m_signals.c:1945: warning: unused parameter 'uc' m_translate.c:232: warning: unused parameter 'closureV' m_translate.c:235: warning: unused parameter 'vge' m_translate.c:236: warning: unused parameter 'gWordTy' m_translate.c:237: warning: unused parameter 'hWordTy' m_translate.c:1104: warning: unused parameter 'closureV' m_translate.c:1171: warning: unused parameter 'guest_addr' m_transtab.c:792: warning: unused parameter 'ptr' m_transtab.c:792: warning: unused parameter 'nbytes' m_syswrap/syswrap-main.c:683: warning: unused parameter 'layout' m_syswrap/syswrap-main.c:686: warning: unused parameter 'flags' m_syswrap/syswrap-linux.c:382: warning: unused parameter 'status' m_syswrap/syswrap-linux.c:663: warning: unused parameter 'arrghs' (... many more like that ...) m_syswrap/syswrap-generic.c:780: warning: unused parameter 'read' m_syswrap/syswrap-generic.c:804: warning: unused parameter 'fieldName' m_replacemalloc/vg_replace_malloc.c:473: warning: unused parameter 'cmd' m_replacemalloc/vg_replace_malloc.c:473: warning: unused parameter 'value' m_replacemalloc/vg_replace_malloc.c:509: warning: unused parameter 'pad' m_errormgr.c:403: warning: unused parameter 'n' m_errormgr.c:1182: warning: unused parameter 'supplocV' valgrind-listener.c:225: warning: unused parameter 'signo' mc_malloc_wrappers.c:486: warning: unused parameter 'tid' mc_main.c:3700: warning: unused parameter 'rr' mc_main.c:3700: warning: unused parameter 'ww' mc_main.c:3700: warning: unused parameter 'xx' mc_main.c:3700: warning: unused parameter 'di_handle' mc_main.c:3719: warning: unused parameter 'rr' mc_main.c:3719: warning: unused parameter 'ww' mc_main.c:3719: warning: unused parameter 'xx' mc_main.c:3720: warning: unused parameter 'di_handle' mc_main.c:5551: warning: unused parameter 'exitcode' mc_translate.c:3426: warning: unused parameter 'closure' mc_translate.c:3429: warning: unused parameter 'vge' mc_errors.c:845: warning: unused parameter 'res' cg_sim.c:191: warning: unused parameter 'm1' cg_main.c:908: warning: unused parameter 'layout' cg_main.c:1456: warning: unused parameter 'exitcode' cg_main.c:1623: warning: unused parameter 'orig_addr64' ms_main.c:1673: warning: unused parameter 'tid' ms_main.c:1678: warning: unused parameter 'tid' ms_main.c:1688: warning: unused parameter 'tid' ms_main.c:1733: warning: unused parameter 'a' ms_main.c:1738: warning: unused parameter 'a' ms_main.c:1743: warning: unused parameter 'a' ms_main.c:1743: warning: unused parameter 'tid' ms_main.c:1748: warning: unused parameter 'a' ms_main.c:1852: warning: unused parameter 'closure' ms_main.c:1854: warning: unused parameter 'layout' ms_main.c:1855: warning: unused parameter 'vge' ms_main.c:1856: warning: unused parameter 'gWordTy' ms_main.c:1856: warning: unused parameter 'hWordTy' ms_main.c:2129: warning: unused parameter 'exit_status' lk_main.c:603: warning: unused parameter 'closure' lk_main.c:605: warning: unused parameter 'layout' nl_main.c:39: warning: unused parameter 'closure' nl_main.c:41: warning: unused parameter 'layout' nl_main.c:42: warning: unused parameter 'vge' nl_main.c:43: warning: unused parameter 'gWordTy' nl_main.c:43: warning: unused parameter 'hWordTy' nl_main.c:48: warning: unused parameter 'exitcode' hg_errors.c:492: warning: unused parameter 'not_used' hg_errors.c:781: warning: unused parameter 'fd' hg_errors.c:781: warning: unused parameter 'buf' hg_errors.c:781: warning: unused parameter 'nBuf' hg_errors.c:782: warning: unused parameter 'su' hg_errors.c:805: warning: unused parameter 'err' hg_main.c:1465: warning: unused parameter 'tid' hg_main.c:1475: warning: unused parameter 'di_handle' hg_main.c:1674: warning: unused parameter 'part' hg_main.c:1686: warning: unused parameter 'part' hg_main.c:1700: warning: unused parameter 'part' hg_main.c:3364: warning: unused parameter 'tid' hg_main.c:3478: warning: unused parameter 'tid' hg_main.c:3621: warning: unused parameter 'closure' hg_main.c:3623: warning: unused parameter 'layout' hg_main.c:3624: warning: unused parameter 'vge' hg_main.c:4091: warning: unused parameter 'exitcode' hg_intercepts.c:1488: warning: unused parameter 'mutex' hg_intercepts.c:1488: warning: unused parameter 'recmode' hg_intercepts.c:1496: warning: unused parameter 'mutex' pc_common.c:217: warning: unused parameter 'res' h_main.c:1002: warning: unused parameter 'tid' h_main.c:1045: warning: unused parameter 'rr' h_main.c:1045: warning: unused parameter 'ww' h_main.c:1045: warning: unused parameter 'xx' h_main.c:1045: warning: unused parameter 'di_handle' h_main.c:1077: warning: unused parameter 'rr' h_main.c:1077: warning: unused parameter 'ww' h_main.c:1077: warning: unused parameter 'xx' h_main.c:1077: warning: unused parameter 'di_handle' h_main.c:1152: warning: unused parameter 'a' h_main.c:1152: warning: unused parameter 'len' h_main.c:2130: warning: unused parameter 'tid' h_main.c:2130: warning: unused parameter 'sysno' ----------------------------------------------------------------------------- necessary, used only on some platforms ----------------------------------------------------------------------------- m_machine.c:61: warning: unused parameter 'tid' m_machine.c:86: warning: unused parameter 's1err' m_machine.c:86: warning: unused parameter 's2err' m_redir.c:990: warning: unused parameter 'sym_addr' m_stacktrace.c:60: warning: unused parameter 'tid_if_known' m_stacktrace.c:63: warning: unused parameter 'lr' m_syscall.c:460: warning: unused parameter 'a7' m_syscall.c:460: warning: unused parameter 'a8' m_debuginfo/readelf.c:209: warning: unused parameter 'opd_img' m_debuginfo/readelf.c:210: warning: unused parameter 'opd_bias' h_main.c:4639: warning: unused parameter 'closure' h_main.c:4642: warning: unused parameter 'vge' h_main.c:4778: warning: unused parameter 'exitcode' sg_main.c:1057: warning: unused parameter 'a' sg_main.c:1057: warning: unused parameter 'len' sg_main.c:1058: warning: unused parameter 'rr' sg_main.c:1058: warning: unused parameter 'ww' sg_main.c:1058: warning: unused parameter 'xx' sg_main.c:1063: warning: unused parameter 'a' sg_main.c:1063: warning: unused parameter 'len' sg_main.c:1064: warning: unused parameter 'rr' sg_main.c:1064: warning: unused parameter 'ww' sg_main.c:1064: warning: unused parameter 'xx' sg_main.c:2136: warning: unused parameter 'gWordTy' sg_main.c:2417: warning: unused parameter 'exitcode' main.c:392: warning: unused parameter 'bbOut' main.c:395: warning: unused parameter 'hWordTy' main.c:497: warning: unused parameter 'layout' main.c:498: warning: unused parameter 'vge' main.c:762: warning: unused parameter 't' main.c:806: warning: unused parameter 'tid' main.c:870: warning: unused parameter 'syscallno' main.c:884: warning: unused parameter 'res' main.c:1016: warning: unused parameter 'exitcode' dump.c:1141: warning: unused parameter 'ti' dump.c:1169: warning: unused parameter 'ti' |