gprofng: fix cppcheck warnings
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Thu, 29 Sep 2022 20:30:42 +0000 (13:30 -0700)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Fri, 30 Sep 2022 05:00:02 +0000 (22:00 -0700)
gprofng/ChangeLog
2022-09-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

* common/hwcdrv.c: Fix cppcheck warning.
* src/ABS.h: Likewise.
* src/CompCom.cc: Likewise.

gprofng/common/hwcdrv.c
gprofng/src/ABS.h
gprofng/src/CompCom.cc

index 05390e239df00b38e189f6e1c432ea614352019e..03c3a71c8e248dc9f3e12517c2e27f85e6fdd1a3 100644 (file)
@@ -696,7 +696,7 @@ init_perf_event (struct perf_event_attr *hw, uint64_t event, uint64_t period)
 #endif
 
   hw->sample_period = period;
-  hw->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_READ |
+  hw->sample_type = PERF_SAMPLE_IP |
          // PERF_SAMPLE_TID            |
          // PERF_SAMPLE_TIME           | // possibly interesting
          // PERF_SAMPLE_ADDR           |
index a5bcbea16b649f93082db095a5faa0035bd7064f..c4552d81e5bccba7f543d682eccce762c1a39221 100644 (file)
@@ -53,7 +53,7 @@ extern char *ABS_PP_CODES[NUM_ABS_PP_CODES];
 /* dbe should check HWC values for errors */
 #define HWCVAL_ERR_FLAG         (1ULL<<63)
 #define HWCVAL_SET_ERR(ctr)     ((ctr) | HWCVAL_ERR_FLAG)
-#define HWCVAL_HAS_ERR(ctr)     ((ctr) & HWCVAL_ERR_FLAG ? 1 : 0)
+#define HWCVAL_HAS_ERR(ctr)     (((ctr) & HWCVAL_ERR_FLAG) != 0)
 #define HWCVAL_CLR_ERR(ctr)     ((ctr) & ~HWCVAL_ERR_FLAG)
 
 #define ABS_GET_RT_CODE(EA)     ((EA) & 0x0FLL)
index 3a035a9e7f7f66d355ec47fd86dbd4d443892801..14d6fc39a60e2996f15faa13ef97c4078349ac2d 100644 (file)
@@ -305,7 +305,7 @@ CompComment::compcom_format (int index, compmsg *msg, int &visible)
       for (int i = 0; i < plist_idx - 1; i++)
        {
          prim_ty = ccm_param_primtype (msg->msg_type, i + 1);
-         if (prim_ty == CCM_PRIMTYPE_STRING || prim_ty == CCM_PRIMTYPE_STRING)
+         if (prim_ty == CCM_PRIMTYPE_STRING)
            free (parms[i]);
        }
     }