comparison clang/test/Sema/attr-loader-uninitialized.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
3 int good __attribute__((loader_uninitialized)); 3 int good __attribute__((loader_uninitialized));
4 static int local_ok __attribute__((loader_uninitialized)); 4 static int local_ok __attribute__((loader_uninitialized));
5 int hidden_ok __attribute__((visibility("hidden"))) __attribute__((loader_uninitialized)); 5 int hidden_ok __attribute__((visibility("hidden"))) __attribute__((loader_uninitialized));
6 6
7 const int still_cant_be_const __attribute__((loader_uninitialized)); 7 const int still_cant_be_const __attribute__((loader_uninitialized));
8 // expected-error@-1 {{default initialization of an object of const type}}
9 extern int external_rejected __attribute__((loader_uninitialized)); 8 extern int external_rejected __attribute__((loader_uninitialized));
10 // expected-error@-1 {{variable 'external_rejected' cannot be declared both 'extern' and with the 'loader_uninitialized' attribute}} 9 // expected-error@-1 {{variable 'external_rejected' cannot be declared both 'extern' and with the 'loader_uninitialized' attribute}}
10
11 struct S;
12 extern S incomplete_external_rejected __attribute__((loader_uninitialized));
13 // expected-error@-1 {{variable 'incomplete_external_rejected' cannot be declared both 'extern' and with the 'loader_uninitialized' attribute}}
11 14
12 int noargs __attribute__((loader_uninitialized(0))); 15 int noargs __attribute__((loader_uninitialized(0)));
13 // expected-error@-1 {{'loader_uninitialized' attribute takes no arguments}} 16 // expected-error@-1 {{'loader_uninitialized' attribute takes no arguments}}
14 17
15 int init_rejected __attribute__((loader_uninitialized)) = 42; 18 int init_rejected __attribute__((loader_uninitialized)) = 42;
56 nontrivial() {} 59 nontrivial() {}
57 }; 60 };
58 61
59 nontrivial needs_trivial_ctor __attribute__((loader_uninitialized)); 62 nontrivial needs_trivial_ctor __attribute__((loader_uninitialized));
60 // expected-error@-1 {{variable with 'loader_uninitialized' attribute must have a trivial default constructor}} 63 // expected-error@-1 {{variable with 'loader_uninitialized' attribute must have a trivial default constructor}}
64
65 struct Incomplete;
66 Incomplete incomplete __attribute__((loader_uninitialized));
67 // expected-error@-1 {{variable has incomplete type 'Incomplete'}}
68 // expected-note@-3 {{forward declaration of 'Incomplete'}}
69
70 struct Incomplete s_incomplete __attribute__((loader_uninitialized));
71 // expected-error@-1 {{variable has incomplete type 'struct Incomplete'}}
72 // expected-note@-7 {{forward declaration of 'Incomplete'}}