mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
[CPP-340] Create three QL queries: (1) mismatched argument types,
(2) too few arguments and (3) too many arguments.
Create new 'UnderspecifiedFunction' folders for both queries and tests.
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
| test.c:7:3:7:16 | call to declared_empty | This call has arguments, but $@ is not declared with any parameters. | test.c:1:6:1:19 | declared_empty | declared_empty |
|
||||
| test.c:12:3:12:12 | call to undeclared | This call has arguments, but $@ is not declared with any parameters. | test.c:11:3:11:3 | undeclared | undeclared |
|
||||
| test.c:14:3:14:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:14:3:14:3 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:14:3:14:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:25:6:25:22 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:17:3:17:29 | call to declared_empty_defined_with | This call has arguments, but $@ is not declared with any parameters. | test.c:27:6:27:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
| test.c:22:3:22:29 | call to declared_empty_defined_with | This call has arguments, but $@ is not declared with any parameters. | test.c:27:6:27:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
@@ -1 +0,0 @@
|
||||
Likely Bugs/Likely Typos/FutileParams.ql
|
||||
@@ -0,0 +1,4 @@
|
||||
| test.c:23:3:23:29 | call to declared_empty_defined_with | Calling $@: $@ is incompatible with $@. | test.c:31:6:31:32 | declared_empty_defined_with | declared_empty_defined_with | test.c:23:31:23:32 | & ... | & ... | test.c:31:38:31:38 | x | int x |
|
||||
| test.c:24:3:24:29 | call to declared_empty_defined_with | Calling $@: $@ is incompatible with $@. | test.c:31:6:31:32 | declared_empty_defined_with | declared_empty_defined_with | test.c:24:31:24:34 | 3.0 | 3.0 | test.c:31:38:31:38 | x | int x |
|
||||
| test.c:26:3:26:27 | call to not_declared_defined_with | Calling $@: $@ is incompatible with $@. | test.c:34:6:34:30 | not_declared_defined_with | not_declared_defined_with | test.c:26:29:26:31 | 1.0 | 1.0 | test.c:34:36:34:36 | x | int x |
|
||||
| test.c:26:3:26:27 | call to not_declared_defined_with | Calling $@: $@ is incompatible with $@. | test.c:34:6:34:30 | not_declared_defined_with | not_declared_defined_with | test.c:26:37:26:38 | 2 | 2 | test.c:34:50:34:50 | z | int z |
|
||||
@@ -0,0 +1 @@
|
||||
Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql
|
||||
@@ -0,0 +1,3 @@
|
||||
| test.c:17:3:17:19 | call to not_yet_declared2 | This call has fewer arguments than required by $@. | test.c:16:3:16:3 | not_yet_declared2 | not_yet_declared2 |
|
||||
| test.c:17:3:17:19 | call to not_yet_declared2 | This call has fewer arguments than required by $@. | test.c:30:6:30:22 | not_yet_declared2 | not_yet_declared2 |
|
||||
| test.c:19:3:19:29 | call to declared_empty_defined_with | This call has fewer arguments than required by $@. | test.c:31:6:31:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
@@ -0,0 +1 @@
|
||||
Likely Bugs/Underspecified Functions/TooFewArguments.ql
|
||||
@@ -0,0 +1,5 @@
|
||||
| test.c:8:3:8:16 | call to declared_empty | This call has more arguments than required by $@. | test.c:1:6:1:19 | declared_empty | declared_empty |
|
||||
| test.c:13:3:13:12 | call to undeclared | This call has more arguments than required by $@. | test.c:12:3:12:3 | undeclared | undeclared |
|
||||
| test.c:15:3:15:19 | call to not_yet_declared1 | This call has more arguments than required by $@. | test.c:15:3:15:3 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:15:3:15:19 | call to not_yet_declared1 | This call has more arguments than required by $@. | test.c:29:6:29:22 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:24:3:24:29 | call to declared_empty_defined_with | This call has more arguments than required by $@. | test.c:31:6:31:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
@@ -0,0 +1 @@
|
||||
Likely Bugs/Underspecified Functions/TooManyArguments.ql
|
||||
@@ -1,6 +1,7 @@
|
||||
void declared_empty();
|
||||
void declared_void(void);
|
||||
void declared_with(int);
|
||||
void declared_empty_defined_with();
|
||||
|
||||
void test() {
|
||||
declared_empty(); // GOOD
|
||||
@@ -13,13 +14,16 @@ void test() {
|
||||
|
||||
not_yet_declared1(1); // BAD
|
||||
not_yet_declared2(1); // GOOD
|
||||
not_yet_declared2(); // BAD
|
||||
|
||||
declared_empty_defined_with(); // BAD
|
||||
declared_empty_defined_with(1); // GOOD
|
||||
|
||||
int x;
|
||||
declared_empty_defined_with(&x); // GOOD
|
||||
declared_empty_defined_with(x, x); // BAD
|
||||
declared_empty_defined_with(&x); // GOOD (type mismatch)
|
||||
declared_empty_defined_with(3.0f, &x); // BAD (type mismatch)
|
||||
|
||||
not_declared_defined_with(1.0, 0, 2U); // GOOD (type mismatch)
|
||||
}
|
||||
|
||||
void not_yet_declared1();
|
||||
@@ -27,3 +31,6 @@ void not_yet_declared2(int);
|
||||
void declared_empty_defined_with(int x) {
|
||||
// do nothing
|
||||
}
|
||||
void not_declared_defined_with(int x, int y, int z) {
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user