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
Kevin Bracey 2020-04-03 15:50:19 +03:00
parent d1ae0d570c
commit ff2a928091
1 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,15 @@
#define __error_t_defined 1
#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
#if !defined(__GNUC__) /* GCC */ \
&& !defined(__clang__) /* LLVM/Clang */ \