Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This compliant solution follows the guidance of PRE00-C. Prefer inline or static functions to function-like macros by defining an inline function iabs() to replace the ABS() macro. Unlike the ABS() macro, which operates on operands of any type, the iabs() function will truncate arguments of types wider than int whose value is not in range of the latter type.

...

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V

expanded-side-effect-multiplied
expanded-side-effect-not-evaluated
side-effect-not-expanded

Partially checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-PRE31Fully implemented
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

LANG.PREPROC.FUNCMACRO
LANG.STRUCT.SE.DEC
LANG.STRUCT.SE.INC

Function-Like Macro
Side Effects in Expression with Decrement
Side Effects in Expression with Increment

Coverity

Include Page
Coverity_V
Coverity_V

ASSERT_SIDE_EFFECTS

Partially implemented

Can detect the specific instance where assertion contains an operation/function call that may have a side effect

ECLAIR
Include Page
ECLAIR_V
ECLAIR_V
CC2.EXP31
CC2.PRE31
Fully implemented
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C3462, C3463, C3464,C3465,C3466,C3467

C++3225, C++3226, C++3227, C++3228, C++3229 

Fully implemented
Klocwork

Include Page
Klocwork_V
Klocwork_V

PORTING.VAR.EFFECTSFully implemented
LDRA tool suite
Include Page
LDRA_V
LDRA_V

9 S, 562 S, 572 S, 35 D, 1 Q

Fully implemented

Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V

CERT_C-PRE31-b
CERT_C-PRE31-c
CERT_C-PRE31-d

Assertions should not contain assignments, increment, or decrement operators
Assertions should not contain function calls nor function-like macro calls
Avoid side effects in arguments to unsafe macros

PC-lint Plus

Include Page
PC-lint Plus_V
PC-lint Plus_V

666, 2666

Fully supported

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rule PRE31-C

Checks for side effect in arguments to unsafe macro (rule partially covered)


RuleChecker
Include Page
RuleChecker_V
RuleChecker_V

expanded-side-effect-multiplied
expanded-side-effect-not-evaluated
side-effect-not-expanded

Partially checked

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

Key here (explains table format and definitions)

...