Firmware
|
A set of useful macros for enhanced runtime and compile time error detection and warning suppression. More...
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | arraySize(a) (sizeof((a))/sizeof((a[0]))) |
#define | _FILE_NAME_ __FILE__ |
#define | INVALID_CASE(c) printf("Invalid Case %d, %s:%d",(c),__BASE_FILE__,__LINE__) /* todo use PANIC */ |
#define | UNUSED(var) (void)(var) |
#define | _CAT(a, b) a ## b |
#define | CAT(a, b) _CAT(a, b) |
#define | FREEZE_STR(s) #s |
#define | STRINGIFY(s) FREEZE_STR(s) |
#define | CCASSERT(predicate) _x_CCASSERT_LINE(predicate, __LINE__) |
#define | _x_CCASSERT_LINE(predicate, line) typedef char CAT(constraint_violated_on_line_,line)[2*((predicate)!=0)-1] __attribute__ ((unused)) ; |
#define | DO_PRAGMA(x) _Pragma (#x) |
#define | TODO(x) DO_PRAGMA(message ("TODO - " #x)) |
A set of useful macros for enhanced runtime and compile time error detection and warning suppression.
Define NO_BLOAT to reduce bloat from file name inclusion.
The arraySize() will compute the size of an array regardless it's type
INVALID_CASE(c) should be used is case statements to ferret out unintended behavior
UNUSED(var) will suppress compile time warnings of unused variables
CCASSERT(predicate) Will generate a compile time error it the predicate is false