UPSTREAM: src/include: Add do { } while(0) around macros
Fix the following error detected by checkpatch.py:
ERROR: Macros with multiple statements should be enclosed in a do - while loop
False positives are generated when assembly code is used in a macro. An
example is:
ERROR: Macros with multiple statements should be enclosed in a do - while loop
+#define post_code(value) \
+ movb $value, %al; \
+ outb %al, $CONFIG_POST_IO_PORT
False positives are also generated for linker script include files. An
example is:
ERROR: Macros with multiple statements should be enclosed in a do - while loop
+#define SET_COUNTER(name, addr) \
+ _ = ASSERT(. <= addr, STR(name overlaps the previous region!));
\
+ . = addr;
False positives are also generated for attribute macros. An example is:
ERROR: Macros with multiple statements should be enclosed in a do - while loop
+#define DISABLE_TRACE_ON_FUNCTION __attribute__
((no_instrument_function));
TEST=Build and run on Galileo Gen2
Change-Id: Ie8ee87e4f64e1259d085ad562c7ea3e5c281a0a7
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: bb4ae07417
Original-Change-Id: I88abf96579e906f6962d558a3d09907f07d00b1c
Original-Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Original-Reviewed-on: https://review.coreboot.org/18644
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/452475
This commit is contained in:
parent
74c8d8d102
commit
cbc7446bc1
1 changed files with 9 additions and 5 deletions
|
|
@ -124,8 +124,10 @@ struct boot_state_callback {
|
|||
#if IS_ENABLED(CONFIG_DEBUG_BOOT_STATE)
|
||||
#define BOOT_STATE_CALLBACK_LOC __FILE__ ":" STRINGIFY(__LINE__)
|
||||
#define BOOT_STATE_CALLBACK_INIT_DEBUG .location = BOOT_STATE_CALLBACK_LOC,
|
||||
#define INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_) \
|
||||
bscb_->location = BOOT_STATE_CALLBACK_LOC;
|
||||
#define INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_) \
|
||||
do { \
|
||||
bscb_->location = BOOT_STATE_CALLBACK_LOC; \
|
||||
} while (0)
|
||||
#else
|
||||
#define BOOT_STATE_CALLBACK_INIT_DEBUG
|
||||
#define INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_)
|
||||
|
|
@ -144,9 +146,11 @@ struct boot_state_callback {
|
|||
|
||||
/* Initialize an allocated boot_state_callback. */
|
||||
#define INIT_BOOT_STATE_CALLBACK(bscb_, func_, arg_) \
|
||||
INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_) \
|
||||
bscb_->callback = func_; \
|
||||
bscb_->arg = arg_
|
||||
do { \
|
||||
INIT_BOOT_STATE_CALLBACK_DEBUG(bscb_) \
|
||||
bscb_->callback = func_; \
|
||||
bscb_->arg = arg_ \
|
||||
} while(0)
|
||||
|
||||
/* The following 2 functions schedule a callback to be called on entry/exit
|
||||
* to a given state. Note that there are no ordering guarantees between the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue