toolchain: define ZRESTRICT for restrict aliasing

restrict keyword is not supported in C++, however
GNUC does support __restrict for C/C++ so we can use that,
however the complexity of toolchains requires a ZRESTRICT
symbol that should be used throughout the codebase to not
cause any conflicts or redefinition errors

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
This commit is contained in:
Nicholas Lowell 2020-07-29 14:34:59 -04:00 committed by Carles Cufí
commit 0d31403318
2 changed files with 14 additions and 0 deletions

View file

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

View file

@ -63,6 +63,12 @@
#define BUILD_ASSERT(EXPR, MSG...)
#endif
#ifdef __cplusplus
#define ZRESTRICT __restrict
#else
#define ZRESTRICT restrict
#endif
#include <toolchain/common.h>
#include <stdbool.h>