| 1 |
extern void fn_a (void); |
| 2 |
extern void fn_b (int); /* { dg-message "declared here" } */ |
| 3 |
extern void fn_c (int, int); /* { dg-message "declared here" } */ |
| 4 |
extern void fn_f (const char *, ...); /* { dg-message "declared here" } */ |
| 5 |
|
| 6 |
void test_known_fn (void) |
| 7 |
{ |
| 8 |
fn_a (); |
| 9 |
fn_b (); /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected 1, have 0" } */ |
| 10 |
fn_c (42);/* { dg-error "too few arguments to function '\[^\n\r\]*'; expected 2, have 1" } */ |
| 11 |
fn_f (); /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected at least 1, have 0" } */ |
| 12 |
} |
| 13 |
|
| 14 |
struct foo |
| 15 |
{ |
| 16 |
void (*callback_a) (void); |
| 17 |
void (*callback_b) (int); /* { dg-message "declared here" } */ |
| 18 |
void (*callback_c) (int, int); /* { dg-message "declared here" } */ |
| 19 |
}; |
| 20 |
|
| 21 |
void test_callback (struct foo *f) |
| 22 |
{ |
| 23 |
f->callback_a (); |
| 24 |
|
| 25 |
f->callback_b (); /* { dg-error "too few arguments to function 'f->callback_b'; expected 1, have 0" } */ |
| 26 |
|
| 27 |
f->callback_c (42); /* { dg-error "too few arguments to function 'f->callback_c'; expected 2, have 1" } */ |
| 28 |
} |