mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: Add formatAttribute test.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
|
||||
typedef void *va_list;
|
||||
|
||||
int myPrintf(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||
int mySprintf(char *buffer, const char *format, ...) __attribute__((format(__printf__, 2, 3)));
|
||||
int myVprintf(const char *format, va_list arg) __attribute__((format(printf, 1, 0)));
|
||||
@@ -0,0 +1,2 @@
|
||||
| AttributeFormattingFunction.cpp:4:5:4:12 | myPrintf | 0 | char | wchar_t | wchar_t |
|
||||
| AttributeFormattingFunction.cpp:5:5:5:13 | mySprintf | 1 | char | wchar_t | wchar_t |
|
||||
@@ -0,0 +1,10 @@
|
||||
import cpp
|
||||
|
||||
from AttributeFormattingFunction f
|
||||
select
|
||||
f,
|
||||
f.getFormatParameterIndex(),
|
||||
concat(f.getDefaultCharType().toString(), ", "),
|
||||
concat(f.getWideCharType().toString(), ", "),
|
||||
concat(f.getNonDefaultCharType().toString(), ", ")
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
| AttributeFormattingFunction.cpp:4:54:4:59 | format | printf | 0 | 1 |
|
||||
| AttributeFormattingFunction.cpp:5:69:5:74 | format | __printf__ | 1 | 2 |
|
||||
| AttributeFormattingFunction.cpp:6:63:6:68 | format | printf | 0 | |
|
||||
@@ -0,0 +1,8 @@
|
||||
import cpp
|
||||
|
||||
from FormatAttribute fa
|
||||
select
|
||||
fa,
|
||||
fa.getArchetype(),
|
||||
concat(fa.getFormatIndex().toString(), ", "),
|
||||
concat(fa.getFirstFormatArgIndex().toString(), ", ")
|
||||
Reference in New Issue
Block a user