From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124331 invoked by alias); 30 Oct 2015 14:52:41 -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 124318 invoked by uid 89); 30 Oct 2015 14:52:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 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; Fri, 30 Oct 2015 14:52:39 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id C7381367290; Fri, 30 Oct 2015 14:52:38 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9UEqbgY006305; Fri, 30 Oct 2015 10:52:38 -0400 Message-ID: <56338435.6080703@redhat.com> Date: Fri, 30 Oct 2015 17:39: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: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Type-safe wrapper for enum flags References: <1446144341-21267-1-git-send-email-palves@redhat.com> <56337B95.6070809@ericsson.com> In-Reply-To: <56337B95.6070809@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-10/txt/msg00763.txt.bz2 On 10/30/2015 02:15 PM, Simon Marchi wrote: > Could we also make c_string_type an enum flags type? Like so? There are > some ugly casts remaining in the branch, like > > str_type = (enum c_string_type) (str_type & ~C_CHAR); Good idea, indeed looks like we can. > --- a/gdb/c-lang.h > +++ b/gdb/c-lang.h > @@ -34,7 +34,7 @@ struct parser_state; > /* The various kinds of C string and character. Note that these > values are chosen so that they may be or'd together in certain > ways. */ > -enum c_string_type > +enum c_string_type_values > { > /* An ordinary string: "value". */ > C_STRING = 0, > @@ -56,6 +56,8 @@ enum c_string_type > C_CHAR_32 = 7 > }; > > +DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type); Looks like c-lang.h should include common/enum_flags.h. Otherwise LGTM. I'd like to collect at least one Ack on the enum flags patch before pushing it. Thanks, Pedro Alves