<div class="gmail_quote">On Thu, May 31, 2012 at 1:02 PM, Howard Hinnant <span dir="ltr"><<a href="mailto:hhinnant@apple.com" target="_blank">hhinnant@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On May 31, 2012, at 3:58 PM, Chandler Carruth wrote:<br>
<br>
> On Thu, May 31, 2012 at 12:31 PM, Howard Hinnant <<a href="mailto:hhinnant@apple.com">hhinnant@apple.com</a>> wrote:<br>
> Author: hhinnant<br>
> Date: Thu May 31 14:31:14 2012<br>
> New Revision: 157764<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=157764&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=157764&view=rev</a><br>
> Log:<br>
> Protect use of alignas against older versions of clang<br>
><br>
> Modified:<br>
>    libcxx/trunk/include/__config<br>
>    libcxx/trunk/src/iostream.cpp<br>
><br>
> Modified: libcxx/trunk/include/__config<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=157764&r1=157763&r2=157764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=157764&r1=157763&r2=157764&view=diff</a><br>

> ==============================================================================<br>
> --- libcxx/trunk/include/__config (original)<br>
> +++ libcxx/trunk/include/__config Thu May 31 14:31:14 2012<br>
> @@ -145,8 +145,10 @@<br>
>  #if defined(__clang__)<br>
><br>
>  #if __has_feature(cxx_alignas)<br>
> +#  define _ALIGNAS_TYPE(x) alignas(x)<br>
>  #  define _ALIGNAS(x) alignas(x)<br>
>  #else<br>
> +#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__))<br>
><br>
> Should this be __aligned__(x) as it is here:<br>
><br>
>  #  define _ALIGNAS(x) __attribute__((__aligned__(x)))<br>
><br>
> Or are you intentionally shooting for the 'maximally aligned' thing? If the latter, maybe comment that this is intentional and not a typo?<br>
<br>
</div></div>It's intentional.  My first try was using _ALIGNAS, and the compiler really didn't like it:<br>
<br>
../src/iostream.cpp:16:21: error: expected ')'<br>
_ALIGNAS (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];<br>
                    ^<br>
../include/__config:149:50: note: expanded from macro '_ALIGNAS'<br>
#  define _ALIGNAS(x) __attribute__((__aligned__(x)))<br>
                                                 ^<br>
<br>
And so I punted by introducing _ALIGNAS_TYPE.<br></blockquote><div><br></div><div>Wow. That's... I don't even know what it is, other than a terrible message from the compiler. ::mental note::</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I can add a comment, but I'd really like to hold trunk stable for just a couple more hours.<br></blockquote><div><br></div><div>Oh, of course, no urgency. I was just glancing through the patch. =]</div></div>