diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-02 11:32:48 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-04-02 11:32:48 +0000 |
commit | 165307184a54624f4a30936d5edd0c9faa63357c (patch) | |
tree | f01decab32fd73e3dfb43068a9c94fa991d44fc9 /llvm/unittests/Support | |
parent | 580f067f726d8a3986fcfdc1b4ba31049aaeb0a5 (diff) | |
download | bcm5719-llvm-165307184a54624f4a30936d5edd0c9faa63357c.tar.gz bcm5719-llvm-165307184a54624f4a30936d5edd0c9faa63357c.zip |
[support] Add a macro wrapper for alignas and simplify some code.
We wrap __attribute((aligned)) for GCC 4.7 and __declspec(align) for
MSVC. The latter behaves weird in some contexts so this should be used
carefully.
llvm-svn: 233910
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r-- | llvm/unittests/Support/AlignOfTest.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/llvm/unittests/Support/AlignOfTest.cpp b/llvm/unittests/Support/AlignOfTest.cpp index d2090867e26..b9d423e8eee 100644 --- a/llvm/unittests/Support/AlignOfTest.cpp +++ b/llvm/unittests/Support/AlignOfTest.cpp @@ -39,24 +39,10 @@ namespace { #endif // Define some fixed alignment types to use in these tests. -#if __has_feature(cxx_alignas) -struct alignas(1) A1 { }; -struct alignas(2) A2 { }; -struct alignas(4) A4 { }; -struct alignas(8) A8 { }; -#elif defined(__GNUC__) -struct A1 { } __attribute__((aligned(1))); -struct A2 { } __attribute__((aligned(2))); -struct A4 { } __attribute__((aligned(4))); -struct A8 { } __attribute__((aligned(8))); -#elif defined(_MSC_VER) -__declspec(align(1)) struct A1 { }; -__declspec(align(2)) struct A2 { }; -__declspec(align(4)) struct A4 { }; -__declspec(align(8)) struct A8 { }; -#else -# error No supported align as directive. -#endif +struct LLVM_ALIGNAS(1) A1 {}; +struct LLVM_ALIGNAS(2) A2 {}; +struct LLVM_ALIGNAS(4) A4 {}; +struct LLVM_ALIGNAS(8) A8 {}; struct S1 {}; struct S2 { char a; }; |