debug.h
Go to the documentation of this file.
1 #ifndef __DEBUG_H__
2 #define __DEBUG_H__
3 
4 //*****************************************************************************
5 //
6 // Prototype for the function that is called when an invalid argument is passed
7 // to an API. This is only used when doing a DEBUG build.
8 //
9 //*****************************************************************************
10 extern void __error__(char *pcFilename, unsigned long line);
11 
12 //*****************************************************************************
13 //
14 // The ASSERT macro, which does the actual assertion checking. Typically, this
15 // will be for procedure arguments.
16 //
17 //*****************************************************************************
18 #ifdef DEBUG
19 #define ASSERT(expr) { \
20  if(!(expr)) \
21  { \
22  __error__(__FILE__, __LINE__); \
23  } \
24  }
25 #else
26 #define ASSERT(expr)
27 #endif
28 
29 #ifdef DEBUG
30 #define assert(expr) { \
31  if(!(expr)) \
32  { \
33  __error__(__FILE__, __LINE__); \
34  } \
35  }
36 #else
37 #define assert(expr)
38 #endif
39 
40 #endif // __DEBUG_H__
void __error__(char *pcFilename, unsigned long line)

Copyright 2016, Texas Instruments Incorporated