GeneralPurpose-SemicolonAtEndOfMacroΒΆ
Macro replacement must not end with semicolon
Required inputs: IR
Bad code (use in a sub-expression):
#define NEXT(x) ++(x);
int x = 0;
while (1) {
if (NEXT(x) >= 10) { // ERROR: expands to `if ((x)++; >= 10)`
break;
}
}
Bad code (use as control flow branch):
#define NEXT(x) ++(x);
int x = 0;
while (1) {
if (x < 10)
NEXT(x); // ERROR: expands to `(x)++;;`, terminating the if-statement
else
break;
}
Good code:
#define NEXT(x) (++(x))
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
semicolon_at_end_of_macro |
Macro replacement must not end with semicolon. |
None |
False |
Options
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.