xref: /aosp_15_r20/external/clang/test/Sema/attr-tls_model.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -verify -fsyntax-only %s
2*67e74705SXin Li 
3*67e74705SXin Li #if !__has_attribute(tls_model)
4*67e74705SXin Li #error "Should support tls_model attribute"
5*67e74705SXin Li #endif
6*67e74705SXin Li 
7*67e74705SXin Li int f() __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}}
8*67e74705SXin Li 
9*67e74705SXin Li int x __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}}
10*67e74705SXin Li static __thread int y __attribute((tls_model("global-dynamic"))); // no-warning
11*67e74705SXin Li 
12*67e74705SXin Li static __thread int y __attribute((tls_model("local", "dynamic"))); // expected-error {{'tls_model' attribute takes one argument}}
13*67e74705SXin Li static __thread int y __attribute((tls_model(123))); // expected-error {{'tls_model' attribute requires a string}}
14*67e74705SXin Li static __thread int y __attribute((tls_model("foobar"))); // expected-error {{tls_model must be "global-dynamic", "local-dynamic", "initial-exec" or "local-exec"}}
15