diff --git a/c/misra/src/rules/RULE-20-12/MacroParameterUsedAsHashOperand.ql b/c/misra/src/rules/RULE-20-12/MacroParameterUsedAsHashOperand.ql index 779c14176c..6a66afb74b 100644 --- a/c/misra/src/rules/RULE-20-12/MacroParameterUsedAsHashOperand.ql +++ b/c/misra/src/rules/RULE-20-12/MacroParameterUsedAsHashOperand.ql @@ -19,7 +19,7 @@ import codingstandards.cpp.Macro from FunctionLikeMacro m, MacroInvocation mi, int i, string expanded, string param where - not isExcluded(m, Preprocessor2Package::macroParameterUsedAsHashOperandQuery()) and + not isExcluded(mi, Preprocessor2Package::macroParameterUsedAsHashOperandQuery()) and mi = m.getAnInvocation() and param = m.getParameter(i) and ( @@ -31,9 +31,6 @@ where // This check ensure there is an expansion that is used. expanded = mi.getExpandedArgument(i) and not expanded = "" and - exists(Macro furtherExpandedMacro | - mi.getUnexpandedArgument(i).matches(furtherExpandedMacro.getName() + "%") - ) + not mi.getUnexpandedArgument(i) = mi.getExpandedArgument(i) select m, - "Macro " + m.getName() + " contains use of parameter " + m.getParameter(i) + - " used in multiple contexts." + "Macro " + m.getName() + " contains use of parameter " + param + " used in multiple contexts." diff --git a/change_notes/2023-03-07-20-12-perf.md b/change_notes/2023-03-07-20-12-perf.md new file mode 100644 index 0000000000..b42c81ebce --- /dev/null +++ b/change_notes/2023-03-07-20-12-perf.md @@ -0,0 +1 @@ + * `Rule 20.12` - the performance of this rule has been improved. \ No newline at end of file