145
|
1 /* PR c/86125 - missing -Wbuiltin-declaration-mismatch on a mismatched
|
|
2 return type
|
|
3 Verify that declarations of file I/O built-ins with different
|
|
4 definitions of struct FILE triggers -Wbuiltin-declaration-mismatch
|
|
5 when -Wextra is specified.
|
|
6 { dg-do compile }
|
|
7 { dg-options "-Wall -Wbuiltin-declaration-mismatch" } */
|
|
8
|
|
9 struct FooFile;
|
|
10 int fputc (int, struct FooFile*);
|
|
11
|
|
12 typedef struct FooFile AlsoFooFile;
|
|
13 int fprintf (AlsoFooFile*, const char*, ...);
|
|
14
|
|
15 typedef AlsoFooFile* FooFilePtr;
|
|
16 int fscanf (FooFilePtr, const char*, ...);
|
|
17
|
|
18 /* No warning here (-Wextra not specified). */
|
|
19 struct BarFile;
|
|
20 int vfprintf (struct BarFile*, const char*, __builtin_va_list);
|
|
21
|
|
22
|
|
23 /* Set -Wextra and verify -Wbuiltin-declaration-mismatch is issued. */
|
|
24 #pragma GCC diagnostic warning "-Wextra"
|
|
25
|
|
26 int fputs (const char*, struct BarFile*); /* { dg-warning "mismatch in argument 2 type of built-in function .fputs.; expected .struct FooFile \\\*." } */
|