...
However, the C Standard enumerates specific exceptions in which the behavior of accessing an object or function expanded to be a standard library macro definition is undefined. The macros are assert, errno, math_errhandling, setjmp, va_arg, va_copy, va_end, and va_start. These cases are described by undefined behaviors 110 138, 114 139, 122 140, 124 141, and 138 143. Programmers must not suppress these macros to access the underlying object or function.
...
Accessing objects or functions underlying the specific macros enumerated in this rule is undefined behavior.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
MSC38-C | Low | Unlikely | Yes | NoMedium | P2 | L3 |
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| Supported, but no explicit checker | |||||||
| CodeSonar |
| BADMACRO.STDARG_H | Use of <stdarg.h> Feature | ||||||
| Cppcheck Premium |
| premium-cert-msc38-cFully implemented | |||||||
| Helix QAC |
| C3437, C3475 C++3127, C++5039 | |||||||
| Parasoft C/C++test |
| CERT_C-MSC38-a | A function-like macro shall not be invoked without all of its arguments | ||||||
| CERT C: Rule MSC38-C | Checks for predefined macro used as an object (rule fully covered) | |||||||
| RuleChecker |
| Supported, but no explicit checker |
...