reducing code duplication

This commit is contained in:
rusefillc 2021-02-05 23:45:47 -05:00
parent 6915852a7a
commit 6a2473ccc1
5 changed files with 15 additions and 48 deletions

View File

@ -748,16 +748,6 @@ extern "C"
void chDbgPanic3(const char *msg, const char * file, int line);
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(remark); \
} \
} \
} while (false)
#undef ENABLE_PERF_TRACE
#define ENABLE_PERF_TRACE FALSE
#define TRACE_BUFFER_LENGTH 1

View File

@ -742,24 +742,11 @@
/*===========================================================================*/
#ifndef __ASSEMBLER__
#ifdef __cplusplus
extern "C"
#endif
void chDbgPanic3(const char *msg, const char * file, int line);
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(remark); \
} \
} \
} while (false)
#ifdef __cplusplus
extern "C"
#endif // __cplusplus
void chDbgPanic3(const char *msg, const char * file, int line);
#endif // __ASSEMBLER__
#undef ENABLE_PERF_TRACE
#define ENABLE_PERF_TRACE FALSE

View File

@ -122,4 +122,14 @@ extern "C" {
#define hasOsPanicError() (FALSE)
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
firmwareError(OBD_PCM_Processor_Fault, "chDbg %s", remark); \
chSysHalt(remark); \
} \
} \
} while (false)
#endif /* CONFIG_CHCONF_COMMON_H_ */

View File

@ -759,16 +759,6 @@ void chDbgPanic3(const char *msg, const char * file, int line);
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
firmwareError(OBD_PCM_Processor_Fault, "chDbg %s", remark); \
chSysHalt(remark); \
} \
} \
} while (false)
#endif /* CHCONF_H */
/** @} */

View File

@ -761,16 +761,6 @@ void chDbgPanic3(const char *msg, const char * file, int line);
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
firmwareError(OBD_PCM_Processor_Fault, "chDbg %s", remark); \
chSysHalt(remark); \
} \
} \
} while (false)
#endif /* CHCONF_H */
/** @} */