| 1 |
// RUN: clang-tidy -checks=-*,modernize-redundant-void-arg %s -- -Wno-strict-prototypes -x c | count 0 |
| 2 |
|
| 3 |
#define NULL 0 |
| 4 |
|
| 5 |
extern int i; |
| 6 |
|
| 7 |
int foo2() { |
| 8 |
return 0; |
| 9 |
} |
| 10 |
|
| 11 |
int j = 1; |
| 12 |
|
| 13 |
int foo(void) { |
| 14 |
return 0; |
| 15 |
} |
| 16 |
|
| 17 |
typedef unsigned int my_uint; |
| 18 |
|
| 19 |
typedef void my_void; |
| 20 |
|
| 21 |
// A function taking void and returning a pointer to function taking void |
| 22 |
// and returning int. |
| 23 |
int (*returns_fn_void_int(void))(void); |
| 24 |
|
| 25 |
typedef int (*returns_fn_void_int_t(void))(void); |
| 26 |
|
| 27 |
int (*returns_fn_void_int(void))(void) { |
| 28 |
return NULL; |
| 29 |
} |
| 30 |
|
| 31 |
// A function taking void and returning a pointer to a function taking void |
| 32 |
// and returning a pointer to a function taking void and returning void. |
| 33 |
void (*(*returns_fn_returns_fn_void_void(void))(void))(void); |
| 34 |
|
| 35 |
typedef void (*(*returns_fn_returns_fn_void_void_t(void))(void))(void); |
| 36 |
|
| 37 |
void (*(*returns_fn_returns_fn_void_void(void))(void))(void) { |
| 38 |
return NULL; |
| 39 |
} |
| 40 |
|
| 41 |
void bar(void) { |
| 42 |
int i; |
| 43 |
int *pi = NULL; |
| 44 |
void *pv = (void *) pi; |
| 45 |
float f; |
| 46 |
float *fi; |
| 47 |
double d; |
| 48 |
double *pd; |
| 49 |
} |
| 50 |
|
| 51 |
void (*f1)(void); |
| 52 |
void (*f2)(void) = NULL; |
| 53 |
void (*f3)(void) = bar; |
| 54 |
void (*fa)(); |
| 55 |
void (*fb)() = NULL; |
| 56 |
void (*fc)() = bar; |
| 57 |
|
| 58 |
typedef void (function_ptr)(void); |