[PATCH 16/21] lib/log: ensure code structure does not change
Stephen Hemminger
stephen at networkplumber.org
Wed Dec 11 04:13:21 CET 2024
On Tue, 10 Dec 2024 18:05:46 -0800
Andre Muezerie <andremue at linux.microsoft.com> wrote:
> Add "do { } while (0)" to macros used to remove logging calls, to
> ensure there's no code structure change when enabling/disabling
> logging.
>
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---
> lib/log/rte_log.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
> index 3735137150..6b00caab88 100644
> --- a/lib/log/rte_log.h
> +++ b/lib/log/rte_log.h
> @@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
> static_assert(!__builtin_strchr(fmt, '\n'), \
> "This log format string contains a \\n")
> #else
> -#define RTE_LOG_CHECK_NO_NEWLINE(...)
> +#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0)
> #endif
>
> /**
NAK
this is a change since static_assert() can be put anywhere like outside
of code blocks. This patch is not needed.
More information about the dev
mailing list