[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / attr-uninitialized.c
blobb934ace6992421c30c3ed557e6d1b71543526613
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
3 void good(void) {
4 int dont_initialize_me __attribute((uninitialized));
7 void bad(void) {
8 int im_bad __attribute((uninitialized("zero"))); // expected-error {{'uninitialized' attribute takes no arguments}}
9 static int im_baaad __attribute((uninitialized)); // expected-warning {{'uninitialized' attribute only applies to local variables}}
12 extern int come_on __attribute((uninitialized)); // expected-warning {{'uninitialized' attribute only applies to local variables}}
13 int you_know __attribute((uninitialized)); // expected-warning {{'uninitialized' attribute only applies to local variables}}
14 static int and_the_whole_world_has_to __attribute((uninitialized)); // expected-warning {{'uninitialized' attribute only applies to local variables}}
16 void answer_right_now(void) __attribute((uninitialized)) {} // expected-warning {{'uninitialized' attribute only applies to local variables}}
17 void just_to_tell_you_once_again(__attribute((uninitialized)) int whos_bad) {} // expected-warning {{'uninitialized' attribute only applies to local variables}}
19 struct TheWordIsOut {
20 __attribute((uninitialized)) int youre_doin_wrong; // expected-warning {{'uninitialized' attribute only applies to local variables}}
21 } __attribute((uninitialized)); // expected-warning {{'uninitialized' attribute only applies to local variables}}