1 // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wmissing-prototypes -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wmissing-prototypes -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3 
4 int f(); // expected-note{{this declaration is not a prototype; add parameter declarations to make it one}}
5 // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:{{.*}}-[[@LINE-1]]:{{.*}}}:"{{.*}}"
6 
7 int f(int x) { return x; } // expected-warning{{no previous prototype for function 'f'}}
8 
9 static int g(int x) { return x; }
10 
11 int h(int x) { return x; } // expected-warning{{no previous prototype for function 'h'}}
12 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
13 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:1-[[@LINE-2]]:1}:"static "
14 
15 static int g2();
16 
17 int g2(int x) { return x; }
18 
19 extern int g3(int x) { return x; } // expected-warning{{no previous prototype for function 'g3'}}
20 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
21 // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-2]]:{{.*}}-[[@LINE-2]]:{{.*}}}:"{{.*}}"
22 
23 void test(void);
24 
25 int h3(); // expected-note{{this declaration is not a prototype; add parameter declarations to make it one}}
26 // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:{{.*}}-[[@LINE-1]]:{{.*}}}:"{{.*}}"
27 int h4(int);
28 int h4();
29 
30 void test(void) {
31   int h2(int x);
32   int h3(int x);
33   int h4();
34 }
35 
36 int h2(int x) { return x; } // expected-warning{{no previous prototype for function 'h2'}}
37 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
38 int h3(int x) { return x; } // expected-warning{{no previous prototype for function 'h3'}}
39 int h4(int x) { return x; }
40 
41 int f2(int);
42 int f2();
43 
44 int f2(int x) { return x; }
45 
46 // rdar://6759522
47 int main(void) { return 0; }
48 
49 void not_a_prototype_test(); // expected-note{{this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function}}
50 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:27-[[@LINE-1]]:27}:"void"
51 void not_a_prototype_test() { } // expected-warning{{no previous prototype for function 'not_a_prototype_test'}}
52