mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Merge pull request #790 from rdmarsh2/rdmarsh/cpp/futile-params
Approved by semmledocs-ac
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| test.c:8:3:8: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: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 |
|
||||
@@ -0,0 +1 @@
|
||||
Likely Bugs/Likely Typos/FutileParams.ql
|
||||
@@ -0,0 +1,29 @@
|
||||
void declared_empty();
|
||||
void declared_void(void);
|
||||
void declared_with(int);
|
||||
void declared_empty_defined_with();
|
||||
|
||||
void test() {
|
||||
declared_empty(); // GOOD
|
||||
declared_empty(1); // BAD
|
||||
declared_void(); // GOOD
|
||||
declared_with(1); // GOOD
|
||||
|
||||
undeclared(1); // GOOD
|
||||
|
||||
not_yet_declared1(1); // BAD
|
||||
not_yet_declared2(1); // GOOD
|
||||
|
||||
declared_empty_defined_with(); // BAD [NOT DETECTED]
|
||||
declared_empty_defined_with(1); // GOOD
|
||||
|
||||
int x;
|
||||
declared_empty_defined_with(&x); // BAD [NOT DETECTED]
|
||||
declared_empty_defined_with(x, x); // BAD [NOT DETECTED]
|
||||
}
|
||||
|
||||
void not_yet_declared1();
|
||||
void not_yet_declared2(int);
|
||||
void declared_empty_defined_with(int x) {
|
||||
// do nothing
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
void cpp_varargs(...);
|
||||
void bar();
|
||||
|
||||
void test() {
|
||||
cpp_varargs(); // GOOD
|
||||
cpp_varargs(1); // GOOD
|
||||
__builtin_constant_p("something"); // GOOD: builtin
|
||||
}
|
||||
Reference in New Issue
Block a user