Skip to content

Commit 1d202dd

Browse files
authored
Merge pull request #24 from nickrolfe/declspec_guard
C++: test for __declspec(guard(...))
2 parents 24567c5 + f44f8d5 commit 1d202dd

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// semmle-extractor-options: --edg --microsoft
2+
3+
void f(__declspec(guard(overflow)) size_t length) {
4+
}
5+
6+
__declspec(guard(ignore))
7+
void g(void) {
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:3:6:3:6 | f | 0 | length |
2+
| test.cpp:7:6:7:6 | g | -1 | <none> |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import cpp
2+
3+
// What we select here isn't too important; we're just testing the
4+
// __declspec(guard(...)) attributes don't cause extractor errors.
5+
6+
from Function f, string p, int n
7+
where if f.getNumberOfParameters() = 0
8+
then (p = "<none>" and n = -1)
9+
else p = f.getParameter(n).toString()
10+
select f, n, p

0 commit comments

Comments
 (0)