PX4 Firmware
PX4 Autopilot Software http://px4.io
|
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
Definition in file px4_macros.h.
#define _CAT | ( | a, | |
b | |||
) | a ## b |
Definition at line 84 of file px4_macros.h.
#define _FILE_NAME_ __FILE__ |
Definition at line 68 of file px4_macros.h.
#define _x_CCASSERT_LINE | ( | predicate, | |
line | |||
) | typedef char CAT(constraint_violated_on_line_,line)[2*((predicate)!=0)-1] __attribute__ ((unused)) ; |
Definition at line 103 of file px4_macros.h.
#define arraySize | ( | a | ) | (sizeof((a))/sizeof((a[0]))) |
Definition at line 61 of file px4_macros.h.
#define CAT | ( | a, | |
b | |||
) | _CAT(a, b) |
Definition at line 86 of file px4_macros.h.
#define CCASSERT | ( | predicate | ) | _x_CCASSERT_LINE(predicate, __LINE__) |
Definition at line 101 of file px4_macros.h.
#define DO_PRAGMA | ( | x | ) | _Pragma (#x) |
Definition at line 109 of file px4_macros.h.
#define FREEZE_STR | ( | s | ) | #s |
Definition at line 90 of file px4_macros.h.
#define INVALID_CASE | ( | c | ) | printf("Invalid Case %d, %s:%d",(c),__BASE_FILE__,__LINE__) /* todo use PANIC */ |
Definition at line 75 of file px4_macros.h.
#define STRINGIFY | ( | s | ) | FREEZE_STR(s) |
Definition at line 94 of file px4_macros.h.
Referenced by MavlinkReceiver::handle_message_statustext(), and px4_build_uri().
#define TODO | ( | x | ) | DO_PRAGMA(message ("TODO - " #x)) |
Definition at line 113 of file px4_macros.h.
#define UNUSED | ( | var | ) | (void)(var) |
Definition at line 79 of file px4_macros.h.