"'__thread' is only allowed on variable declarations">;
def err_thread_non_global : Error<
"'__thread' variables must have global storage">;
+def err_thread_unsupported : Error<
+ "thread-local storage is unsupported for the current target">;
/// Built-in functions.
def ext_implicit_lib_function_decl : ExtWarn<
if (D.getDeclSpec().isThreadSpecified()) {
if (NewVD->hasLocalStorage())
Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_thread_non_global);
+ else if (!Context.Target.isTLSSupported())
+ Diag(D.getDeclSpec().getThreadSpecLoc(), diag::err_thread_unsupported);
else
NewVD->setThreadSpecified(true);
}
-// RUN: clang-cc -emit-llvm -o - %s | grep thread_local | count 4
+// RUN: clang-cc -triple i686-pc-linux-gnu -emit-llvm -o - %s | grep thread_local | count 4
__thread int a;
extern __thread int b;
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: clang-cc -triple i686-pc-linux-gnu -fsyntax-only -verify %s
__thread int t1;
__thread extern int t2;