asserts (1245B)
1 /* vim: set syntax=cpp: */ 2 #ifndef __QUEX_INCLUDE_GUARD__ASSERTS 3 #define __QUEX_INCLUDE_GUARD__ASSERTS 4 5 #ifdef QUEX_OPTION_ASSERTS 6 # if ! defined (__QUEX_OPTION_PLAIN_C) 7 # include <cassert> 8 # else 9 # include <assert.h> 10 # endif 11 # define __quex_assert(X) assert(X) 12 # define __quex_assert_no_passage() do { QUEX_ERROR_EXIT("Illegal 'drop-into' other state"); } while ( 0 ) 13 # define __quex_assert_msg(X, Y) if( ! (X) ) do { QUEX_ERROR_EXIT(Y); } while ( 0 ) 14 # define __QUEX_IF_ASSERTS(EXPRESSION) EXPRESSION 15 # define QUEX_IF_ASSERTS_poison(BEGIN, END) \ 16 do { \ 17 if( END > BEGIN ) \ 18 __QUEX_STD_memset((uint8_t*)(BEGIN), (uint8_t)0xFF, \ 19 (size_t)((const uint8_t*)END - (const uint8_t*)BEGIN)); \ 20 } while(0) 21 #else 22 # define __quex_assert(X) /* no assert */ 23 # define __quex_assert_msg(X, Y) /* no assert, no message */ 24 # define __quex_assert_no_passage() /* no assert */ 25 # define __QUEX_IF_ASSERTS(EXPRESSION) /* empty */ 26 # define QUEX_IF_ASSERTS_poison(BEGIN, END) /* empty */ 27 #endif 28 29 #define __QUEX_INCLUDE_INDICATOR__ASSERTS 30 31 #endif /* __QUEX_INCLUDE_GUARD__ASSERTS */ 32