Debian Codegraph @

clang/test/Sema/prototype-redecls.c

raw
1 // RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
2
3 void blapp(int); // expected-note {{previous}}
4 void blapp() { } // expected-error {{conflicting types for 'blapp'}}
5
6 void yarp(int, ...); // expected-note {{previous}}
7 void yarp(); // expected-error {{conflicting types for 'yarp'}}
8
9 void blarg(int, ...); // expected-note {{previous}}
10 void blarg() {} // expected-error {{conflicting types for 'blarg'}}
11
12 void blerp(short); // expected-note {{previous}}
13 void blerp(x) int x; {} // expected-error {{conflicting types for 'blerp'}}
14
15 void foo(int); // expected-note {{previous}}
16 void foo();
17 void foo() {} // expected-error {{conflicting types for 'foo'}}
18
19 void glerp(int);
20 void glerp(x) short x; {} // Okay, promoted type is fine
21
22 // All these cases are okay
23 void derp(int);
24 void derp(x) int x; {}
25
26 void garp(int);
27 void garp();
28 void garp(x) int x; {}
29
30 // Ensure redeclarations that conflict with a builtin use a note which makes it
31 // clear that the previous declaration was a builtin.
32 float rintf() { // expected-warning {{incompatible redeclaration of library function 'rintf'}} \
33 expected-note {{'rintf' is a builtin with type 'float (float)'}}
34 return 1.0f;
35 }