mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #2442 from authmillenon/debug/enh/platform-ind-debugf
debug: Make DEBUGF more platform-independent
This commit is contained in:
commit
6dded1be19
@ -13,7 +13,7 @@
|
||||
* @file debug.h
|
||||
* @brief Debug-header
|
||||
*
|
||||
* @details If ENABLE_DEBUG is set, before this header is included,
|
||||
* @details If ENABLE_DEBUG is set, before this header is included,
|
||||
* ::DEBUG will print out to stdout, otherwise do nothing
|
||||
*
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
@ -70,12 +70,29 @@
|
||||
*/
|
||||
#if ENABLE_DEBUG
|
||||
#include "tcb.h"
|
||||
|
||||
/**
|
||||
* @def DEBUG_FUNC
|
||||
*
|
||||
* @brief Contains the function name if given compiler supports it.
|
||||
* Otherwise it is an empty string.
|
||||
*/
|
||||
# if defined(__cplusplus) && defined(__GNUC__)
|
||||
# define DEBUG_FUNC __PRETTY_FUNCTION__
|
||||
# elif __STDC_VERSION__ >= 199901L
|
||||
# define DEBUG_FUNC __func__
|
||||
# elif __GNUC__ >= 2
|
||||
# define DEBUG_FUNC __FUNCTION__
|
||||
# else
|
||||
# define DEBUG_FUNC ""
|
||||
# endif
|
||||
|
||||
#define DEBUG(...) DEBUG_PRINT(__VA_ARGS__)
|
||||
#define DEBUGF(...) \
|
||||
do { \
|
||||
DEBUG_PRINT("DEBUG(%s): %s:%d in %s: ", \
|
||||
sched_active_thread ? sched_active_thread->name : "NO THREAD", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
__FILE__, __LINE__, DEBUG_FUNC); \
|
||||
DEBUG_PRINT(__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user