• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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();
5 
f(int x)6 int f(int x) { return x; } // expected-warning{{no previous prototype for function 'f'}}
7 
g(int x)8 static int g(int x) { return x; }
9 
h(int x)10 int h(int x) { return x; } // expected-warning{{no previous prototype for function 'h'}}
11 
12 static int g2();
13 
g2(int x)14 int g2(int x) { return x; }
15 
16 void test(void);
17 
18 int h3();
19 int h4(int);
20 int h4();
21 
test(void)22 void test(void) {
23   int h2(int x);
24   int h3(int x);
25   int h4();
26 }
27 
h2(int x)28 int h2(int x) { return x; } // expected-warning{{no previous prototype for function 'h2'}}
h3(int x)29 int h3(int x) { return x; } // expected-warning{{no previous prototype for function 'h3'}}
h4(int x)30 int h4(int x) { return x; }
31 
32 int f2(int);
33 int f2();
34 
f2(int x)35 int f2(int x) { return x; }
36 
37 // rdar://6759522
main(void)38 int main(void) { return 0; }
39 
40 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}}
not_a_prototype_test()41 void not_a_prototype_test() { } // expected-warning{{no previous prototype for function 'not_a_prototype_test'}}
42 
43 // CHECK: fix-it:"{{.*}}":{40:27-40:27}:"void"
44