Commit 219a756a authored by Max Kellermann's avatar Max Kellermann

Compiler.h: drop gcc_alignas(), use plain C++11 alignas()

parent 2f76f9da
...@@ -160,14 +160,6 @@ ...@@ -160,14 +160,6 @@
#define gcc_restrict #define gcc_restrict
#endif #endif
/* C++11 features */
#if defined(__cplusplus)
#define gcc_alignas(T, fallback) alignas(T)
#endif
#ifndef __has_feature #ifndef __has_feature
// define dummy macro for non-clang compilers // define dummy macro for non-clang compilers
#define __has_feature(x) 0 #define __has_feature(x) 0
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
*/ */
template<class T> template<class T>
class Manual { class Manual {
gcc_alignas(T, 8) alignas(T)
char data[sizeof(T)]; char data[sizeof(T)];
#ifndef NDEBUG #ifndef NDEBUG
......
...@@ -49,9 +49,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ByteReverseTest); ...@@ -49,9 +49,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ByteReverseTest);
void void
ByteReverseTest::TestByteReverse2() ByteReverseTest::TestByteReverse2()
{ {
static const char src[] gcc_alignas(uint16_t, 2) = "123456"; static const char src[] alignas(uint16_t) = "123456";
static const char result[] = "214365"; static const char result[] = "214365";
static uint8_t dest[ARRAY_SIZE(src)] gcc_alignas(uint16_t, 2); static uint8_t dest[ARRAY_SIZE(src)] alignas(uint16_t);
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2);
...@@ -73,9 +73,9 @@ ByteReverseTest::TestByteReverse3() ...@@ -73,9 +73,9 @@ ByteReverseTest::TestByteReverse3()
void void
ByteReverseTest::TestByteReverse4() ByteReverseTest::TestByteReverse4()
{ {
static const char src[] gcc_alignas(uint32_t, 4) = "12345678"; static const char src[] alignas(uint32_t) = "12345678";
static const char result[] = "43218765"; static const char result[] = "43218765";
static uint8_t dest[ARRAY_SIZE(src)] gcc_alignas(uint32_t, 4); static uint8_t dest[ARRAY_SIZE(src)] alignas(uint32_t);
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment