From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118347 invoked by alias); 5 Feb 2016 19:58:27 -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 118334 invoked by uid 89); 5 Feb 2016 19:58:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=letter, H*UA:Webmail X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Feb 2016 19:58:26 +0000 Received: by simark.ca (Postfix, from userid 112) id 21D6C1E171; Fri, 5 Feb 2016 14:58:24 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 9ABE91E16D; Fri, 5 Feb 2016 14:58:23 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Feb 2016 19:58:00 -0000 From: Simon Marchi To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add printf format specifier for printing enumerator In-Reply-To: <8337t7us3k.fsf@gnu.org> References: <1454681876-17628-1-git-send-email-simon.marchi@polymtl.ca> <8337t7us3k.fsf@gnu.org> Message-ID: <5c55e304fe3d8cd610d663a103b42190@simark.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.1.3 X-SW-Source: 2016-02/txt/msg00156.txt.bz2 On 2016-02-05 09:52, Eli Zaretskii wrote: >> From: Simon Marchi >> Cc: Simon Marchi >> Date: Fri, 5 Feb 2016 09:17:56 -0500 >> >> This patch adds a format specifier to gdb's printf command, to print >> the >> enumerator (the text label) of an enum value. It's currently possible >> to display that value using the print command, but not as part of a >> formatted string. >> >> For example, assuming we have the following enum definition: >> >> enum NodeType { >> ... >> NODE_INTEGER, >> ... >> }; >> >> enum NodeType node = NODE_INTEGER; >> >> we can display it this way: >> >> (gdb) printf "Visiting node of type %q\n", node >> Visiting node of type NODE_INTEGER >> >> All the letters of "enum" are already used as format specifiers. > > What about upper-case letters? > >> +@code{printf} supports the @samp{q} conversion letter to print the >> textual >> +label (enumerator) of a C enumeration value. > > This sentence will look awkward because it starts with a lower-case > letter. How about starting with "Also, "? > > I think an example here will be good, as the text does not make it > crystal clear what will be printed. > > Other than that, the documentation parts look good to me, thanks. Thanks for the doc review. The code will probably change a lot, so the doc will as well. I'll keep your comments in mind when I have to re-do it. Simon