summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Reitberger <reitbergerfred@gmail.com>2022-10-12 10:47:39 -0400
committerFelix Held <felix-coreboot@felixheld.de>2022-10-13 17:07:02 +0000
commit9049dfdb6895739c3ea1b110e41548a9677194d4 (patch)
treebafc8ae15164af78711a7ec40d9dc22e354f33f6
parenta261502de5cef79e676c69824212950d27332081 (diff)
downloadcoreboot-9049dfdb6895739c3ea1b110e41548a9677194d4.tar.gz
coreboot-9049dfdb6895739c3ea1b110e41548a9677194d4.tar.bz2
coreboot-9049dfdb6895739c3ea1b110e41548a9677194d4.zip
util/cbfstool: Wrap logging macros in do - while
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>
-rw-r--r--util/cbfstool/cbfs-mkpayload.c2
-rw-r--r--util/cbfstool/cbfs_image.c2
-rw-r--r--util/cbfstool/console/console.h14
3 files changed, 9 insertions, 9 deletions
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index e1a3272ca979..63c81a325ded 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -433,7 +433,7 @@ int parse_fit_to_payload(const struct buffer *input, struct buffer *output,
*/
if (algo != CBFS_COMPRESS_NONE) {
ERROR("FIT images don't support whole-image compression,"
- " compress the kernel component instead!\n")
+ " compress the kernel component instead!\n");
return -1;
}
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 182b1855588e..683a96cac7c9 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -399,7 +399,7 @@ int cbfs_copy_instance(struct cbfs_image *image, struct buffer *dst)
cbfs_calculate_file_header_size("") - sizeof(int32_t);
if (last_entry_size < 0)
- WARN("No room to create the last entry!\n")
+ WARN("No room to create the last entry!\n");
else
cbfs_create_empty_entry(dst_entry, CBFS_TYPE_NULL,
last_entry_size, "");
diff --git a/util/cbfstool/console/console.h b/util/cbfstool/console/console.h
index 0595bea5ccda..b25589ad26c2 100644
--- a/util/cbfstool/console/console.h
+++ b/util/cbfstool/console/console.h
@@ -8,15 +8,15 @@
/* 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(...) { if (verbose > 0) fprintf(stderr, "INFO: " __VA_ARGS__); }
-#define DEBUG(...) { if (verbose > 1) fprintf(stderr, "DEBUG: " __VA_ARGS__); }
+#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) { \
@@ -26,6 +26,6 @@ extern int verbose;
} else if ((lvl) <= BIOS_DEBUG) { \
DEBUG(__VA_ARGS__); \
} \
- }
+ } while (0)
#endif