Hans Wennborg | a1c5965 | 2012-06-23 13:16:37 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -verify -fsyntax-only %s |
Hans Wennborg | 5e2d5de | 2012-06-23 11:51:46 +0000 | [diff] [blame] | 2 | |
| 3 | #if !__has_attribute(tls_model) |
| 4 | #error "Should support tls_model attribute" |
| 5 | #endif |
| 6 | |
| 7 | int f() __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}} |
| 8 | |
| 9 | int x __attribute((tls_model("global-dynamic"))); // expected-error {{'tls_model' attribute only applies to thread-local variables}} |
| 10 | static __thread int y __attribute((tls_model("global-dynamic"))); // no-warning |
| 11 | |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 12 | static __thread int y __attribute((tls_model("local", "dynamic"))); // expected-error {{'tls_model' attribute takes one argument}} |
Aaron Ballman | 3cd6feb | 2013-07-30 01:31:03 +0000 | [diff] [blame] | 13 | static __thread int y __attribute((tls_model(123))); // expected-error {{'tls_model' attribute requires a string}} |
Hans Wennborg | 5e2d5de | 2012-06-23 11:51:46 +0000 | [diff] [blame] | 14 | static __thread int y __attribute((tls_model("foobar"))); // expected-error {{tls_model must be "global-dynamic", "local-dynamic", "initial-exec" or "local-exec"}} |