Re: [PATCH 1/2] parse-options: introduce die_for_required_opt()
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jun 4, 2026, 08:10 UTC
- Message-ID
- <CAP8UFD39G1CQXyxPVEmQSrdnHZ9BxPCH=QLmYBEFMcCnL8hjgg@mail.gmail.com>
- In-Reply-To
- <20260603111044.39116-2-r.siddharth.shrimali@gmail.com>
On Wed, Jun 3, 2026 at 1:11 PM Siddharth Shrimali <r.siddharth.shrimali@gmail.com> wrote:
Show 9 quoted lines
>
> Introduce a new helper function die_for_required_opt() to check if a
> given option is present without its required prerequisite option.
>
> This provides a centralized API for handling simple option dependencies
> (i.e., X requires Y), matching the style of the existing mutual-exclusion
> helpers like die_for_incompatible_opt{2,3,4}().
>
> Suggested-by: Christian Couder <christian.couder@gmail.com>In general it's simpler for GSoC contributors to mention all your mentors in "Mentored-by: ..." trailers in all your patches during your GSoC, rather than keeping track of who helped you with each patch.
Show 5 quoted lines
> Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com> > --- > parse-options.c | 7 +++++++ > parse-options.h | 3 +++ > 2 files changed, 10 insertions(+)
I think it would be nice if the new function could actually be used in a single *.c file. It would be even nicer if there was an existing test that already checked that the dependent option needs the required option. This way we would also already ensure that the new helper is working properly.