From c832f4c55c07a8ebfc918724038671ecc4c0eefb Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 27 Apr 2015 22:28:39 -0700 Subject: [PATCH] Small fixes for debug macros Fixed print format for __LINE__ to %d Fixed if/else that breaks with the debug macro expansion. The if/else needs to use braces to allow macro expansion. Signed-off-by: Mark Charlebois --- src/platforms/posix/px4_layer/px4_posix_tasks.cpp | 6 ++++-- src/platforms/posix/px4_layer/work_thread.c | 3 --- src/platforms/px4_debug.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp index 5b8f4ea666..54fc555e0b 100644 --- a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp @@ -227,10 +227,12 @@ void px4_task_exit(int ret) break; } } - if (i>=PX4_MAX_TASKS) + if (i>=PX4_MAX_TASKS) { PX4_ERR("px4_task_exit: self task not found!"); - else + } + else { PX4_DBG("px4_task_exit: %s", taskmap[i].name.c_str()); + } pthread_exit((void *)(unsigned long)ret); } diff --git a/src/platforms/posix/px4_layer/work_thread.c b/src/platforms/posix/px4_layer/work_thread.c index d42b21fafd..57e6e327f1 100644 --- a/src/platforms/posix/px4_layer/work_thread.c +++ b/src/platforms/posix/px4_layer/work_thread.c @@ -85,9 +85,6 @@ struct wqueue_s g_work[NWORKERS]; * ****************************************************************************/ -#define USEC_TO_TICKS(x) (uint32_t)((x)/1000ull) -#define TICKS_TO_USEC(x) ((x)*1000ull) - static void work_process(FAR struct wqueue_s *wqueue) { volatile FAR struct work_s *work; diff --git a/src/platforms/px4_debug.h b/src/platforms/px4_debug.h index 0f5b5ec34c..2776ad5337 100644 --- a/src/platforms/px4_debug.h +++ b/src/platforms/px4_debug.h @@ -44,7 +44,7 @@ #define PX4_DBG(...) #define PX4_INFO(...) warnx(__VA_ARGS__) #define PX4_WARN(...) warnx(__VA_ARGS__) -#define PX4_ERR(...) { warnx("ERROR %s %s:", __FILE__, __LINE__); warnx(__VA_ARGS__); } +#define PX4_ERR(...) { warnx("ERROR file %s line %d:", __FILE__, __LINE__); warnx(__VA_ARGS__); } #elif defined(__PX4_ROS)