Skip to content

Commit 3eca5d6

Browse files
committed
EssentialTypes: Ensure compatibility with C++
This query looks for use of memcmp, but previously it would not have worked if the user was using C++ and specified std::memcmp. Although this rule is targeted at C, it is one that a user might enable for C++ and expect to work.
1 parent 326d7d3 commit 3eca5d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c/misra/src/rules/RULE-21-16/MemcmpOnInappropriateEssentialTypeArgs.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import codingstandards.c.misra.EssentialTypes
2020
from FunctionCall memcmp, Expr arg, Type argBaseType
2121
where
2222
not isExcluded(arg, EssentialTypesPackage::memcmpOnInappropriateEssentialTypeArgsQuery()) and
23-
memcmp.getTarget().hasGlobalName("memcmp") and
23+
memcmp.getTarget().hasGlobalOrStdName("memcmp") and
2424
// Pointer arguments
2525
arg = memcmp.getArgument([0, 1]) and
2626
exists(DerivedType pt |

0 commit comments

Comments
 (0)