File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 19
19
#ifndef __MBED_CHRONO_H__
20
20
#define __MBED_CHRONO_H__
21
21
22
+ #include " mbed_toolchain.h"
22
23
#include < cstdint>
23
24
#include < cassert>
24
25
#include < ratio>
@@ -85,10 +86,7 @@ inline namespace chrono_literals {
85
86
constexpr chrono::deciseconds operator " " _ds(unsigned long long x)
86
87
{
87
88
chrono::deciseconds::rep val = static_cast <chrono::deciseconds::rep>(x);
88
- if (val < 0 ) {
89
- assert (false );
90
- }
91
- assert (static_cast <unsigned long long >(val) == x);
89
+ assert (val >= 0 && static_cast <unsigned long long >(val) == x);
92
90
return chrono::deciseconds (val);
93
91
}
94
92
@@ -106,10 +104,7 @@ constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
106
104
constexpr chrono::centiseconds operator " " _cs(unsigned long long x)
107
105
{
108
106
chrono::centiseconds::rep val = static_cast <chrono::centiseconds::rep>(x);
109
- if (val < 0 ) {
110
- assert (false );
111
- }
112
- assert (static_cast <unsigned long long >(val) == x);
107
+ assert (val >= 0 && static_cast <unsigned long long >(val) == x);
113
108
return chrono::centiseconds (val);
114
109
}
115
110
Original file line number Diff line number Diff line change 24
24
#define __error_t_defined 1
25
25
#endif
26
26
27
+ /* Work around ARM Compiler 6 bug - assert does not work in constexpr
28
+ * functions unless you stop it from using its __promise built-in.
29
+ */
30
+ #ifdef __ARMCC_VERSION
31
+ #ifndef __DO_NOT_LINK_PROMISE_WITH_ASSERT
32
+ #define __DO_NOT_LINK_PROMISE_WITH_ASSERT
33
+ #endif
34
+ #endif
35
+
27
36
// Warning for unsupported compilers
28
37
#if !defined(__GNUC__) /* GCC */ \
29
38
&& !defined(__clang__) /* LLVM/Clang */ \
You can’t perform that action at this time.
0 commit comments