Daniel Dunbar | 5466c7b | 2009-04-14 02:25:56 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -verify -fsyntax-only %s |
| 2 | |
| 3 | static int g0; // expected-note{{previous definition}} |
| 4 | int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}} |
| 5 | |
| 6 | static int g1; |
| 7 | extern int g1; |
| 8 | |
| 9 | static int g2; |
| 10 | __private_extern__ int g2; |
| 11 | |
| 12 | int g3; // expected-note{{previous definition}} |
| 13 | static int g3; // expected-error{{static declaration of 'g3' follows non-static declaration}} |
| 14 | |
| 15 | extern int g4; // expected-note{{previous definition}} |
| 16 | static int g4; // expected-error{{static declaration of 'g4' follows non-static declaration}} |
| 17 | |
| 18 | __private_extern__ int g5; // expected-note{{previous definition}} |
| 19 | static int g5; // expected-error{{static declaration of 'g5' follows non-static declaration}} |
| 20 | |
| 21 | void f0() { |
| 22 | // FIXME: Diagnose this? |
| 23 | int g6; |
| 24 | extern int g6; |
| 25 | } |
| 26 | |
| 27 | void f1() { |
| 28 | // FIXME: Diagnose this? |
| 29 | int g7; |
| 30 | __private_extern__ int g7; |
| 31 | } |
| 32 | |
| 33 | void f2() { |
| 34 | extern int g8; // expected-note{{previous definition}} |
| 35 | // FIXME: Improve this diagnostic. |
| 36 | int g8; // expected-error{{redefinition of 'g8'}} |
| 37 | } |
| 38 | |
| 39 | void f3() { |
| 40 | __private_extern__ int g9; // expected-note{{previous definition}} |
| 41 | // FIXME: Improve this diagnostic. |
| 42 | int g9; // expected-error{{redefinition of 'g9'}} |
| 43 | } |
| 44 | |
| 45 | void f4() { |
| 46 | extern int g10; |
| 47 | extern int g10; |
| 48 | } |
| 49 | |
| 50 | void f5() { |
| 51 | __private_extern__ int g11; |
| 52 | __private_extern__ int g11; |
| 53 | } |
| 54 | |
| 55 | void f6() { |
| 56 | // FIXME: Diagnose |
| 57 | extern int g12; |
| 58 | __private_extern__ int g12; |
| 59 | } |
| 60 | |
| 61 | void f7() { |
| 62 | // FIXME: Diagnose |
| 63 | __private_extern__ int g13; |
| 64 | extern int g13; |
| 65 | } |
| 66 | |
| 67 | struct s0; |
| 68 | void f8() { |
| 69 | extern struct s0 g14; |
| 70 | __private_extern__ struct s0 g14; |
| 71 | } |
| 72 | struct s0 { int x; }; |
| 73 | |
| 74 | void f9() { |
| 75 | extern int g15 = 0; // expected-error{{'extern' variable cannot have an initializer}} |
| 76 | // FIXME: linkage specifier in warning. |
| 77 | __private_extern__ int g16 = 0; // expected-error{{'extern' variable cannot have an initializer}} |
| 78 | } |
| 79 | |
| 80 | extern int g17; |
| 81 | int g17 = 0; |
| 82 | |
| 83 | extern int g18 = 0; // expected-warning{{'extern' variable has an initializer}} |
| 84 | |
| 85 | __private_extern__ int g19; |
| 86 | int g19 = 0; |
| 87 | |
Steve Naroff | ee3899e | 2009-04-15 15:20:03 +0000 | [diff] [blame] | 88 | __private_extern__ int g20 = 0; |