<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">has_feature_c1x.c test has started to fail on Windows for us.<div>Because of:</div><div><br></div><div><div>#if __has_feature(c_thread_local)</div><div>int has_thread_local();</div><div>#else</div><div>int no_thread_local();</div><div>#endif</div><div><br></div><div>// CHECK-1X: has_thread_local</div><div><br></div><div>When -std=c1x option is passed to cc1. Is this expected to pass everywhere? </div><div><br></div><div>- Fariborz</div><div><br></div><div><br></div><div><div>On May 2, 2013, at 6:17 AM, Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>On May 2, 2013, at 1:00 AM, Jean-Daniel Dupas <<a href="mailto:devlists@shadowlab.org">devlists@shadowlab.org</a>> wrote:<br><br><blockquote type="cite">Is it OK to use the same condition for both while they don't require the same Target support ?<span class="Apple-converted-space"> </span><br><br>AFAK, C++ TLS require __cxa_thread_atexit support, and so the target should support thread_atexit, while C TLS doesn't need it.<br></blockquote><br>As Richard notes, whether __cxa_thread_atexit is available or not is a library issue, and we don't have visibility into that within the frontend. However, we do know whether the target supports thread-local storage in general (it's part of target information), and my change makes __has_feature(c(xx)?_thread_local) match what Sema actually allows.<br><br><blockquote type="cite">Actually, I think darwin has support for C thread local, but no C++ thread local.<br></blockquote><br>x86 Darwin fully supports thread-local, although the __cxa_thread_atexit equivalent is called __tlv_atexit. ARM Darwin does not support thread-local (at all).<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>- Doug<br><br><br><blockquote type="cite">Le 2 mai 2013 à 07:28, Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> a écrit :<br><br><blockquote type="cite">Author: dgregor<br>Date: Thu May 2 00:28:32 2013<br>New Revision: 180909<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=180909&view=rev">http://llvm.org/viewvc/llvm-project?rev=180909&view=rev</a><br>Log:<br>Only evaluate __has_feature(c_thread_local) and __has_feature(cxx_thread_local) true when the target supports thread-local storage.<br><br>Modified:<br> cfe/trunk/lib/Lex/PPMacroExpansion.cpp<br> cfe/trunk/test/Lexer/has_feature_cxx0x.cpp<br><br>Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=180909&r1=180908&r2=180909&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=180909&r1=180908&r2=180909&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)<br>+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu May 2 00:28:32 2013<br>@@ -751,7 +751,8 @@ static bool HasFeature(const Preprocesso<br> .Case("c_atomic", LangOpts.C11)<br> .Case("c_generic_selections", LangOpts.C11)<br> .Case("c_static_assert", LangOpts.C11)<br>- .Case("c_thread_local", LangOpts.C11)<br>+ .Case("c_thread_local",<span class="Apple-converted-space"> </span><br>+ LangOpts.C11 && PP.getTargetInfo().isTLSSupported())<br> // C++11 features<br> .Case("cxx_access_control_sfinae", LangOpts.CPlusPlus11)<br> .Case("cxx_alias_templates", LangOpts.CPlusPlus11)<br>@@ -783,7 +784,8 @@ static bool HasFeature(const Preprocesso<br> .Case("cxx_rvalue_references", LangOpts.CPlusPlus11)<br> .Case("cxx_strong_enums", LangOpts.CPlusPlus11)<br> .Case("cxx_static_assert", LangOpts.CPlusPlus11)<br>- .Case("cxx_thread_local", LangOpts.CPlusPlus11)<br>+ .Case("cxx_thread_local",<span class="Apple-converted-space"> </span><br>+ LangOpts.CPlusPlus11 && PP.getTargetInfo().isTLSSupported())<br> .Case("cxx_trailing_return", LangOpts.CPlusPlus11)<br> .Case("cxx_unicode_literals", LangOpts.CPlusPlus11)<br> .Case("cxx_unrestricted_unions", LangOpts.CPlusPlus11)<br><br>Modified: cfe/trunk/test/Lexer/has_feature_cxx0x.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_cxx0x.cpp?rev=180909&r1=180908&r2=180909&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_cxx0x.cpp?rev=180909&r1=180908&r2=180909&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Lexer/has_feature_cxx0x.cpp (original)<br>+++ cfe/trunk/test/Lexer/has_feature_cxx0x.cpp Thu May 2 00:28:32 2013<br>@@ -1,5 +1,6 @@<br>-// RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s<br>-// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s<br>+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s<br>+// RUN: %clang_cc1 -E -triple armv7-apple-darwin -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-NO-TLS %s<br>+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s<br><br>#if __has_feature(cxx_atomic)<br>int has_atomic();<br>@@ -290,3 +291,4 @@ int no_thread_local();<br><br>// CHECK-0X: has_thread_local<br>// CHECK-NO-0X: no_thread_local<br>+// CHECK-NO-TLS: no_thread_local<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br></blockquote><br>-- Jean-Daniel<br><br><br><br><br></blockquote><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div><br></div></body></html>