Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

Any function declared in a header may be additionally implemented as a function-like macro defined defined in the header, so if a library function is declared explicitly when its header is included, one of the techniques shown below later in the next subclause can be used to ensure the declaration is not affected by such a macro. Any macro definition definition of a function can be suppressed locally by enclosing the name of the function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function name. For the same syntactic reason, it is permitted to take the address of a library function even if it is also defined defined as a macro. 220) The use of #undef to remove any macro .185definition will also ensure that an actual function is referred to.

220185)This means that an implementation shall is required to provide an actual function for each library function, even if it also provides a macro for that function.

 

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MSC38-C

Low

Unlikely

Medium

P2

L3

Automated Detection

You use standard library macros such as assert and errno as objects
ToolVersionCheckerDescription
Astrée
Include Page
Astrée_V
Astrée_V

Supported, but no explicit checker
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

BADMACRO.STDARG_H

Use of <stdarg.h> Feature

Cppcheck Premium

Include Page
Cppcheck Premium_V
Cppcheck Premium_V

premium-cert-msc38-cFully implemented
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C3437, C3475

C++3127, C++5039


Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V
MISRA2004-19_8 Partially implemented

Polyspace Bug Finder

R2018aPredefined macro used as objectCERT_C-MSC38-a
 A function-like macro shall not be invoked without all of its arguments

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rule MSC38-CChecks for predefined macro used as an object (rule fully covered)
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V

Supported, but no explicit checker

Related Vulnerabilities

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

...

Bibliography

ISO/IEC 9899:201120247.1.4, "Use of Library Functions"

...