]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coverity: mostly deadcode warnings that depend on platform macros
authorPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 4 Dec 2023 08:16:37 +0000 (09:16 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 4 Dec 2023 08:16:37 +0000 (09:16 +0100)
So just turn them off

coregrind/m_gdbserver/signals.c
coregrind/m_syswrap/syswrap-freebsd.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/m_transtab.c
memcheck/mc_main.c
mpi/libmpiwrap.c

index fc4cdf21787d418b12c7682e88340c8e6c4f8ce8..5119c0d34a928ac8c54dcd93a3746e943e486b1d 100644 (file)
@@ -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)
index 3663733926fb7c3d7bcb4d390925436dee13e36c..c2435f6adb1eb3c27ac932db1224422122deea3b 100644 (file)
@@ -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");
index 8550ef942c875d20564f2eb01981651b0377fa65..4bb21ca73b7ac701942104d1506f694a94b51a02 100644 (file)
@@ -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 */ );
    }
index b4b44b7a37f99dc76c57e66187cd94f8a6e531a9..cb6c5ad52ed0c87f9ec19be2160e1d57b2fff07b 100644 (file)
@@ -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;
index be237eeb422039a3cd04a02ab52aa4b4736fb33d..ea5637e561889d56ef3a219c960188298bd774a6 100644 (file)
@@ -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<<OC_MOVE_FORWARDS_EVERY_BITS)-1)))) {
index 24221f810866d5503a133fdf50cd201982fa40cc..2fa1cb8fe0b0daf469376747b59d3c7d4bf3b4fa 100644 (file)
@@ -291,6 +291,8 @@ static void showTy ( FILE* f, MPI_Datatype ty )
 #  endif
    else if (ty == MPI_LONG_LONG_INT)  fprintf(f,"LONG_LONG_INT");
 #  if defined(MPI_LONG_LONG)
+   // platform dependant? MPI_LONG_LONG and MPI_UNSIGNED_LONG_LONG can be the same
+   // coverity[DEADCODE:FALSE]
    else if (ty == MPI_LONG_LONG)      fprintf(f,"LONG_LONG");
 #  endif
 #  if defined(MPI_UNSIGNED_LONG_LONG)