diff --git a/include/toolchain/common.h b/include/toolchain/common.h index 4b9d1f46b66..6b6df0f8d92 100644 --- a/include/toolchain/common.h +++ b/include/toolchain/common.h @@ -26,6 +26,14 @@ #define TASK_ENTRY_CPP extern "C" #endif +#ifndef ZRESTRICT +#ifndef __cplusplus +#define ZRESTRICT restrict +#else +#define ZRESTRICT +#endif +#endif + /* * Generate a reference to an external symbol. * The reference indicates to the linker that the symbol is required diff --git a/include/toolchain/gcc.h b/include/toolchain/gcc.h index cc2fdc7dc9b..4f1bd31dd01 100644 --- a/include/toolchain/gcc.h +++ b/include/toolchain/gcc.h @@ -63,6 +63,12 @@ #define BUILD_ASSERT(EXPR, MSG...) #endif +#ifdef __cplusplus +#define ZRESTRICT __restrict +#else +#define ZRESTRICT restrict +#endif + #include #include