Choco OS  V.0.16.9.0
Join to the chocolate world
oc_assert.h
Go to the documentation of this file.
1 
27 #ifndef SYSTEM_CORE_OC_ASSERT_H_
28 #define SYSTEM_CORE_OC_ASSERT_H_
29 
30 #include <oc_debug_cfg.h>
31 #include <oc_compiler.h>
32 #include <assert.h>
33 
34 #define _STATIC_ASSERT(COND,MSG)
35 //==========================================================================================================================================
51 //==========================================================================================================================================
52 #if !defined(CFG_ENABLE_ASSERTIONS)
53 # error CFG_ENABLE_ASSERTIONS is not defined in oc_debug_cfg.h
54 #elif CFG_ENABLE_ASSERTIONS == ON
55 # define oC_STATIC_ASSERT( CONDITION , MSG) _Static_assert( CONDITION , MSG )
56 # if !defined( CFG_LEVEL_ASSERTIONS )
57 # error CFG_LEVEL_ASSERTIONS is not defined in oc_debug_cfg.h
58 # elif CFG_LEVEL_ASSERTIONS == LEVEL(0)
59 # define oC_ASSERT( CONDITION ) if ( !(CONDITION) ) while(1)
60 # elif CFG_LEVEL_ASSERTIONS == LEVEL(1)
61 # include <oc_debug.h>
62 # define oC_ASSERT( CONDITION ) if ( !(CONDITION) ) oC_Debug(__FILE__":%d - Assertion failed: " #CONDITION , __LINE__ )
63 # else
64 # error CFG_LEVEL_ASSERTIONS is not correctly defined in oc_debug_cfg.h (maximum level is LEVEL(1))
65 # endif
66 
67 #elif CFG_ENABLE_ASSERTIONS == OFF
68 # define oC_ASSERT( CONDITION )
69 # define oC_STATIC_ASSERT( CONDITION , MSG)
70 #else
71 # error CFG_ENABLE_ASSERTIONS is not correctly defined in oc_debug_cfg.h (possible only ON / OFF values)
72 #endif
73 
74 #if !defined(CFG_ENABLE_IMPLEMENT_FAILURES)
75 # error CFG_ENABLE_IMPLEMENT_FAILURES is not defined in oc_debug_cfg.h
76 #elif CFG_ENABLE_IMPLEMENT_FAILURES == ON
77 # define oC_IMPLEMENT_FAILURE() while(1)
78 #elif CFG_ENABLE_IMPLEMENT_FAILURES == OFF
79 # define oC_IMPLEMENT_FAILURE()
80 #else
81 # error CFG_ENABLE_IMPLEMENT_FAILURES is not correctly defined in oc_debug_cfg.h (possible only ON / OFF values)
82 #endif
83 
84 #if !defined(CFG_ENABLE_COMPILE_ASSERTS)
85 # error CFG_ENABLE_COMPILE_ASSERTS is not defined in oc_debug_cfg.h
86 #elif CFG_ENABLE_COMPILE_ASSERTS == ON
87 # define oC_COMPILE_ASSERT( CONDITION , MSG ) _Static_assert(CONDITION , MSG)
88 #elif CFG_ENABLE_COMPILE_ASSERTS == OFF
89 # define oC_COMPILE_ASSERT( CONDITION )
90 #else
91 # error CFG_ENABLE_COMPILE_ASSERTS is not correctly defined in oc_debug_cfg.h (only ON / OFF values are possible)
92 #endif
93 
94 #endif /* SYSTEM_CORE_OC_ASSERT_H_ */
FILE__DESCRIPTION
The file contains definitions for the compiler, that helps to manage errors, etc. ...
Configuration of the debug functions.