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 1919#ifndef __MBED_CHRONO_H__
2020#define __MBED_CHRONO_H__
2121
22+ #include " mbed_toolchain.h"
2223#include < cstdint>
2324#include < cassert>
2425#include < ratio>
@@ -85,10 +86,7 @@ inline namespace chrono_literals {
8586constexpr chrono::deciseconds operator " " _ds(unsigned long long x)
8687{
8788 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);
9290 return chrono::deciseconds (val);
9391}
9492
@@ -106,10 +104,7 @@ constexpr chrono::deciseconds operator "" _ds(unsigned long long x)
106104constexpr chrono::centiseconds operator " " _cs(unsigned long long x)
107105{
108106 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);
113108 return chrono::centiseconds (val);
114109}
115110
Original file line number Diff line number Diff line change 2424#define __error_t_defined 1
2525#endif
2626
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+
2736// Warning for unsupported compilers
2837#if !defined(__GNUC__) /* GCC */ \
2938 && !defined (__clang__) /* LLVM/Clang */ \
You can’t perform that action at this time.
0 commit comments