aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-2.c
blob: 9d75cd8669cf47b5662ccb60004d35cdc3237d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* PR c/83656 - missing -Wbuiltin-declaration-mismatch on declaration
   without prototype
   { dg-do compile }
   { dg-options "-Wall -Wextra" } */

typedef __SIZE_TYPE__ size_t;

/* Verify that ordinary library built-ins are not diagnosed with -Wextra
   when they take no arguments (except in cases of return type mismatches).
   This is in anticipation that C may some day adopt the same syntax as
   C++ for declaring functions that take no arguments.  */

void abort ();

/* Verify that ordinary library built-ins are diagnosed with -Wextra
   when they take arguments.  */

void* memcpy ();    /* { dg-warning "declaration of built-in function .memcpy. without a prototype; expected .void \\\*\\\(void \\\*, const void \\\*, \(long \)*unsigned int\\\)." } */
void* memset ();    /* { dg-warning "declaration of built-in function .memset. without a prototype; expected .void \\\*\\\(void \\\*, int, *\(long \)*unsigned int\\\)." } */
size_t strlen ();   /* { dg-warning "declaration of built-in function .strlen. without a prototype; expected .\(long \)*unsigned int\\\(const char \\\*\\\)." } */

/* Variadic built-ins are diagnosed even without -Wextra (they are,
   in fact, diagnosed by default).  */
int printf ();      /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" } */
int sprintf ();     /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" } */