openocd: don't test 'debug_level' directly
Use the macro 'LOG_LEVEL_IS()' to test 'debug_level'. While there, use the macro 'LOG_LVL_*' in place of the numeric value. Skip all riscv code, as it is going to be updated soon from the external fork. Change-Id: Icad7e879e040d3b9cf1cc004c433f28725017493 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9070 Tested-by: jenkins
This commit is contained in:
@@ -69,7 +69,7 @@ extern struct command_context *global_cmd_ctx;
|
||||
* Do nothing in case we are not at debug level 3 */
|
||||
static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv)
|
||||
{
|
||||
if (debug_level < LOG_LVL_DEBUG)
|
||||
if (!LOG_LEVEL_IS(LOG_LVL_DEBUG))
|
||||
return;
|
||||
|
||||
char *dbg = alloc_printf("command -");
|
||||
|
||||
@@ -113,7 +113,7 @@ static void log_puts(enum log_levels level,
|
||||
if (f)
|
||||
file = f + 1;
|
||||
|
||||
if (debug_level >= LOG_LVL_DEBUG) {
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||
/* print with count and time information */
|
||||
int64_t t = timeval_ms() - start;
|
||||
#ifdef _DEBUG_FREE_SPACE_
|
||||
|
||||
@@ -101,7 +101,7 @@ extern int debug_level;
|
||||
|
||||
#define LOG_DEBUG_IO(expr ...) \
|
||||
do { \
|
||||
if (debug_level >= LOG_LVL_DEBUG_IO) \
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \
|
||||
log_printf_lf(LOG_LVL_DEBUG, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
expr); \
|
||||
@@ -109,7 +109,7 @@ extern int debug_level;
|
||||
|
||||
#define LOG_DEBUG(expr ...) \
|
||||
do { \
|
||||
if (debug_level >= LOG_LVL_DEBUG) \
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) \
|
||||
log_printf_lf(LOG_LVL_DEBUG, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
expr); \
|
||||
@@ -118,7 +118,7 @@ extern int debug_level;
|
||||
#define LOG_CUSTOM_LEVEL(level, expr ...) \
|
||||
do { \
|
||||
enum log_levels _level = level; \
|
||||
if (debug_level >= _level) \
|
||||
if (LOG_LEVEL_IS(_level)) \
|
||||
log_printf_lf(_level, \
|
||||
__FILE__, __LINE__, __func__, \
|
||||
expr); \
|
||||
|
||||
Reference in New Issue
Block a user