X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cfg%2Fcompiler.h;h=a303dc776115cc0ab9640d4eb208bfe366c950ad;hb=f3ba158c1ebfcef6c85759056d0a3d5f421ea870;hp=6485473cf2f12d086e99acca3599b83fbbfb5a0e;hpb=5b9ba07bc069e4403dd5713b6be6c5f98f8a86a7;p=bertos.git diff --git a/cfg/compiler.h b/cfg/compiler.h index 6485473c..a303dc77 100644 --- a/cfg/compiler.h +++ b/cfg/compiler.h @@ -37,8 +37,8 @@ * \author Bernardo Innocenti */ -#ifndef DEVLIB_COMPILER_H -#define DEVLIB_COMPILER_H +#ifndef BERTOS_COMPILER_H +#define BERTOS_COMPILER_H #include @@ -180,6 +180,12 @@ #define USED_FUNC __attribute__((__used__)) #define RESTRICT __restrict__ #define MUST_CHECK __attribute__((warn_unused_result)) + #define PACKED __attribute__((packed)) + /** + * Force compiler to realod context variable. + */ + #define MEMORY_BARRIER asm volatile ("" : : : "memory") + #if GNUC_PREREQ(3,1) #define DEPRECATED __attribute__((__deprecated__)) #endif @@ -210,6 +216,8 @@ #pragma GCC poison cin cout cerr clog #endif + + #elif defined(__MWERKS__) /* Compiler features */ @@ -309,6 +317,14 @@ #ifndef MUST_CHECK #define MUST_CHECK /* nothing */ #endif +#ifndef PACKED +#define PACKED /* nothing */ +#endif +#ifndef MEMORY_BARRIER +#define MEMORY_BARRIER /* nothing */ +#warning No memory barrier defined for select compiler. If you use the kernel check it. +#endif + /* Misc definitions */ #ifndef NULL @@ -318,7 +334,6 @@ #define EOF (-1) #endif - /* Support for hybrid C/C++ applications. */ #ifdef __cplusplus #define EXTERN_C extern "C" @@ -510,4 +525,4 @@ typedef unsigned char page_t; /**< Type for banked memory pages. */ do { (void)(&(var) == (type *)0); } while(0) #endif -#endif /* DEVLIB_COMPILER_H */ +#endif /* BERTOS_COMPILER_H */