Home | History | Annotate | Download | only in Sema
      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 
      6 int f(int x) { return x; } // expected-warning{{no previous prototype for function 'f'}}
      7 
      8 static int g(int x) { return x; }
      9 
     10 int h(int x) { return x; } // expected-warning{{no previous prototype for function 'h'}}
     11 
     12 static int g2();
     13 
     14 int g2(int x) { return x; }
     15 
     16 void test(void);
     17 
     18 int h3();
     19 int h4(int);
     20 int h4();
     21 
     22 void test(void) {
     23   int h2(int x);
     24   int h3(int x);
     25   int h4();
     26 }
     27 
     28 int h2(int x) { return x; } // expected-warning{{no previous prototype for function 'h2'}}
     29 int h3(int x) { return x; } // expected-warning{{no previous prototype for function 'h3'}}
     30 int h4(int x) { return x; }
     31 
     32 int f2(int);
     33 int f2();
     34 
     35 int f2(int x) { return x; }
     36 
     37 // rdar://6759522
     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}}
     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