mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: test that __declspec(guard(...)) doesn't cause extractor errors
This commit is contained in:
8
cpp/ql/test/library-tests/declspec/guard/test.cpp
Normal file
8
cpp/ql/test/library-tests/declspec/guard/test.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// semmle-extractor-options: --edg --microsoft
|
||||
|
||||
void f(__declspec(guard(overflow)) size_t length) {
|
||||
}
|
||||
|
||||
__declspec(guard(ignore))
|
||||
void g(void) {
|
||||
}
|
||||
2
cpp/ql/test/library-tests/declspec/guard/test.expected
Normal file
2
cpp/ql/test/library-tests/declspec/guard/test.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| test.cpp:3:6:3:6 | f | 0 | length |
|
||||
| test.cpp:7:6:7:6 | g | -1 | <none> |
|
||||
10
cpp/ql/test/library-tests/declspec/guard/test.ql
Normal file
10
cpp/ql/test/library-tests/declspec/guard/test.ql
Normal file
@@ -0,0 +1,10 @@
|
||||
import cpp
|
||||
|
||||
// What we select here isn't too important; we're just testing the
|
||||
// __declspec(guard(...)) attributes don't cause extractor errors.
|
||||
|
||||
from Function f, string p, int n
|
||||
where if f.getNumberOfParameters() = 0
|
||||
then (p = "<none>" and n = -1)
|
||||
else p = f.getParameter(n).toString()
|
||||
select f, n, p
|
||||
Reference in New Issue
Block a user