Skip to content

Commit 57bbb47

Browse files
authored
Merge pull request #13085 from pea-pod/remove-deprecated-mbed-assert
Change MBED_STATIC_ASSERTs version for built-in
2 parents f227856 + 507181d commit 57bbb47

File tree

30 files changed

+109
-105
lines changed

30 files changed

+109
-105
lines changed

connectivity/FEATURE_BLE/include/ble/common/Duration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct Duration {
141141
Duration(Duration<OtherRep, OtherTB, OtherRange, OtherF> other) :
142142
duration(clamp(other.value() * (OtherTB / TB)))
143143
{
144-
MBED_STATIC_ASSERT(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units");
144+
static_assert(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units");
145145
}
146146

147147
/**

connectivity/netsocket/source/NetworkStack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class NetworkStackWrapper : public NetworkStack {
431431
// Conversion function for network stacks
432432
NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
433433
{
434-
MBED_STATIC_ASSERT(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
435-
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
434+
static_assert(sizeof stack->_stack_buffer >= sizeof(NetworkStackWrapper),
435+
"The nsapi_stack_t stack buffer must fit a NetworkStackWrapper");
436436
return new (stack->_stack_buffer) NetworkStackWrapper;
437437
}

drivers/source/MbedCRC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace mbed {
2323

2424
SingletonPtr<PlatformMutex> mbed_crc_mutex;
2525

26-
MBED_STATIC_ASSERT(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256,
27-
"Configuration setting drivers.crc-table-size must be set to 0, 16 or 256");
26+
static_assert(MBED_CRC_TABLE_SIZE == 0 || MBED_CRC_TABLE_SIZE == 16 || MBED_CRC_TABLE_SIZE == 256,
27+
"Configuration setting drivers.crc-table-size must be set to 0, 16 or 256");
2828

2929
#if MBED_CRC_TABLE_SIZE > 0
3030

events/source/equeue_mbed.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ static void equeue_tick_update()
106106

107107
void equeue_tick_init()
108108
{
109-
MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(ALIAS_TIMER),
110-
"The equeue_timer buffer must fit the class Timer");
111-
MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(ALIAS_TICKER),
112-
"The equeue_ticker buffer must fit the class Ticker");
109+
static_assert(sizeof(equeue_timer) >= sizeof(ALIAS_TIMER),
110+
"The equeue_timer buffer must fit the class Timer");
111+
static_assert(sizeof(equeue_ticker) >= sizeof(ALIAS_TICKER),
112+
"The equeue_ticker buffer must fit the class Ticker");
113113
ALIAS_TIMER *timer = new (equeue_timer) ALIAS_TIMER;
114114
ALIAS_TICKER *ticker = new (equeue_ticker) ALIAS_TICKER;
115115

@@ -156,7 +156,7 @@ void equeue_mutex_unlock(equeue_mutex_t *m)
156156

157157
#include "rtos/EventFlags.h"
158158

159-
MBED_STATIC_ASSERT(sizeof(equeue_sema_t) == sizeof(rtos::EventFlags), "equeue_sema_t / rtos::EventFlags mismatch");
159+
static_assert(sizeof(equeue_sema_t) == sizeof(rtos::EventFlags), "equeue_sema_t / rtos::EventFlags mismatch");
160160

161161
int equeue_sema_create(equeue_sema_t *s)
162162
{

features/frameworks/utest/utest/utest_specification.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace v1 {
5555
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
5656
defaults(defaults)
5757
{
58-
MBED_STATIC_ASSERT(
58+
static_assert(
5959
sizeof(CaseType) == sizeof(Case),
6060
"CaseType and Case should have the same size"
6161
);
@@ -69,7 +69,7 @@ namespace v1 {
6969
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
7070
defaults(defaults)
7171
{
72-
MBED_STATIC_ASSERT(
72+
static_assert(
7373
sizeof(CaseType) == sizeof(Case),
7474
"CaseType and Case should have the same size"
7575
);
@@ -83,7 +83,7 @@ namespace v1 {
8383
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
8484
defaults(defaults)
8585
{
86-
MBED_STATIC_ASSERT(
86+
static_assert(
8787
sizeof(CaseType) == sizeof(Case),
8888
"CaseType and Case should have the same size"
8989
);
@@ -98,7 +98,7 @@ namespace v1 {
9898
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
9999
defaults(defaults)
100100
{
101-
MBED_STATIC_ASSERT(
101+
static_assert(
102102
sizeof(CaseType) == sizeof(Case),
103103
"CaseType and Case should have the same size"
104104
);
@@ -122,7 +122,7 @@ namespace v1 {
122122
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
123123
defaults(defaults)
124124
{
125-
MBED_STATIC_ASSERT(
125+
static_assert(
126126
sizeof(CaseType) == sizeof(Case),
127127
"CaseType and Case should have the same size"
128128
);
@@ -137,7 +137,7 @@ namespace v1 {
137137
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
138138
defaults(defaults)
139139
{
140-
MBED_STATIC_ASSERT(
140+
static_assert(
141141
sizeof(CaseType) == sizeof(Case),
142142
"CaseType and Case should have the same size"
143143
);
@@ -153,7 +153,7 @@ namespace v1 {
153153
cases(static_cast<const Case*>(static_cast<const CaseType*>(cases))), length(N),
154154
defaults(defaults)
155155
{
156-
MBED_STATIC_ASSERT(
156+
static_assert(
157157
sizeof(CaseType) == sizeof(Case),
158158
"CaseType and Case should have the same size"
159159
);

hal/source/mbed_pinmap_default.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ static const PinList ff_arduino_list = {
4242
ff_arduino_pins
4343
};
4444

45-
MBED_STATIC_ASSERT(sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]) == sizeof(ff_arduino_names) / sizeof(ff_arduino_names[0]),
46-
"Arrays must have the same length");
45+
static_assert(sizeof(ff_arduino_pins) / sizeof(ff_arduino_pins[0]) == sizeof(ff_arduino_names) / sizeof(ff_arduino_names[0]),
46+
"Arrays must have the same length");
4747

4848
const PinList *pinmap_ff_arduino_pins()
4949
{

hal/source/mpu/mbed_mpu_v7m.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#endif
3434
#define MBED_MPU_RAM_START (MBED_MPU_ROM_END + 1)
3535

36-
MBED_STATIC_ASSERT(
36+
static_assert(
3737
MBED_MPU_ROM_END == 0x04000000 - 1 ||
3838
MBED_MPU_ROM_END == 0x08000000 - 1 ||
3939
MBED_MPU_ROM_END == 0x0C000000 - 1 ||

hal/source/mpu/mbed_mpu_v8m.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#endif
3434
#define MBED_MPU_RAM_START (MBED_MPU_ROM_END + 1)
3535

36-
MBED_STATIC_ASSERT(MBED_MPU_ROM_END <= 0x20000000 - 1,
37-
"Unsupported value for MBED_MPU_ROM_END");
36+
static_assert(MBED_MPU_ROM_END <= 0x20000000 - 1,
37+
"Unsupported value for MBED_MPU_ROM_END");
3838

3939
void mbed_mpu_init()
4040
{

platform/cxxsupport/mstd_atomic

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <mstd_memory>
2424
#include <mstd_type_traits>
2525
#include <mstd_utility>
26-
#include "platform/mbed_assert.h"
2726
#include "platform/mbed_atomic.h"
2827
#include "platform/mbed_critical.h"
2928
#include "platform/CriticalSectionLock.h"
@@ -477,7 +476,7 @@ protected:
477476
*/
478477
template<typename T, typename A = atomic_container_t<T>>
479478
struct AtomicBaseInt {
480-
MBED_STRUCT_STATIC_ASSERT(sizeof(T) == sizeof(A), "AtomicBaseInt size mismatch");
479+
static_assert(sizeof(T) == sizeof(A), "AtomicBaseInt size mismatch");
481480
using value_type = T;
482481
AtomicBaseInt() noexcept = default;
483482
constexpr AtomicBaseInt(T v) noexcept : u(A(v))

platform/include/platform/CircularBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ class CircularBuffer {
7070
public:
7171
CircularBuffer() : _head(0), _tail(0), _full(false)
7272
{
73-
MBED_STATIC_ASSERT(
73+
static_assert(
7474
internal::is_unsigned<CounterType>::value,
7575
"CounterType must be unsigned"
7676
);
7777

78-
MBED_STATIC_ASSERT(
78+
static_assert(
7979
(sizeof(CounterType) >= sizeof(uint32_t)) ||
8080
(BufferSize < (((uint64_t) 1) << (sizeof(CounterType) * 8))),
8181
"Invalid BufferSize for the CounterType"

0 commit comments

Comments
 (0)