| 1 |
/* PR c/83656 - missing -Wbuiltin-declaration-mismatch on declaration |
| 2 |
without prototype |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-std=gnu17 -Wall -Wextra" } */ |
| 5 |
|
| 6 |
typedef __SIZE_TYPE__ size_t; |
| 7 |
|
| 8 |
/* Verify that ordinary library built-ins are not diagnosed with -Wextra |
| 9 |
when they take no arguments (except in cases of return type mismatches). |
| 10 |
This is in anticipation that C may some day adopt the same syntax as |
| 11 |
C++ for declaring functions that take no arguments. */ |
| 12 |
|
| 13 |
void abort (); |
| 14 |
|
| 15 |
/* Verify that ordinary library built-ins are diagnosed with -Wextra |
| 16 |
when they take arguments. */ |
| 17 |
|
| 18 |
void* memcpy (); /* { dg-warning "declaration of built-in function .memcpy. without a prototype; expected .void \\\*\\\(void \\\*, const void \\\*, \(long \)*unsigned int\\\)." } */ |
| 19 |
void* memset (); /* { dg-warning "declaration of built-in function .memset. without a prototype; expected .void \\\*\\\(void \\\*, int, *\(long \)*unsigned int\\\)." } */ |
| 20 |
size_t strlen (); /* { dg-warning "declaration of built-in function .strlen. without a prototype; expected .\(long \)*unsigned int\\\(const char \\\*\\\)." } */ |
| 21 |
|
| 22 |
/* Variadic built-ins are diagnosed even without -Wextra (they are, |
| 23 |
in fact, diagnosed by default). */ |
| 24 |
int printf (); /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" } */ |
| 25 |
int sprintf (); /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" } */ |