From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98237 invoked by alias); 21 Oct 2015 10:39:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 98226 invoked by uid 89); 21 Oct 2015 10:39:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 21 Oct 2015 10:39:38 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id D6DC42FE847 for ; Wed, 21 Oct 2015 10:39:36 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9LAdZ64032729; Wed, 21 Oct 2015 06:39:35 -0400 Message-ID: <56276B66.8000908@redhat.com> Date: Wed, 21 Oct 2015 11:19:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Cleber Rosa , gdb-patches@sourceware.org CC: areis@redhat.com Subject: Re: [PATCH 2/4] GDB/MI: fix and simplify mi_valid_noargs utility function References: <1444045617-14526-1-git-send-email-crosa@redhat.com> <1444045617-14526-3-git-send-email-crosa@redhat.com> In-Reply-To: <1444045617-14526-3-git-send-email-crosa@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-10/txt/msg00394.txt.bz2 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