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 <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-27 22:28:39 -07:00
parent 0bf690d36a
commit c832f4c55c
3 changed files with 5 additions and 6 deletions
@@ -227,10 +227,12 @@ void px4_task_exit(int ret)
break; break;
} }
} }
if (i>=PX4_MAX_TASKS) if (i>=PX4_MAX_TASKS) {
PX4_ERR("px4_task_exit: self task not found!"); PX4_ERR("px4_task_exit: self task not found!");
else }
else {
PX4_DBG("px4_task_exit: %s", taskmap[i].name.c_str()); PX4_DBG("px4_task_exit: %s", taskmap[i].name.c_str());
}
pthread_exit((void *)(unsigned long)ret); pthread_exit((void *)(unsigned long)ret);
} }
@@ -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) static void work_process(FAR struct wqueue_s *wqueue)
{ {
volatile FAR struct work_s *work; volatile FAR struct work_s *work;
+1 -1
View File
@@ -44,7 +44,7 @@
#define PX4_DBG(...) #define PX4_DBG(...)
#define PX4_INFO(...) warnx(__VA_ARGS__) #define PX4_INFO(...) warnx(__VA_ARGS__)
#define PX4_WARN(...) 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) #elif defined(__PX4_ROS)