mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 10:49:51 +00:00
[unit-test] use OT_STATIC_ASSERT in unit tests (#4367)
This commit removes `CompileTimeAssert` (which was an empty macro). Instead `OT_STATIC_ASSERT` is used in `test_toolchain.cpp`.
This commit is contained in:
committed by
Jonathan Hui
parent
5be9084add
commit
91e8903699
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "test_util.h"
|
||||
#include "thread/topology.hpp"
|
||||
#include "utils/static_assert.hpp"
|
||||
|
||||
extern "C" {
|
||||
uint32_t otNetifAddress_Size_c();
|
||||
@@ -51,7 +52,7 @@ void test_packed1()
|
||||
uint16_t mShort;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 7, "packed_t should be packed to 7 bytes");
|
||||
OT_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");
|
||||
}
|
||||
@@ -65,7 +66,7 @@ void test_packed2()
|
||||
uint8_t mByte;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 4, "packed_t should be packed to 4 bytes");
|
||||
OT_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");
|
||||
}
|
||||
@@ -88,7 +89,7 @@ void test_packed_union()
|
||||
} OT_TOOL_PACKED_FIELD;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
CompileTimeAssert(sizeof(packed_t) == 5, "packed_t should be packed to 5 bytes");
|
||||
OT_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");
|
||||
}
|
||||
|
||||
@@ -72,15 +72,6 @@ extern "C" {
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
//#define CompileTimeAssert(COND, MSG) typedef char __C_ASSERT__[(COND)?1:-1]
|
||||
|
||||
// I would use the above definition for CompileTimeAssert, but I am getting the following errors
|
||||
// when I run 'make -f examples/Makefile-posix distcheck':
|
||||
//
|
||||
// error: typedef "__C_ASSERT__" locally defined but not used [-Werror=unused-local-typedefs]
|
||||
//
|
||||
#define CompileTimeAssert(COND, MSG)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user