diff --git a/include/toolchain/gcc.h b/include/toolchain/gcc.h index e8be67633ef..ea6a0dd9227 100644 --- a/include/toolchain/gcc.h +++ b/include/toolchain/gcc.h @@ -194,6 +194,10 @@ do { \ #define popcount(x) __builtin_popcount(x) +#ifndef __no_optimization +#define __no_optimization __attribute__((optimize("-O0"))) +#endif + #ifndef __weak #define __weak __attribute__((__weak__)) #endif diff --git a/include/toolchain/mwdt.h b/include/toolchain/mwdt.h index 3eb83fb3bd0..a97f8a05618 100644 --- a/include/toolchain/mwdt.h +++ b/include/toolchain/mwdt.h @@ -61,6 +61,8 @@ #else /* defined(_ASMLANGUAGE) */ +#define __no_optimization __attribute__((optnone)) + #include /* Metaware toolchain has _Static_assert. However it not able to calculate diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index 1a7cb53b7d8..cdb9f80ce5d 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -160,7 +160,7 @@ void isr6(const void *param) * doesn't support this; we need to tell the compiler not to reorder memory * accesses to trigger_check around calls to trigger_irq. */ -__attribute__((optimize("-O0"))) +__no_optimization #endif int test_irq(int offset) {