Skip to content

Commit 4e59398

Browse files
authored
Merge pull request #1724 from goblint/tests-fun-ptr-void
Explicitly specify no-argument function pointers in tests
2 parents d37c35b + aba2601 commit 4e59398

27 files changed

+56
-56
lines changed

tests/incremental/11-restart/11-paper-example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
55

6-
int (*fp)() = NULL;
6+
int (*fp)(void) = NULL;
77

88
int bad() {
99
return -1;

tests/regression/00-sanity/15-unused_arg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ void f() {
44
glob++; // NOWARN!
55
}
66

7-
void (*fptr) = f;
7+
void (*fptr)(void) = f;
88

9-
int g(void (*ptr)()) {
9+
int g(void (*ptr)(void)) {
1010
return 0;
1111
}
1212

tests/regression/00-sanity/38-evalfunvar-dead.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <stdlib.h>
22

33
int main() {
4-
int (*fp)() = &rand;
4+
int (*fp)(void) = &rand;
55
abort();
66
fp(); // NOWARN (No suitable function to call)
77
return 0;

tests/regression/01-cpa/06-pointers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int fun_5b() { return 5; }
88
int main () {
99
int i,j,k1,k2,k3;
1010
int *p, **pp;
11-
int (*fp)(); //pointer to function
11+
int (*fp)(void); //pointer to function
1212

1313
// reading through pointer
1414
i = 5;

tests/regression/01-cpa/09-arrays.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ int main () {
1818

1919
int a[] = {2,2,2};
2020
int b[2], c[3];
21-
int (*f[2])() = {fun_5, fun_6};
22-
int (*g[2])() = {fun_5, fun_5b};
23-
int (*fp)();
21+
int (*f[2])(void) = {fun_5, fun_6};
22+
int (*g[2])(void) = {fun_5, fun_5b};
23+
int (*fp)(void);
2424
int *ip;
2525
int (*iap)[];
2626

tests/regression/01-cpa/46-funptr_path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void fun2() {
1616
int main() {
1717
int x = __VERIFIER_nondet_int();
1818

19-
void (*fp)();
19+
void (*fp)(void);
2020

2121
if (x) {
2222
pthread_mutex_lock(&mutex);

tests/regression/02-base/46-spawn-global-funptrs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ void bar() {
99
__goblint_check(1); // assert reachable
1010
}
1111

12-
void (*funs[2])() = {
12+
void (*funs[2])(void) = {
1313
&foo,
1414
&bar
1515
};
1616

1717
extern void magic1();
18-
extern void magic2(void (*funs[])());
18+
extern void magic2(void (*funs[])(void));
1919

2020
int main() {
2121
magic1(); // invalidate funs a bit

tests/regression/03-practical/06-callback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void callme(void) {
99
x = 5;
1010
}
1111

12-
void callfun(void (*fun)()) {
12+
void callfun(void (*fun)(void)) {
1313
fun();
1414
return;
1515
}

tests/regression/04-mutex/19-call_by_ptr_rc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern int __VERIFIER_nondet_int();
22

33
#include<pthread.h>
44

5-
void foo(int (*callback)()) {
5+
void foo(int (*callback)(void)) {
66
for (int i = 0; i < 10; i++) {
77
if (__VERIFIER_nondet_int())
88
callback();

tests/regression/04-mutex/21-sound_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int global;
66
void bad() { global++; } // RACE!
77
void good() { printf("Hello!"); }
88

9-
void (*f)() = good;
9+
void (*f)(void) = good;
1010

1111
void *t_fun(void *arg) {
1212
f(); // RACE!

0 commit comments

Comments
 (0)