[cfe-commits] [libcxx] r157764 - in /libcxx/trunk: include/__config src/iostream.cpp
Howard Hinnant
hhinnant at apple.com
Thu May 31 12:31:14 PDT 2012
Author: hhinnant
Date: Thu May 31 14:31:14 2012
New Revision: 157764
URL: http://llvm.org/viewvc/llvm-project?rev=157764&view=rev
Log:
Protect use of alignas against older versions of clang
Modified:
libcxx/trunk/include/__config
libcxx/trunk/src/iostream.cpp
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=157764&r1=157763&r2=157764&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu May 31 14:31:14 2012
@@ -145,8 +145,10 @@
#if defined(__clang__)
#if __has_feature(cxx_alignas)
+# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
+# define _ALIGNAS_TYPE(x) __attribute__((__aligned__))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
Modified: libcxx/trunk/src/iostream.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/iostream.cpp?rev=157764&r1=157763&r2=157764&view=diff
==============================================================================
--- libcxx/trunk/src/iostream.cpp (original)
+++ libcxx/trunk/src/iostream.cpp Thu May 31 14:31:14 2012
@@ -13,21 +13,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-alignas (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
-alignas (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
-alignas (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
-alignas (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wchar_t>)];
-alignas (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
-alignas (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
-
-alignas (istream) char cin [sizeof(istream)];
-alignas (ostream) char cout[sizeof(ostream)];
-alignas (ostream) char cerr[sizeof(ostream)];
-alignas (ostream) char clog[sizeof(ostream)];
-alignas (wistream) char wcin [sizeof(wistream)];
-alignas (wostream) char wcout[sizeof(wostream)];
-alignas (wostream) char wcerr[sizeof(wostream)];
-alignas (wostream) char wclog[sizeof(wostream)];
+_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
+_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
+_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
+_ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wchar_t>)];
+_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
+_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
+
+_ALIGNAS_TYPE (istream) char cin [sizeof(istream)];
+_ALIGNAS_TYPE (ostream) char cout[sizeof(ostream)];
+_ALIGNAS_TYPE (ostream) char cerr[sizeof(ostream)];
+_ALIGNAS_TYPE (ostream) char clog[sizeof(ostream)];
+_ALIGNAS_TYPE (wistream) char wcin [sizeof(wistream)];
+_ALIGNAS_TYPE (wostream) char wcout[sizeof(wostream)];
+_ALIGNAS_TYPE (wostream) char wcerr[sizeof(wostream)];
+_ALIGNAS_TYPE (wostream) char wclog[sizeof(wostream)];
ios_base::Init __start_std_streams;
More information about the cfe-commits
mailing list