[metadata]
id = "PRE32-C"
type = "rule"
category = "PRE"
number = 32
title = "Do not use preprocessor directives in invocations of function-like macros"
description = """
The arguments to a macro must not include preprocessor directives, such
as#define,#ifdef, and#include. Doing so results inundefined behavior, according
to the C Standard, 6.10.5, paragraph 11 [ISO/IEC 9899:2024]: See alsoundefined
behavior 92. This rule also applies to the use of preprocessor directives in
arguments to any function where it is unknown whether or not the function is
implemented using a macro. This includes all standard library functions, such
asmemcpy(),printf(), andassert(), because any standard library function may be
implemented as a macro. (C24, 7.1.4, paragraph 1).
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 05, 2025"
[rules.cert_c.PRE32-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/PRE32-C.+Do+not+use+preprocessor+directives+in+invocations+of+function-like+macros"