From b8be614461ff04f02f8234859917d2ef2ba6dacc Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sun, 19 Apr 2015 16:35:22 -0400 Subject: [PATCH] ck_cc: Add DECONST_PTR and RESTRICT. DECONST_PTR is a hack to deconstify void pointer values that is safe in presence of -Wcast-qual. CK_CC_RESTRICT is restrict qualifier that can be disabled for only partially C99 compliant compilers. --- include/ck_cc.h | 6 ++++++ include/gcc/ck_cc.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/ck_cc.h b/include/ck_cc.h index 98090d9..5fea780 100644 --- a/include/ck_cc.h +++ b/include/ck_cc.h @@ -32,6 +32,12 @@ #include "gcc/ck_cc.h" #endif +#ifndef CK_CC_RESTRICT +#define CK_CC_RESTRICT +#endif + +#define CK_CC_DECONST_PTR(X) ((void *)(uintptr_t)(X)) + /* * Container function. * This relies on (compiler) implementation-defined behavior. diff --git a/include/gcc/ck_cc.h b/include/gcc/ck_cc.h index e504ccb..481a314 100644 --- a/include/gcc/ck_cc.h +++ b/include/gcc/ck_cc.h @@ -57,6 +57,8 @@ #define CK_CC_INLINE CK_CC_UNUSED #endif +#define CK_CC_RESTRICT restrict + /* * Packed attribute. */