mirror of https://github.com/ARMmbed/mbed-os.git
Work around ARM C 6 constexpr assert
ARMC6's assert macro does not work in C++14 constexpr context as it should. By defining __DO_NOT_LINK_PROMISE_WITH_ASSERT, we deactivate the extension that breaks it (having `__promise` inside `assert` - see the compiler manual). The extension does not appear to be useful - we have no code using ARMC6's `__promise` directly, and putting a `__promise` inside the assert does not appear to affect code generation in my tests.pull/12906/head
parent
d1ae0d570c
commit
ff2a928091
|
|
@ -24,6 +24,15 @@
|
||||||
#define __error_t_defined 1
|
#define __error_t_defined 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Work around ARM Compiler 6 bug - assert does not work in constexpr
|
||||||
|
* functions unless you stop it from using its __promise built-in.
|
||||||
|
*/
|
||||||
|
#ifdef __ARMCC_VERSION
|
||||||
|
#ifndef __DO_NOT_LINK_PROMISE_WITH_ASSERT
|
||||||
|
#define __DO_NOT_LINK_PROMISE_WITH_ASSERT
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Warning for unsupported compilers
|
// Warning for unsupported compilers
|
||||||
#if !defined(__GNUC__) /* GCC */ \
|
#if !defined(__GNUC__) /* GCC */ \
|
||||||
&& !defined(__clang__) /* LLVM/Clang */ \
|
&& !defined(__clang__) /* LLVM/Clang */ \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue