Dmitri Gribenko | 445743d | 2013-01-21 11:25:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Rafael Espindola | 96e7813 | 2013-07-04 16:16:58 +0000 | [diff] [blame] | 2 | // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s |
| 3 | // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s |
Dmitri Gribenko | 445743d | 2013-01-21 11:25:03 +0000 | [diff] [blame] | 4 | |
| 5 | // expected-note@+1 2{{previous definition is here}} |
| 6 | int main() { |
| 7 | return 0; |
| 8 | } |
| 9 | |
| 10 | // expected-error@+2 {{static declaration of 'main' follows non-static declaration}} |
| 11 | // expected-warning@+1 {{'main' should not be declared static}} |
| 12 | static int main() { |
| 13 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:"" |
| 14 | return 0; |
| 15 | } |
| 16 | |
David Majnemer | bcd0650 | 2013-07-07 23:49:50 +0000 | [diff] [blame] | 17 | // expected-error@+2 {{redefinition of 'main'}} |
| 18 | // expected-error@+1 {{'main' is not allowed to be declared inline}} |
Dmitri Gribenko | 445743d | 2013-01-21 11:25:03 +0000 | [diff] [blame] | 19 | inline int main() { |
| 20 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:"" |
| 21 | return 0; |
| 22 | } |
| 23 | |
David Majnemer | bcd0650 | 2013-07-07 23:49:50 +0000 | [diff] [blame] | 24 | // expected-warning@+5 {{function 'main' declared 'noreturn' should not return}} |
Dmitri Gribenko | 445743d | 2013-01-21 11:25:03 +0000 | [diff] [blame] | 25 | // expected-warning@+2 {{'main' is not allowed to be declared _Noreturn}} |
| 26 | // expected-note@+1 {{remove '_Noreturn'}} |
| 27 | _Noreturn int main() { |
| 28 | // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:11}:"" |
| 29 | return 0; |
| 30 | } |
| 31 | |