rspec/rules/S961/cfamily/rule.adoc

24 lines
970 B
Plaintext
Raw Normal View History

== Why is this an issue?
2023-07-11 13:33:40 +02:00
Before compilation, the preprocessor replaces macros with the code they expand to. The resulting code may be invalid when a function-like macro is invoked without all its arguments, which can cause the program to fail to compile or to behave unexpectedly at runtime.
== Resources
2021-04-28 16:49:39 +02:00
2023-07-11 13:33:40 +02:00
* CPP reference - https://en.cppreference.com/w/cpp/preprocessor/replace[Replacing text macros]
* CPP reference - https://en.cppreference.com/w/cpp/language/translation_phases#Phase_3[Phases of translation: Phase 3]
2021-04-28 16:49:39 +02:00
* MISRA C:2004, 19.8 - A function-like macro shall not be invoked without all of its arguments.
2023-07-11 13:33:40 +02:00
* https://cwe.mitre.org/data/definitions/628[CWE] - CWE-628: Function Call with Incorrectly Specified Arguments
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
The invocation of macro "xxx" requires "yyy" arguments, but only "xxx" were provided.
endif::env-github,rspecator-view[]