9049dfdb68
Wrap the console logging macros with do { ... } while (0) so they act more like functions. Add missing semicolons to calls of these macros. TEST=compile only Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com> Change-Id: I721a4a93636201fa2394ec62cbe4e743cd3ad9d0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68336 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
31 lines
853 B
C
31 lines
853 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef _CBFSTOOL_CONSOLE_H_
|
|
#define _CBFSTOOL_CONSOLE_H_
|
|
|
|
#include <stdio.h>
|
|
#include <commonlib/loglevel.h>
|
|
|
|
/* Message output */
|
|
extern int verbose;
|
|
#define ERROR(...) fprintf(stderr, "E: " __VA_ARGS__)
|
|
#define WARN(...) fprintf(stderr, "W: " __VA_ARGS__)
|
|
#define LOG(...) fprintf(stderr, __VA_ARGS__)
|
|
#define INFO(...) do { if (verbose > 0) fprintf(stderr, "INFO: " __VA_ARGS__); } while (0)
|
|
#define DEBUG(...) do { if (verbose > 1) fprintf(stderr, "DEBUG: " __VA_ARGS__); } while (0)
|
|
|
|
|
|
#define printk(lvl, ...) \
|
|
do { \
|
|
if ((lvl) <= BIOS_ERR) { \
|
|
ERROR(__VA_ARGS__); \
|
|
} else if ((lvl) <= BIOS_NOTICE) { \
|
|
WARN(__VA_ARGS__); \
|
|
} else if ((lvl) <= BIOS_INFO) { \
|
|
INFO(__VA_ARGS__); \
|
|
} else if ((lvl) <= BIOS_DEBUG) { \
|
|
DEBUG(__VA_ARGS__); \
|
|
} \
|
|
} while (0)
|
|
|
|
#endif
|