From f07f569b3268e3283413ebab5780e88e81e1706d Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 27 Jun 2025 11:20:00 +0200 Subject: [PATCH] Update MISRA queries and tests after merging location tables --- c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected | 1 - c/misra/test/rules/RULE-2-4/test.c | 6 +++--- cpp/common/src/codingstandards/cpp/Loops.qll | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected b/c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected index abd602e9c8..4028c67366 100644 --- a/c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected +++ b/c/misra/test/rules/RULE-2-4/UnusedTagDeclaration.expected @@ -3,5 +3,4 @@ | test.c:17:6:17:7 | E1 | struct E1 has an unused tag. | | test.c:31:10:31:11 | S7 | struct S7 has an unused tag. | | test.c:50:8:50:10 | S10 | struct S10 has an unused tag. | -| test.c:66:3:66:14 | S13 | struct S13 has an unused tag. | | test.c:79:8:79:10 | s14 | struct s14 has an unused tag. | diff --git a/c/misra/test/rules/RULE-2-4/test.c b/c/misra/test/rules/RULE-2-4/test.c index 64d05a1cc2..30cce2d224 100644 --- a/c/misra/test/rules/RULE-2-4/test.c +++ b/c/misra/test/rules/RULE-2-4/test.c @@ -63,9 +63,9 @@ struct S12 { // COMPLIANT }; void testMacroNameUsed() { - STRUCT_MACRO // COMPLIANT[FALSE_POSITIVE] - although the struct generated by - // the macro is never used in this expansion, it may be used in - // other expansions, so we don't want to report it as unused + STRUCT_MACRO // COMPLIANT - although the struct generated by the macro is + // never used in this expansion, it may be used in other + // expansions, so we don't want to report it as unused } void testMacroNameNotUsed() { diff --git a/cpp/common/src/codingstandards/cpp/Loops.qll b/cpp/common/src/codingstandards/cpp/Loops.qll index aa3dc64ea5..6aa08532cb 100644 --- a/cpp/common/src/codingstandards/cpp/Loops.qll +++ b/cpp/common/src/codingstandards/cpp/Loops.qll @@ -339,7 +339,8 @@ predicate isInvalidLoop(ForStmt forLoop, string reason, Locatable reasonLocation isForLoopWithMulipleCounters(forLoop) and reason = "it uses multiple loop counters$@" and reasonLabel = "" and - reasonLocation.getLocation() instanceof UnknownExprLocation + reasonLocation instanceof File and + reasonLocation.getLocation() instanceof UnknownLocation or isForLoopWithFloatingPointCounters(forLoop, reasonLocation) and reason = "it uses a loop counter '$@' of type floating-point" and