[PATCH] app/testpmd: fix dump command list for MSVC
Andre Muezerie
andremue at linux.microsoft.com
Fri Apr 11 02:05:06 CEST 2025
On Thu, Apr 10, 2025 at 06:02:36PM +0200, David Marchand wrote:
> Compiling with MSVC results in warnings like below:
>
> app/test-pmd/cmdline.c(9023): warning C5101: use of preprocessor
> directive in function-like macro argument list is undefined behavior
>
> Construct token list at runtime.
>
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
> Note: this is an alternative to
> https://patchwork.dpdk.org/project/dpdk/patch/1740414265-12217-6-git-send-email-andremue@linux.microsoft.com/
>
> ---
> app/test-pmd/cmdline.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index d10709f6bc..b4089d281b 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -9018,6 +9018,12 @@ static void cmd_dump_parsed(void *parsed_result,
>
> static cmdline_parse_token_string_t cmd_dump_dump =
> TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
> + "" /* defined at init */);
> +
> +static void
> +cmd_dump_init(void)
> +{
> + cmd_dump_dump.string_data.str =
> "dump_physmem#"
> "dump_memzone#"
> "dump_socket_mem#"
> @@ -9029,7 +9035,8 @@ static cmdline_parse_token_string_t cmd_dump_dump =
> #ifndef RTE_EXEC_ENV_WINDOWS
> "dump_trace#"
> #endif
> - "dump_log_types");
> + "dump_log_types";
> +}
>
> static cmdline_parse_inst_t cmd_dump = {
> .f = cmd_dump_parsed, /* function to call */
> @@ -13961,6 +13968,7 @@ init_cmdline(void)
> /* initialize non-constant commands */
> cmd_set_fwd_mode_init();
> cmd_set_fwd_retry_mode_init();
> + cmd_dump_init();
>
> count = 0;
> for (i = 0; builtin_ctx[i] != NULL; i++)
> --
> 2.49.0
Acked-by: Andre Muezerie <andremue at linux.microsoft.com>
More information about the dev
mailing list