Is it possible to suppress a defect found by parasoft with an in-code directives?

1.4k Views Asked by At

I would like to know how to suppress this defect found by parasoft

BD-PB-CC:Condition "result != 0" always evaluates to false
/home/redbend/dev/vdm-10.2/sdk/source/engine/core/src/vdm_core_api.c:82

The problem is with this code:

//Initialize MMI sub-component
result = VDM_MMI_init();
if (result != VDM_ERR_OK)
    goto err;

that calls this function:

VDM_Error VDM_MMI_init(void)
{
    return VDM_ERR_OK;
}

The structure has to be maintained as VDM_MMI_init() may return an error in the future.

I am looking for any kind of macro or comment can be embedded in the code that will tell C++test to ignore this problem

3

There are 3 best solutions below

0
On

You can simply type:

int a = 0; // parasoft-suppress RULE.ID

and violation will be suppressed

2
On

Looking around, you may be able to suppress it with the following:

#pragma parasoft suppress item BD-PB-CC

Then after the warning site:

#pragma parasoft unsuppress item BD-PB-CC

Sources: http://forums.parasoft.com/index.php?showtopic=1566 and http://www-afs.secure-endpoints.com/afs/usatlas.bnl.gov/sun4x_59/app/codewizard-4.3-WS6.0u1/manuals/howsupp_.htm

0
On

I got from parasoft support the following comment notation

/* parasoft-suppress BD_PB_CC  "THIS IS SUPPRESSION COMMENT" */

To be put at the end of violated line (with space following end of your code) Note that rule ID must match violated rule. What’s in quotation marks, is your suppression comment.