|
22 | 22 | // multiple asserts are used to guarantee no conflicts occur in generated labels |
23 | 23 |
|
24 | 24 | // Test for static asserts in global context |
25 | | -MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char), |
26 | | - "An int must be larger than char"); |
27 | | -MBED_STATIC_ASSERT(2 + 2 == 4, |
28 | | - "Hopefully the universe is mathematically consistent"); |
29 | | -MBED_STATIC_ASSERT(THE_ANSWER == 42, |
30 | | - "Said Deep Thought, with infinite majesty and calm"); |
| 25 | +static_assert(sizeof(int) >= sizeof(char), |
| 26 | + "An int must be larger than char"); |
| 27 | +static_assert(2 + 2 == 4, |
| 28 | + "Hopefully the universe is mathematically consistent"); |
| 29 | +static_assert(THE_ANSWER == 42, |
| 30 | + "Said Deep Thought, with infinite majesty and calm"); |
31 | 31 |
|
32 | 32 | struct test { |
33 | 33 | int dummy; |
34 | 34 |
|
35 | 35 | // Test for static asserts in struct context |
36 | | - MBED_STRUCT_STATIC_ASSERT(sizeof(int) >= sizeof(char), |
37 | | - "An int must be larger than char"); |
38 | | - MBED_STRUCT_STATIC_ASSERT(2 + 2 == 4, |
39 | | - "Hopefully the universe is mathematically consistent"); |
40 | | - MBED_STRUCT_STATIC_ASSERT(THE_ANSWER == 42, |
41 | | - "Said Deep Thought, with infinite majesty and calm"); |
| 36 | + static_assert(sizeof(int) >= sizeof(char), |
| 37 | + "An int must be larger than char"); |
| 38 | + static_assert(2 + 2 == 4, |
| 39 | + "Hopefully the universe is mathematically consistent"); |
| 40 | + static_assert(THE_ANSWER == 42, |
| 41 | + "Said Deep Thought, with infinite majesty and calm"); |
42 | 42 |
|
43 | | - MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char), |
44 | | - "An int must be larger than char"); |
45 | | - MBED_STATIC_ASSERT(2 + 2 == 4, |
46 | | - "Hopefully the universe is mathematically consistent"); |
47 | | - MBED_STATIC_ASSERT(THE_ANSWER == 42, |
48 | | - "Said Deep Thought, with infinite majesty and calm"); |
| 43 | + static_assert(sizeof(int) >= sizeof(char), |
| 44 | + "An int must be larger than char"); |
| 45 | + static_assert(2 + 2 == 4, |
| 46 | + "Hopefully the universe is mathematically consistent"); |
| 47 | + static_assert(THE_ANSWER == 42, |
| 48 | + "Said Deep Thought, with infinite majesty and calm"); |
49 | 49 | }; |
50 | 50 |
|
51 | | -MBED_STATIC_ASSERT(sizeof(struct test) == sizeof(int), |
52 | | - "Static assertions should not change the size of a struct"); |
| 51 | +static_assert(sizeof(struct test) == sizeof(int), |
| 52 | + "Static assertions should not change the size of a struct"); |
53 | 53 |
|
54 | 54 | void doit_c(void) |
55 | 55 | { |
56 | 56 | // Test for static asserts in function context |
57 | | - MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char), |
58 | | - "An int must be larger than char"); |
59 | | - MBED_STATIC_ASSERT(2 + 2 == 4, |
60 | | - "Hopefully the universe is mathematically consistent"); |
61 | | - MBED_STATIC_ASSERT(THE_ANSWER == 42, |
62 | | - "Said Deep Thought, with infinite majesty and calm"); |
| 57 | + static_assert(sizeof(int) >= sizeof(char), |
| 58 | + "An int must be larger than char"); |
| 59 | + static_assert(2 + 2 == 4, |
| 60 | + "Hopefully the universe is mathematically consistent"); |
| 61 | + static_assert(THE_ANSWER == 42, |
| 62 | + "Said Deep Thought, with infinite majesty and calm"); |
63 | 63 | } |
64 | 64 |
|
0 commit comments