From: Paul Floyd Date: Mon, 4 Dec 2023 08:16:37 +0000 (+0100) Subject: coverity: mostly deadcode warnings that depend on platform macros X-Git-Tag: VALGRIND_3_23_0~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60c8821f6e3c42ab7259123835248f99f5a2729e;p=thirdparty%2Fvalgrind.git coverity: mostly deadcode warnings that depend on platform macros So just turn them off --- diff --git a/coregrind/m_gdbserver/signals.c b/coregrind/m_gdbserver/signals.c index fc4cdf2178..5119c0d34a 100644 --- a/coregrind/m_gdbserver/signals.c +++ b/coregrind/m_gdbserver/signals.c @@ -483,6 +483,10 @@ enum target_signal target_signal_from_host (int hostsig) return (enum target_signal) (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33); else if (hostsig == 32) + // depending on the platform the first two and the third + // if branches here may be mutually exclusive, ignore any + // coverity warnings + // coverity[DEADCODE:FALSE] return TARGET_SIGNAL_REALTIME_32; else if (64 <= hostsig && hostsig <= 127) return (enum target_signal) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 3663733926..c2435f6adb 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -2673,6 +2673,7 @@ POST(sys_aio_read) if (!VG_(OSetWord_Contains)(iocb_table, (UWord)iocb)) { VG_(OSetWord_Insert)(iocb_table, (UWord)iocb); } else { + // @todo PJF this warns without callstack VG_(dmsg)("Warning: Duplicate control block %p in aio_read\n", (void *)(Addr)ARG1); VG_(dmsg)("Warning: Ensure 'aio_return' is called when 'aio_read' has completed\n"); @@ -6972,6 +6973,7 @@ POST(sys_aio_readv) if (!VG_(OSetWord_Contains)(iocbv_table, (UWord)iocbv)) { VG_(OSetWord_Insert)(iocbv_table, (UWord)iocbv); } else { + // @todo PJF this warns without callstack VG_(dmsg)("Warning: Duplicate control block %p in aio_readv\n", (void *)(Addr)ARG1); VG_(dmsg)("Warning: Ensure 'aio_return' is called when 'aio_readv' has completed\n"); diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 8550ef942c..4bb21ca73b 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -1658,7 +1658,7 @@ ML_(generic_POST_sys_recv) ( ThreadId tid, UWord res, UWord arg0, UWord arg1, UWord arg2 ) { - if (res >= 0 && arg1 != 0) { + if (arg1 != 0) { POST_MEM_WRITE( arg1, /* buf */ arg2 /* len */ ); } diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index b4b44b7a37..cb6c5ad52e 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -2061,7 +2061,7 @@ static void delete_tte ( /*OUT*/Addr* ga_deleted, adding a reference from tte to its hash position in tt. */ HTTno j; HTTno k = HASH_TT(tteC->entry); - vg_assert(k >= 0 && k < N_HTTES_PER_SECTOR); + vg_assert(k < N_HTTES_PER_SECTOR); for (j = 0; j < N_HTTES_PER_SECTOR; j++) { if (sec->htt[k] == tteno) break; diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index be237eeb42..ea5637e561 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -2709,10 +2709,16 @@ static OCacheLine* find_OCacheLine_SLOW ( Addr a ) /* we already tried line == 0; skip therefore. */ for (line = 1; line < OC_LINES_PER_SET; line++) { if (ocacheL1->set[setno].line[line].tag == tag) { - if (line == 1) { + switch (line) { + // with OC_LINES_PER_SET equal to 2 this is the only possible case + case 1: stats_ocacheL1_found_at_1++; - } else { + break; +#if OC_LINES_PER_SET > 2 + default: stats_ocacheL1_found_at_N++; + break; +#endif } if (UNLIKELY(0 == (ocacheL1_event_ctr++ & ((1<