C++: test that __declspec(guard(...)) doesn't cause extractor errors

This commit is contained in:
Nick Rolfe
2018-08-07 09:16:52 +01:00
parent d0497a5cff
commit f44f8d576d
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
// semmle-extractor-options: --edg --microsoft
void f(__declspec(guard(overflow)) size_t length) {
}
__declspec(guard(ignore))
void g(void) {
}

View File

@@ -0,0 +1,2 @@
| test.cpp:3:6:3:6 | f | 0 | length |
| test.cpp:7:6:7:6 | g | -1 | <none> |

View 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