This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] GDB/MI: fix and simplify mi_valid_noargs utility function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]