mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
[CPP-340] For MistypedFunctionArguments.ql, add support for pointers to pointers and pointers to arrays.
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:31:3:31:3 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int * | int * | test.c:66:24:66:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:31:3:31:3 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int[4] | int[4] | test.c:66:24:66:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:66:6:66:22 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int * | int * | test.c:66:24:66:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:66:6:66:22 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int[4] | int[4] | test.c:66:24:66:26 | p#0 | int p#0 |
|
||||
| test.c:39:3:39:29 | call to declared_empty_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:67:6:67:32 | declared_empty_defined_with | declared_empty_defined_with | test.c:39:31:39:32 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:67:38:67:38 | x | int x |
|
||||
| test.c:43:3:43:27 | call to not_declared_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:70:6:70:30 | not_declared_defined_with | not_declared_defined_with | test.c:43:29:43:31 | 4 | 4 | file://:0:0:0:0 | long long | long long | test.c:70:36:70:36 | x | int x |
|
||||
| test.c:43:3:43:27 | call to not_declared_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:70:6:70:30 | not_declared_defined_with | not_declared_defined_with | test.c:43:37:43:42 | 2500000000.0 | 2500000000.0 | file://:0:0:0:0 | float | float | test.c:70:50:70:50 | z | int z |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:5:6:5:27 | declared_with_pointers | declared_with_pointers | test.c:46:26:46:31 | 3500000000000000.0 | 3500000000000000.0 | file://:0:0:0:0 | double | double | test.c:82:34:82:34 | x | int * x |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:5:6:5:27 | declared_with_pointers | declared_with_pointers | test.c:46:34:46:34 | 0 | 0 | file://:0:0:0:0 | int | int | test.c:82:43:82:43 | y | void * y |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:82:6:82:27 | declared_with_pointers | declared_with_pointers | test.c:46:26:46:31 | 3500000000000000.0 | 3500000000000000.0 | file://:0:0:0:0 | double | double | test.c:82:34:82:34 | x | int * x |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:82:6:82:27 | declared_with_pointers | declared_with_pointers | test.c:46:34:46:34 | 0 | 0 | file://:0:0:0:0 | int | int | test.c:82:43:82:43 | y | void * y |
|
||||
| test.c:48:3:48:21 | call to declared_with_array | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:6:6:6:24 | declared_with_array | declared_with_array | test.c:48:23:48:24 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:83:31:83:31 | a | char[6] a |
|
||||
| test.c:48:3:48:21 | call to declared_with_array | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:83:6:83:24 | declared_with_array | declared_with_array | test.c:48:23:48:24 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:83:31:83:31 | a | char[6] a |
|
||||
| test.c:50:3:50:20 | call to defined_with_float | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:85:7:85:24 | defined_with_float | defined_with_float | test.c:50:22:50:24 | 2.0 | 2.0 | file://:0:0:0:0 | float | float | test.c:85:32:85:32 | f | float f |
|
||||
| test.c:51:3:51:20 | call to defined_with_float | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:85:7:85:24 | defined_with_float | defined_with_float | test.c:51:22:51:24 | 2.0 | 2.0 | file://:0:0:0:0 | double | double | test.c:85:32:85:32 | f | float f |
|
||||
| test.c:54:3:54:21 | call to defined_with_double | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:89:8:89:26 | defined_with_double | defined_with_double | test.c:54:23:54:25 | 99 | 99 | file://:0:0:0:0 | int | int | test.c:89:35:89:35 | d | double d |
|
||||
| test.c:56:3:56:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:93:11:93:32 | defined_with_long_long | defined_with_long_long | test.c:56:26:56:28 | 99 | 99 | file://:0:0:0:0 | int | int | test.c:93:44:93:45 | ll | long long ll |
|
||||
| test.c:57:3:57:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:93:11:93:32 | defined_with_long_long | defined_with_long_long | test.c:57:26:57:26 | 3 | 3 | file://:0:0:0:0 | int | int | test.c:93:44:93:45 | ll | long long ll |
|
||||
| test.c:59:3:59:21 | call to defined_with_double | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:89:8:89:26 | defined_with_double | defined_with_double | test.c:59:23:59:25 | 2 | 2 | file://:0:0:0:0 | long long | long long | test.c:89:35:89:35 | d | double d |
|
||||
| test.c:60:3:60:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:93:11:93:32 | defined_with_long_long | defined_with_long_long | test.c:60:26:60:31 | 2.499999999999999983e+50 | 2.499999999999999983e+50 | file://:0:0:0:0 | double | double | test.c:93:44:93:45 | ll | long long ll |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:31:3:31:3 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int * | int * | test.c:72:24:72:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:31:3:31:3 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int[4] | int[4] | test.c:72:24:72:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:72:6:72:22 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int * | int * | test.c:72:24:72:26 | p#0 | int p#0 |
|
||||
| test.c:32:3:32:19 | call to not_yet_declared2 | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:72:6:72:22 | not_yet_declared2 | not_yet_declared2 | test.c:32:21:32:22 | ca | ca | file://:0:0:0:0 | int[4] | int[4] | test.c:72:24:72:26 | p#0 | int p#0 |
|
||||
| test.c:39:3:39:29 | call to declared_empty_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:73:6:73:32 | declared_empty_defined_with | declared_empty_defined_with | test.c:39:31:39:32 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:73:38:73:38 | x | int x |
|
||||
| test.c:43:3:43:27 | call to not_declared_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:76:6:76:30 | not_declared_defined_with | not_declared_defined_with | test.c:43:29:43:31 | 4 | 4 | file://:0:0:0:0 | long long | long long | test.c:76:36:76:36 | x | int x |
|
||||
| test.c:43:3:43:27 | call to not_declared_defined_with | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:76:6:76:30 | not_declared_defined_with | not_declared_defined_with | test.c:43:37:43:42 | 2500000000.0 | 2500000000.0 | file://:0:0:0:0 | float | float | test.c:76:50:76:50 | z | int z |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:5:6:5:27 | declared_with_pointers | declared_with_pointers | test.c:46:26:46:31 | 3500000000000000.0 | 3500000000000000.0 | file://:0:0:0:0 | double | double | test.c:88:34:88:34 | x | int * x |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:5:6:5:27 | declared_with_pointers | declared_with_pointers | test.c:46:34:46:34 | 0 | 0 | file://:0:0:0:0 | int | int | test.c:88:43:88:43 | y | void * y |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:88:6:88:27 | declared_with_pointers | declared_with_pointers | test.c:46:26:46:31 | 3500000000000000.0 | 3500000000000000.0 | file://:0:0:0:0 | double | double | test.c:88:34:88:34 | x | int * x |
|
||||
| test.c:46:3:46:24 | call to declared_with_pointers | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:88:6:88:27 | declared_with_pointers | declared_with_pointers | test.c:46:34:46:34 | 0 | 0 | file://:0:0:0:0 | int | int | test.c:88:43:88:43 | y | void * y |
|
||||
| test.c:48:3:48:21 | call to declared_with_array | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:6:6:6:24 | declared_with_array | declared_with_array | test.c:48:23:48:24 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:89:31:89:31 | a | char[6] a |
|
||||
| test.c:48:3:48:21 | call to declared_with_array | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:89:6:89:24 | declared_with_array | declared_with_array | test.c:48:23:48:24 | & ... | & ... | file://:0:0:0:0 | int * | int * | test.c:89:31:89:31 | a | char[6] a |
|
||||
| test.c:50:3:50:20 | call to defined_with_float | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:91:7:91:24 | defined_with_float | defined_with_float | test.c:50:22:50:24 | 2.0 | 2.0 | file://:0:0:0:0 | float | float | test.c:91:32:91:32 | f | float f |
|
||||
| test.c:51:3:51:20 | call to defined_with_float | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:91:7:91:24 | defined_with_float | defined_with_float | test.c:51:22:51:24 | 2.0 | 2.0 | file://:0:0:0:0 | double | double | test.c:91:32:91:32 | f | float f |
|
||||
| test.c:54:3:54:21 | call to defined_with_double | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:95:8:95:26 | defined_with_double | defined_with_double | test.c:54:23:54:25 | 99 | 99 | file://:0:0:0:0 | int | int | test.c:95:35:95:35 | d | double d |
|
||||
| test.c:56:3:56:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:99:11:99:32 | defined_with_long_long | defined_with_long_long | test.c:56:26:56:28 | 99 | 99 | file://:0:0:0:0 | int | int | test.c:99:44:99:45 | ll | long long ll |
|
||||
| test.c:57:3:57:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:99:11:99:32 | defined_with_long_long | defined_with_long_long | test.c:57:26:57:26 | 3 | 3 | file://:0:0:0:0 | int | int | test.c:99:44:99:45 | ll | long long ll |
|
||||
| test.c:59:3:59:21 | call to defined_with_double | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:95:8:95:26 | defined_with_double | defined_with_double | test.c:59:23:59:25 | 2 | 2 | file://:0:0:0:0 | long long | long long | test.c:95:35:95:35 | d | double d |
|
||||
| test.c:60:3:60:24 | call to defined_with_long_long | Calling $@: argument $@ of type $@ is incompatible with parameter $@. | test.c:99:11:99:32 | defined_with_long_long | defined_with_long_long | test.c:60:26:60:31 | 2.499999999999999983e+50 | 2.499999999999999983e+50 | file://:0:0:0:0 | double | double | test.c:99:44:99:45 | ll | long long ll |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| test.c:33:3:33:19 | call to not_yet_declared2 | This call has fewer arguments than required by $@. | test.c:31:3:31:3 | not_yet_declared2 | not_yet_declared2 |
|
||||
| test.c:33:3:33:19 | call to not_yet_declared2 | This call has fewer arguments than required by $@. | test.c:66:6:66:22 | not_yet_declared2 | not_yet_declared2 |
|
||||
| test.c:35:3:35:29 | call to declared_empty_defined_with | This call has fewer arguments than required by $@. | test.c:67:6:67:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
| test.c:77:10:77:20 | call to dereference | This call has fewer arguments than required by $@. | test.c:80:5:80:15 | dereference | dereference |
|
||||
| test.c:33:3:33:19 | call to not_yet_declared2 | This call has fewer arguments than required by $@. | test.c:72:6:72:22 | not_yet_declared2 | not_yet_declared2 |
|
||||
| test.c:35:3:35:29 | call to declared_empty_defined_with | This call has fewer arguments than required by $@. | test.c:73:6:73:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
| test.c:83:10:83:20 | call to dereference | This call has fewer arguments than required by $@. | test.c:86:5:86:15 | dereference | dereference |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| test.c:23:3:23: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:30:3:30:19 | call to not_yet_declared1 | This call has more arguments than required by $@. | test.c:30:3:30:3 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:30:3:30:19 | call to not_yet_declared1 | This call has more arguments than required by $@. | test.c:65:6:65:22 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:40:3:40:29 | call to declared_empty_defined_with | This call has more arguments than required by $@. | test.c:67:6:67:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
| test.c:30:3:30:19 | call to not_yet_declared1 | This call has more arguments than required by $@. | test.c:71:6:71:22 | not_yet_declared1 | not_yet_declared1 |
|
||||
| test.c:40:3:40:29 | call to declared_empty_defined_with | This call has more arguments than required by $@. | test.c:73:6:73:32 | declared_empty_defined_with | declared_empty_defined_with |
|
||||
|
||||
@@ -18,7 +18,7 @@ int ca[4] = { 1, 2, 3, 4 };
|
||||
|
||||
void *pv;
|
||||
|
||||
void test() {
|
||||
void test(int *argv[]) {
|
||||
declared_empty(); // GOOD
|
||||
declared_empty(1); // BAD
|
||||
declared_void(); // GOOD
|
||||
@@ -60,6 +60,12 @@ void test() {
|
||||
defined_with_long_long(2.5e50); // BAD
|
||||
|
||||
k_and_r_func(2.5, &s); // GOOD
|
||||
|
||||
int (*parameterName)[2];
|
||||
defined_with_ptr_ptr(parameterName); // GOOD
|
||||
defined_with_ptr_ptr(argv); // GOOD
|
||||
defined_with_ptr_arr(parameterName); // GOOD
|
||||
defined_with_ptr_arr(argv); // GOOD
|
||||
}
|
||||
|
||||
void not_yet_declared1();
|
||||
@@ -93,4 +99,11 @@ double defined_with_double(double d) {
|
||||
long long defined_with_long_long(long long ll) {
|
||||
return ll;
|
||||
}
|
||||
|
||||
unsigned int defined_with_ptr_ptr(unsigned int **ptr) {
|
||||
return **ptr;
|
||||
}
|
||||
unsigned int defined_with_ptr_arr(unsigned int *ptr[]) {
|
||||
return **ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user