This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/4] GDB/MI: fix and simplify mi_valid_noargs utility function
- From: Pedro Alves <palves at redhat dot com>
- To: Cleber Rosa <crosa at redhat dot com>, gdb-patches at sourceware dot org
- Cc: areis at redhat dot com
- Date: Wed, 21 Oct 2015 11:39:34 +0100
- Subject: Re: [PATCH 2/4] GDB/MI: fix and simplify mi_valid_noargs utility function
- Authentication-results: sourceware.org; auth=none
- References: <1444045617-14526-1-git-send-email-crosa at redhat dot com> <1444045617-14526-3-git-send-email-crosa at redhat dot com>
On 10/05/2015 12:46 PM, Cleber Rosa wrote:
...
> If the command should take no arguments, then it should be OK to just
> check the given argument count.
...
>
> diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
> index 0a07a39..574ccd2 100644
> --- a/gdb/mi/mi-getopt.c
> +++ b/gdb/mi/mi-getopt.c
> @@ -95,18 +95,14 @@ mi_getopt_allow_unknown (const char *prefix, int argc, char **argv,
> return mi_getopt_1 (prefix, argc, argv, opts, oind, oarg, 0);
> }
>
> +/* Tests if a command that takes no arguments was properly used.
> + Returns 1 if no options were given, otherwise return 0. */
This function is already documented in mi-getopt.h. Any comment
here should just be "/* See mi-getopt.h. */"
But the comment in mi-getopt.h says:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* mi_valid_noargs determines if ARGC/ARGV are a valid set of
parameters to satisfy an MI function that is not supposed to
recieve any arguments.
An MI function that should not receive arguments can still be
passed parameters after the special option '--' such as below.
Example: The MI function -exec-run takes no args.
However, the client may pass '-exec-run -- -a ...'
See PR-783
PREFIX is passed to mi_getopt for an error message.
This function Returns 1 if the parameter pair ARGC/ARGV are valid
for an MI function that takes no arguments. Otherwise, it returns 0
and the appropriate error message is displayed by mi_getopt. */
extern int mi_valid_noargs (const char *prefix, int argc, char **argv);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sounds like that conflicts with your patch?
Thanks,
Pedro Alves