minix/external/bsd/llvm/dist/clang/test/Sema/attr-tls_model.c
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

14 lines
917 B
C

// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -verify -fsyntax-only %s
#if !__has_attribute(tls_model)
#error "Should support tls_model attribute"
#endif
int f() __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}}
int x __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}}
static __thread int y __attribute((tls_model("global-dynamic"))); // no-warning
static __thread int y __attribute((tls_model("local", "dynamic"))); // expected-error {{'tls_model' attribute takes one argument}}
static __thread int y __attribute((tls_model(123))); // expected-error {{'tls_model' attribute requires a string}}
static __thread int y __attribute((tls_model("foobar"))); // expected-error {{tls_model must be "global-dynamic", "local-dynamic", "initial-exec" or "local-exec"}}