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