toolchain: define __no_optimization attribute across toolchains

The __attribute__((optimize("-O0"))) attribute is used to disable
optimization of some test functions. ARC MWDT toolchain doesn't
support it, however it supports __attribute__((optnone)) with
similar functionality.

Define __no_optimization attribute across all toolchains so it
can be used in tests.

NOTE: we don't define __no_optimization for XCC as it includes
GCC header with __no_optimization defined.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
This commit is contained in:
Eugeniy Paltsev 2020-09-23 00:22:17 +03:00 committed by Anas Nashif
parent f55080e4f9
commit effd2fa834
3 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -61,6 +61,8 @@
#else /* defined(_ASMLANGUAGE) */
#define __no_optimization __attribute__((optnone))
#include <toolchain/gcc.h>
/* Metaware toolchain has _Static_assert. However it not able to calculate

View File

@ -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)
{