fixit-errors.c 1.1 KB

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