| 1 |
/* Test for multiple declarations and composite types, with built-in |
| 2 |
functions. */ |
| 3 |
/* Origin: Joseph Myers <[email protected]> */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-std=c89 -Wformat -g" } */ |
| 6 |
|
| 7 |
void |
| 8 |
f (void) |
| 9 |
{ |
| 10 |
int printf; |
| 11 |
int strcmp; |
| 12 |
{ |
| 13 |
int printf (const char *, ...); |
| 14 |
int strcmp (); |
| 15 |
/* Should get format warnings even though the built-in declaration |
| 16 |
isn't "visible". */ |
| 17 |
printf ( |
| 18 |
"%s", 1); /* { dg-warning "15:format" } */ |
| 19 |
/* The type of strcmp here should have no prototype. */ |
| 20 |
if (0) |
| 21 |
strcmp (1); |
| 22 |
/* Likewise, implicitly declared memcmp. */ |
| 23 |
if (0) |
| 24 |
memcmp (1); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
/* Should still diagnose incompatible prototype for strcmp. */ |
| 29 |
int strcmp (void); /* { dg-error "conflict" } */ |
| 30 |
|
| 31 |
/* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" } |
| 32 |
{ dg-prune-output "\\\[-Wint-conversion]" } */ |