Choco OS  V.0.16.9.0
Join to the chocolate world
oc_compiler.h
Go to the documentation of this file.
1 
26 #ifndef SYSTEM_CORE_OC_COMPILER_H_
27 #define SYSTEM_CORE_OC_COMPILER_H_
28 
29 #include <oc_assert.h>
30 
31 #define oC_DO_PRAGMA( x ) _Pragma(#x)
32 #define oC_COMPILER_ERROR( MESSAGE ) oC_DO_PRAGMA( GCC error #MESSAGE )
33 #define oC_COMPILER_WARNING( MESSAGE ) oC_DO_PRAGMA( GCC warning #MESSAGE )
34 #define oC_COMPILER_NOTE( MESSAGE ) oC_DO_PRAGMA( GCC message #MESSAGE )
35 #define oC_WEAK_DEFAULT( ALIAS , SYMBOL ) oC_DO_PRAGMA( weak ALIAS = SYMBOL )
36 #define oC_WEAK( SYMBOL ) oC_DO_PRAGMA( weak SYMBOL )
37 #define _oC_TO_STRING(DEF) #DEF
38 #define oC_TO_STRING( DEFINITION ) _oC_TO_STRING(DEFINITION)
39 #define oC_IGNORE_MISSED_BREAK oC_DO_PRAGMA( GCC diagnostic ignored "-Wunused-variable")
40 
41 #ifdef __GNUC__
42 # define oC_FUNCTION __FUNCTION__
43 # define oC_LINE __LINE__
44 #else
45 # define oC_FUNCTION "unknown-compiler"
46 # define oC_LINE 0
47 #endif
48 
49 #define PACKED __attribute__((packed))
50 #define ALIGNED(x) __attribute__((aligned(x)))
51 
52 # define Unused(x) UNUSED_ ## x __attribute__((unused))
53 
54 #define oC_FUNCTION_REDEFINITION( NEW_FUNCTION_NAME , OLD_FUNCTION_NAME ) oC_WEAK_DEFAULT( NEW_FUNCTION_NAME , OLD_FUNCTION_NAME )
55 
56 #define oC_FUNCTION_ONLY_FOR_STATIC_BUFFER( Buffer , FunctionName , Replacement ) \
57  ;oC_STATIC_ASSERT( sizeof(Buffer) != sizeof(void*) , "The function " #FunctionName " is designed only for static buffers! You cannot use it with pointers. Please use " #Replacement " instead!" )
58 
59 #endif /* SYSTEM_CORE_OC_COMPILER_H_ */
FILE__DESCRIPTION