[llvm-commits] [llvm] r158637 - /llvm/trunk/unittests/Support/AlignOfTest.cpp

Chandler Carruth chandlerc at google.com
Sun Jun 17 03:54:59 PDT 2012


On Sun, Jun 17, 2012 at 3:48 AM, Gabor Greif <gabor at mac.com> wrote:

> Candler wrote:
>
> > ...
> > +  EXPECT_EQ(sizeof(char), sizeof
> > (AlignedCharArray<char>::union_type));
> > +  EXPECT_EQ(sizeof(char[1]), sizeof(AlignedCharArray<char[1]
> > >::union_type));
> > +  EXPECT_EQ(sizeof(char[2]), sizeof(AlignedCharArray<char[2]
> > >::union_type));
> > +  EXPECT_EQ(sizeof(char[3]), sizeof(AlignedCharArray<char[3]
> > >::union_type));
> > +  EXPECT_EQ(sizeof(char[4]), sizeof(AlignedCharArray<char[4]
> > >::union_type));
> > +  EXPECT_EQ(sizeof(char[5]), sizeof(AlignedCharArray<char[5]
> > >::union_type));
> > ...
>
>
> And to save all other people's sanity ;-) you could introduce a macro
> like this:
>
> #define EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(A) \
>     EXPECT_EQ(sizeof(A), sizeof(AlignedCharArray<A>::union_type))
>
> and then
>
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char)
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[1])
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[2])
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[3])
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[4])
> EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[5])
>

This doesn't seem to really save anything. Same number of lines of code,
etc. My editor is very good at managing these blobs of text... ;]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120617/b198390c/attachment.html>


More information about the llvm-commits mailing list