[cfe-commits] [libcxx] r157764 - in /libcxx/trunk: include/__config src/iostream.cpp

Chandler Carruth chandlerc at google.com
Thu May 31 13:05:24 PDT 2012


On Thu, May 31, 2012 at 1:02 PM, Howard Hinnant <hhinnant at apple.com> wrote:

> On May 31, 2012, at 3:58 PM, Chandler Carruth wrote:
>
> > On Thu, May 31, 2012 at 12:31 PM, Howard Hinnant <hhinnant at apple.com>
> wrote:
> > 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__))
> >
> > Should this be __aligned__(x) as it is here:
> >
> >  #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
> >
> > Or are you intentionally shooting for the 'maximally aligned' thing? If
> the latter, maybe comment that this is intentional and not a typo?
>
> It's intentional.  My first try was using _ALIGNAS, and the compiler
> really didn't like it:
>
> ../src/iostream.cpp:16:21: error: expected ')'
> _ALIGNAS (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
>                    ^
> ../include/__config:149:50: note: expanded from macro '_ALIGNAS'
> #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
>                                                 ^
>
> And so I punted by introducing _ALIGNAS_TYPE.
>

Wow. That's... I don't even know what it is, other than a terrible message
from the compiler. ::mental note::


> I can add a comment, but I'd really like to hold trunk stable for just a
> couple more hours.
>

Oh, of course, no urgency. I was just glancing through the patch. =]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120531/463c3394/attachment.html>


More information about the cfe-commits mailing list