Assertions
[Utility Library]

Collaboration diagram for Assertions:

Defines

#define abort()   do { } while (ASSERT_ENABLED)
 Abort execution of the program.
#define assert(condition)
 Assert that condition is true at run time.
#define unhandled_case(value)
 Assert that the case value will never need to be handled.
#define build_assert(condition)
 Assert that condition is true at build time.

Detailed Description

This module provides support for run-time and build-time assertions, to help testing and debugging.


Define Documentation

 
#define abort (  )     do { } while (ASSERT_ENABLED)

Abort execution of the program.

When some part of the program finds itself in an impossible situation, it may call this macro to halt execution and thus facilitiate debugging.

If CONFIG_ASSERT is not set, this macro does nothing.

Definition at line 68 of file assert.h.

#define assert ( condition   ) 
#define build_assert ( condition   ) 
Value:
do {                                                            \
                if (!(condition))                                       \
                        build_assert_failed();                          \
        } while (0)

Assert that condition is true at build time.

If condition is false, the compilation will abort with an error message.

Definition at line 118 of file assert.h.

Referenced by udc_lib_standard_request().

#define unhandled_case ( value   ) 
Value:
do {                                                            \
                if (ASSERT_ENABLED) {                                   \
                        dbg_printf_level(DEBUG_ASSERT,                  \
                                "%s:%d: Unhandled case value %d\n",     \
                                __FILE__, __LINE__, (value));           \
                        abort();                                        \
                }                                                       \
        } while (0)

Assert that the case value will never need to be handled.

If the code expanded from this macro is ever reached, output a diagnostic message and hang.

If CONFIG_ASSERT is not set, this macro does nothing.

Definition at line 100 of file assert.h.

Referenced by gpio_get_value().

Generated on Thu Apr 29 14:10:34 2010 for xplain-bc by  doxygen 1.6.3