mirror of
https://github.com/espressif/openthread.git
synced 2026-08-20 01:19:51 +00:00
[core] use C++11 static_assert (#5127)
This commit uses C++11 `static_assert()` replacing the existing `OT_STATIC_ASSERT()` macro definitions (intended to support build-time assertion in C++003 (oder) tool-chains).
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "test_util.h"
|
||||
#include "thread/topology.hpp"
|
||||
#include "utils/static_assert.hpp"
|
||||
|
||||
extern "C" {
|
||||
uint32_t otNetifAddress_Size_c();
|
||||
@@ -52,7 +51,7 @@ void test_packed1()
|
||||
uint16_t mShort;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
OT_STATIC_ASSERT(sizeof(packed_t) == 7, "packed_t should be packed to 7 bytes");
|
||||
static_assert(sizeof(packed_t) == 7, "packed_t should be packed to 7 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 7, "Toolchain::OT_TOOL_PACKED failed 1");
|
||||
}
|
||||
@@ -66,7 +65,7 @@ void test_packed2()
|
||||
uint8_t mByte;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
OT_STATIC_ASSERT(sizeof(packed_t) == 4, "packed_t should be packed to 4 bytes");
|
||||
static_assert(sizeof(packed_t) == 4, "packed_t should be packed to 4 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 4, "Toolchain::OT_TOOL_PACKED failed 2");
|
||||
}
|
||||
@@ -89,7 +88,7 @@ void test_packed_union()
|
||||
} OT_TOOL_PACKED_FIELD;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
OT_STATIC_ASSERT(sizeof(packed_t) == 5, "packed_t should be packed to 5 bytes");
|
||||
static_assert(sizeof(packed_t) == 5, "packed_t should be packed to 5 bytes");
|
||||
|
||||
VerifyOrQuit(sizeof(packed_t) == 5, "Toolchain::OT_TOOL_PACKED failed 3");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user