Skip to content

Commit 9789cf4

Browse files
committed
A0-4-3:
alert only when the last `-std` compilation flag is not `c++14`
1 parent 751ef04 commit 9789cf4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cpp/autosar/src/rules/A0-4-3/CompilerImplementationShallComplyWithCPP14Standard.ql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ from File f, string flag
2020
where
2121
not isExcluded(f, ToolchainPackage::compilerImplementationShallComplyWithCPP14StandardQuery()) and
2222
exists(Compilation c | f = c.getAFileCompiled() |
23-
c.getAnArgument() = flag and flag.regexpMatch("-std=(?!c\\+\\+14)[\\w+]+")
24-
)
23+
flag =
24+
max(string std, int index |
25+
c.getArgument(index) = std and std.matches("-std=%")
26+
|
27+
std order by index
28+
)
29+
) and
30+
flag != "-std=c++14"
2531
select f,
2632
"File '" + f.getBaseName() + "' compiled with flag '" + flag +
2733
"' which does not strictly comply with ISO C++14."

0 commit comments

Comments
 (0)