Revision 83e58975 core/inc/aos_debug.h

View differences:

core/inc/aos_debug.h
64 64
 *
65 65
 * @param[in] c The condition to be verified to be true.
66 66
 */
67
#define aosDbgCheck(c) {                                                      \
67
#define aosDbgCheck(c) do {                                                   \
68 68
  if (!(c)) {                                                                 \
69 69
    aosDbgPrintf("%s(%u): aosDbgCheck failed", __FILE__, __LINE__);           \
70 70
    chThdExit(MSG_RESET);                                                     \
71 71
  }                                                                           \
72
}
72
} while (false)
73 73

  
74 74
/**
75 75
 * @brief   Condition assertion.
......
77 77
 *
78 78
 * @param[in] c The condition to be verified to be true.
79 79
 */
80
#define aosDbgAssert(c) {                                                     \
80
#define aosDbgAssert(c) do {                                                  \
81 81
  if (!(c)) {                                                                 \
82 82
    aosDbgPrintf("%s(%u): aosDbgAssert failed", __FILE__, __LINE__);          \
83 83
    chThdExit(MSG_RESET);                                                     \
84 84
  }                                                                           \
85
}
85
} while (false)
86 86

  
87 87
/**
88 88
 * @brief   Condition assertion.
......
91 91
 * @param[in] c The condition to be verified to be true.
92 92
 * @param[in] r A custom remark string.
93 93
 */
94
#define aosDbgAssertMsg(c, fmt, ...) {                                        \
94
#define aosDbgAssertMsg(c, fmt, ...) do {                                     \
95 95
  if (!(c)) {                                                                 \
96 96
    aosDbgPrintf(fmt, ##__VA_ARGS__);                                         \
97 97
    chThdExit(MSG_RESET);                                                     \
98 98
  }                                                                           \
99
}
99
} while (false)
100 100

  
101 101
#else /* (AMIROOS_CFG_DBG == true) */
102 102

  
103
#define aosDbgPrintf(fmt, ...) {                          \
104
  (void)(fmt);                                            \
105
}
103
#define aosDbgPrintf(fmt, ...)                                                \
104
  (void)(fmt)
106 105

  
107
#define aosDbgCheck(c) {                                  \
108
  (void)(c);                                              \
109
  }
106
#define aosDbgCheck(c)                                                        \
107
  (void)(c)
110 108

  
111
#define aosDbgAssert(c) {                                 \
112
  (void)(c);                                              \
113
}
109
#define aosDbgAssert(c)                                                       \
110
  (void)(c)
114 111

  
115
#define aosDbgAssertMsg(c, r) {                           \
116
  (void)(c);                                              \
117
  (void)(r);                                              \
118
}
112
#define aosDbgAssertMsg(c, r)                                                 \
113
  (void)(c);                                                                  \
114
  (void)(r)
119 115

  
120 116
#endif /* (AMIROOS_CFG_DBG == true) */
121 117

  

Also available in: Unified diff