From: fengchengwen <fengchengwen@huawei.com>
To: Bruce Richardson <bruce.richardson@intel.com>, <dev@dpdk.org>
Subject: Re: [PATCH 3/3] argparse: use enums to remove max-value defines in lists
Date: Wed, 4 Jun 2025 09:22:06 +0800 [thread overview]
Message-ID: <1454bed2-02e9-4d32-99b6-ca886113f62f@huawei.com> (raw)
In-Reply-To: <20250527092113.903910-4-bruce.richardson@intel.com>
It looks more clear and user-friendly for splitting the flag.
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2025/5/27 17:21, Bruce Richardson wrote:
> The use of lists of #defines with _MAX entries at the end causes issues
> for ABI compatibility as those MAX values often leak through to
> applications and can cause issues when changed.
>
> We can rework the code to increase type safety by splitting the flags
> field and using enums for each set of values explicitly:
>
> * One enum for whether an argument takes a parameter or not (or
> optionally takes one)
> * One enum for the type of the argument.
> * A separate flags field for any additional info - right now this is
> only to indicate an argument can appear more than once.
>
> The use of the MAX field is no longer necessary using the enums as we
> can use an inline function with a switch statement to check for valid
> values. Compilers like GCC will warn when an enum value is missing from
> the switch statement, easing future maintenance if enum values are
> added.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
next prev parent reply other threads:[~2025-06-04 1:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 9:21 [PATCH 0/3] argparse additions and rework Bruce Richardson
2025-05-27 9:21 ` [PATCH 1/3] argparse: add support for string and boolean args Bruce Richardson
2025-06-03 8:36 ` fengchengwen
2025-05-27 9:21 ` [PATCH 2/3] argparse: make argparse EAL-args compatible Bruce Richardson
2025-06-03 8:44 ` fengchengwen
2025-06-03 15:33 ` Bruce Richardson
2025-05-27 9:21 ` [PATCH 3/3] argparse: use enums to remove max-value defines in lists Bruce Richardson
2025-06-04 1:22 ` fengchengwen [this message]
2025-05-29 15:09 ` [PATCH 0/3] argparse additions and rework Bruce Richardson
2025-06-03 15:32 ` [PATCH v2 " Bruce Richardson
2025-06-03 15:32 ` [PATCH v2 1/3] argparse: add support for string and boolean args Bruce Richardson
2025-06-03 15:32 ` [PATCH v2 2/3] argparse: make argparse EAL-args compatible Bruce Richardson
2025-06-03 15:32 ` [PATCH v2 3/3] argparse: use enums to remove max-value defines in lists Bruce Richardson
2025-06-04 1:37 ` [PATCH v2 0/3] argparse additions and rework fengchengwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454bed2-02e9-4d32-99b6-ca886113f62f@huawei.com \
--to=fengchengwen@huawei.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).