xref: /minix3/external/bsd/llvm/dist/clang/test/FixIt/fixit-errors.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2f4a2713aSLionel Sambuc // RUN: cp %s %t
3f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -pedantic -fixit -x c %t
4*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -pedantic -Werror -Wno-invalid-noreturn -x c %t
5f4a2713aSLionel Sambuc 
6f4a2713aSLionel Sambuc /* This is a test of the various code modification hints that are
7f4a2713aSLionel Sambuc    provided as part of warning or extension diagnostics. All of the
8f4a2713aSLionel Sambuc    warnings will be fixed by -fixit, and the resulting file should
9f4a2713aSLionel Sambuc    compile cleanly with -Werror -pedantic. */
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc struct s; // expected-note{{previous use is here}}
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc union s *s1; // expected-error{{use of 's' with tag type that does not match previous declaration}}
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc struct Point {
16f4a2713aSLionel Sambuc   float x, y, z;
17f4a2713aSLionel Sambuc };
18f4a2713aSLionel Sambuc 
19f4a2713aSLionel Sambuc struct Point *get_origin();
20f4a2713aSLionel Sambuc 
test_point()21f4a2713aSLionel Sambuc void test_point() {
22f4a2713aSLionel Sambuc   (void)get_origin->x; // expected-error {{base of member reference is a function; perhaps you meant to call it with no arguments?}}
23f4a2713aSLionel Sambuc }
24*0a6a1f1dSLionel Sambuc 
25*0a6a1f1dSLionel Sambuc void noreturn_1() _Noreturn; // expected-error {{must precede function declarator}}
noreturn_1()26*0a6a1f1dSLionel Sambuc void noreturn_1() {
27*0a6a1f1dSLionel Sambuc   return; // expected-warning {{should not return}}
28*0a6a1f1dSLionel Sambuc }
noreturn_2()29*0a6a1f1dSLionel Sambuc void noreturn_2() _Noreturn { // expected-error {{must precede function declarator}}
30*0a6a1f1dSLionel Sambuc   return; // expected-warning {{should not return}}
31*0a6a1f1dSLionel Sambuc }
32