Skip to content

Commit

Permalink
pw_log_zephyr: Make shell printf macros safe for use in if/else blocks
Browse files Browse the repository at this point in the history
Usage of shell printf macros with tokenization within if/else
blocks that don't use braces causes compile error.

Change-Id: Ifde18a3ab1dcd98257250b11b0588d06395d6500
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/232031
Lint: Lint 🤖 <[email protected]>
Reviewed-by: Armando Montanez <[email protected]>
Commit-Queue: Al Semjonovs <[email protected]>
  • Loading branch information
asemjonovs authored and CQ Bot Account committed Aug 26, 2024
1 parent aa6edfa commit e41b65b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pw_log_zephyr/zephyr_public_overrides/zephyr_custom_shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,32 @@
#undef shell_error

#define shell_fprintf(sh, color, fmt, ...) \
{ \
do { \
(void)(sh); \
(void)(color); \
PW_LOG_INFO(fmt, ##__VA_ARGS__); \
}
} while (0)

#define shell_info(_sh, _ft, ...) \
{ \
do { \
(void)(_sh); \
PW_LOG_INFO(_ft, ##__VA_ARGS__); \
}
} while (0)

#define shell_print(_sh, _ft, ...) \
{ \
do { \
(void)(_sh); \
PW_LOG_INFO(_ft, ##__VA_ARGS__); \
}
} while (0)

#define shell_warn(_sh, _ft, ...) \
{ \
do { \
(void)(_sh); \
PW_LOG_WARN(_ft, ##__VA_ARGS__); \
}
} while (0)

#define shell_error(_sh, _ft, ...) \
{ \
do { \
(void)(_sh); \
PW_LOG_ERROR(_ft, ##__VA_ARGS__); \
}
} while (0)

0 comments on commit e41b65b

Please sign in to comment.