From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44565 invoked by alias); 7 Aug 2015 22:57:04 -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 44555 invoked by uid 89); 7 Aug 2015 22:57:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 07 Aug 2015 22:57:01 +0000 Received: by wibxm9 with SMTP id xm9so82890096wib.1 for ; Fri, 07 Aug 2015 15:56:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=NoXHlYtzqoxX7OL7VHxY/zP/X31rub+MtVyiUIWfdY8=; b=OgFXzjRFXz+AUs/bHaseP9z8r91LinfmpNSyd/5xkNfduED1PljWizjz3KzKVbCzJr syDAZrGQlupan7u1ndtUr/e1mFPmvs9lqphNPTArxITeQ50Io7tF2+5jD7Bqlz1p8vo2 sj1cLOwJEdqIwG1Xmz9LlX7IfwirL8y8XfjfYY7+npqzmfPCmmpojaZzOKNMnt3S/yIY 6nadHJIqpCcNtyHJJ9Mk92MMq5LHZGpqKjqEPV8YcEA0m3qIqRuZw690zMZMFyV7fMtd xocUe1VCIgMOtZDNy0EXZ9YGT5Fei+r53MnqNEapt69Kmvo2wRSRIml8DNQlY6n2e4aW aeTg== X-Gm-Message-State: ALoCoQmFwaspLg+2EyyI+zIitsbzplMQYBJpMlfd3Hmr7xCMe53fL3WUa2DKTHh6dvGF3egyOfwa X-Received: by 10.180.8.234 with SMTP id u10mr1108899wia.4.1438988217671; Fri, 07 Aug 2015 15:56:57 -0700 (PDT) Received: from localhost ([185.4.200.2]) by smtp.gmail.com with ESMTPSA id uo6sm16724440wjc.1.2015.08.07.15.56.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2015 15:56:56 -0700 (PDT) Date: Fri, 07 Aug 2015 22:57:00 -0000 From: Andrew Burgess To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 00/19] New completer API Message-ID: <20150807225655.GA2986@embecosm.com> References: <20150806191404.32159.50755.stgit@valrhona.uglyboxes.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150806191404.32159.50755.stgit@valrhona.uglyboxes.com> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00207.txt.bz2 * Keith Seitz [2015-08-06 12:14:29 -0700]: > Currently completer functions are not required to implement completion- > limiting. These functions will compute all possible completions and then > rely on complete_line to limit the result. > > The main goal of this patchset is to require completer functions to > implement proper completion-limiting using maybe_add_completion. This > actually cleans up the completer API significantly and fixes at least one > serious bug (an assertion failure, gdb/17960). > > The new API requires all completions to be added to the completion > list using maybe_add_completion: I think that the above text is out of date w.r.t. the example below, in the above you talk about maybe_add_completion, but in the example below you use the add_completion wrapper. A small detail and unimportant detail; unless I'm missing something, in which case ... I'm confused! > void > my_completer_function (struct completer_data *cdata, > struct cmd_list_element *cmd, > const char *text, const char *word) > { > while (/* there are more completions to look for */) > { > char *match = xstrdup (a_completion_match); > > if (add_completion (cdata, match, text /* or NULL */, > word /* or NULL */)) > == ADD_COMPLETION_MAX_REACHED) > return; > } > } This pattern of calling add_completion and comparing to ADD_COMPLETION_MAX_REACHED is repeated throughout the patch set. I wonder, looking at add_completion, do users _care_ about the reason? Of all the possible return codes from add_completion, I think we can classify them as either "stop trying to add completions please", or "feel free to add more completions". Could the add_completion interface be simplified to simply return a bool, true if more completions can be added, false if not? Just a thought. Thanks, Andrew