From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7677 invoked by alias); 10 Jan 2012 22:09:27 -0000 Received: (qmail 7663 invoked by uid 22791); 10 Jan 2012 22:09:26 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Jan 2012 22:09:08 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0AM984F000410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Jan 2012 17:09:08 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0AM97in028879; Tue, 10 Jan 2012 17:09:07 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0AM96ax017254; Tue, 10 Jan 2012 17:09:06 -0500 From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: RFC: enum pretty-printing support References: <20120110211713.GA1550@host2.jankratochvil.net> Date: Tue, 10 Jan 2012 22:19:00 -0000 In-Reply-To: (Tom Tromey's message of "Tue, 10 Jan 2012 14:49:28 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2012-01/txt/msg00327.txt.bz2 Jan> There is the obvious question this may work automatically if all Jan> the values of enum type are in the form 2^n and fall back to the Jan> GDB default way otherwise. Tom> Yeah, that might be nicer. Tom> I will look into it. I think the basic code is pretty easy to write. I have it written, but I can't test it until tomorrow. I do wonder whether we still want the Python code. My C implementation works by checking whether the enum values are disjoint. However, it is not uncommon to see things like: enum flags { ONE = 1, TWO = 2, HIGHEST = TWO }; or enum flags { ONE = 1, TWO = 2, ALL = ONE | TWO }; ... but the Python code would acceptably handle both of these. This was ok for the Python approach because registration is explicit, not implicit; I think the C code has to be a bit more careful because it cannot readily be turned off. One idea is to have both. Tom