Skip to content

Commit 9271829

Browse files
Fix selection of std lib result by excluding unwrapped elements
1 parent 40ed471 commit 9271829

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cpp/misra/src/rules/RULE-4-1-1/CompilerLanguageExtensionsUsed.ql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import codingstandards.cpp.misra
2020
import codingstandards.cpp.Extensions
2121
import codingstandards.cpp.AlertReporting
2222

23-
from CPPCompilerExtension e
24-
where not isExcluded(e, Toolchain2Package::compilerLanguageExtensionsUsedQuery())
25-
select MacroUnwrapper<CPPCompilerExtension>::unwrapElement(e), e.getMessage()
23+
from Element unwrapped, CPPCompilerExtension e
24+
where
25+
not isExcluded([e, unwrapped], Toolchain2Package::compilerLanguageExtensionsUsedQuery()) and
26+
unwrapped = MacroUnwrapper<CPPCompilerExtension>::unwrapElement(e)
27+
select unwrapped, e.getMessage()

cpp/misra/test/rules/RULE-4-1-1/CompilerLanguageExtensionsUsed.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
| file:///Users/michaelrfairhurst/projects/codeql-coding-standards/cpp/common/test/includes/standard-library/stdarg.h:5:1:5:47 | #define va_start(v,l) __builtin_va_start(v, l) | Use of built-in operation '__builtin_va_start' is a compiler extension. |
21
| test.cpp:11:3:11:19 | maybe_unused | Use of attribute 'maybe_unused' in namespace 'gnu' is a compiler extension and is not portable to other compilers. |
32
| test.cpp:12:16:12:22 | aligned | Use of attribute 'aligned' is a compiler extension and is not portable to other compilers. |
43
| test.cpp:13:16:13:21 | unused | Use of attribute 'unused' is a compiler extension and is not portable to other compilers. |

0 commit comments

Comments
 (0)