@@ -87,38 +87,17 @@ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...);
* ODP default LOG macro.
*/
#define ODP_LOG(level, fmt, ...) \
-do { \
- switch (level) { \
- case ODP_LOG_ERR: \
- odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \
- __LINE__, __func__, ##__VA_ARGS__); \
- break; \
- case ODP_LOG_DBG: \
- if (ODP_DEBUG_PRINT == 1) \
- odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \
- __LINE__, __func__, ##__VA_ARGS__); \
- break; \
- case ODP_LOG_ABORT: \
- odp_override_log(level, "%s:%d:%s(): " fmt, __FILE__, \
- __LINE__, __func__, ##__VA_ARGS__); \
- abort(); \
- break; \
- case ODP_LOG_UNIMPLEMENTED: \
- odp_override_log(level, \
- "%s:%d:The function %s() is not implemented\n" \
- fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
- break; \
- default: \
- odp_override_log(level, "Unknown LOG level"); \
- break;\
- } \
-} while (0)
+ odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \
+ __LINE__, __func__, ##__VA_ARGS__)
/**
* Log debug message if DEBUG flag is set.
*/
#define ODP_DBG(fmt, ...) \
- ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__)
+ do { \
+ if (ODP_DEBUG_PRINT == 1) \
+ ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\
+ } while (0)
/**
* Log error message.
@@ -25,8 +25,10 @@ extern "C" {
/**
* This macro is used to indicate when a given function is not implemented
*/
-#define ODP_UNIMPLEMENTED(fmt, ...) \
- ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__)
+#define ODP_UNIMPLEMENTED() \
+ odp_override_log(ODP_LOG_UNIMPLEMENTED, \
+ "%s:%d:The function %s() is not implemented\n" \
+ __FILE__, __LINE__, __func__)
#ifdef __cplusplus
}
@@ -101,5 +101,8 @@ ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level,
r = vfprintf(stdout, fmt, args);
va_end(args);
+ if (level == ODP_LOG_ABORT)
+ abort();
+
return r;
}
Move additional functionality out of ODP_LOG. Move abort() call to odp_override_log(), so application will be able to implement custom abort handling. Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> --- platform/linux-generic/include/api/odp_debug.h | 33 ++++---------------- .../linux-generic/include/odp_debug_internal.h | 6 ++-- platform/linux-generic/odp_init.c | 3 ++ 3 files changed, 13 insertions(+), 29 deletions(-)