From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3241 invoked by alias); 29 May 2014 20:09:34 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 3218 invoked by uid 89); 29 May 2014 20:09:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp.nebula.fi Received: from smtp-69.nebula.fi (HELO smtp.nebula.fi) (83.145.220.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 29 May 2014 20:09:31 +0000 Received: from chokladfabriken.org (nblzone-224-141.nblnetworks.fi [83.145.224.141]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.nebula.fi (Postfix) with ESMTPS id 27C6AD007D2; Thu, 29 May 2014 23:09:18 +0300 (EEST) Date: Thu, 29 May 2014 20:09:00 -0000 From: Stefan Kristiansson To: "Frank Ch. Eigler" Cc: cgen@sourceware.org, Alan Modra , fche@sourceware.org, Christian Svensson , Pierre Muller , "Maciej W. Rozycki" Subject: Re: [PATCH] Make large enum constants unsigned Message-ID: <20140529200819.GA9229@chokladfabriken.org> References: <20140522052921.GA30609@chokladfabriken.org> <20140522150956.GC4031@elastic.org> <20140522210621.GF4031@elastic.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140522210621.GF4031@elastic.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-q2/txt/msg00017.txt.bz2 On Thu, May 22, 2014 at 05:06:21PM -0400, Frank Ch. Eigler wrote: > Hi - > > > > (string-append "(signed int)" (number->string (cadr e))) > > [...] > > how would that be better than? > > (string-append (number->string (cadr e)) "U") > > It would be a closer match to expressing our desire to match C enum > typing, but I'd be fine with "U" suffixing too. > > > > I dismissed that, since it would create a lot larger diff in generated > > files than in the isolated cases where it's actually a problem. [...] > > IMHO, that's not such a big deal. We don't usually look closely at > the diffs of generated files, once the generating tools are trustworthy. > Ok, that's fine by me if others are ok with it. Below is the patch that does that. 2014-05-29 Stefan Kristiansson * enum.scm (gen-enum-decl): Emit 'U' after constants. Index: enum.scm =================================================================== RCS file: /cvs/src/src/cgen/enum.scm,v retrieving revision 1.13 diff -u -r1.13 enum.scm --- enum.scm 13 Feb 2010 03:39:15 -0000 1.13 +++ enum.scm 29 May 2014 20:08:12 -0000 @@ -298,7 +298,8 @@ "" (string-append " = " (if (number? (cadr e)) - (number->string (cadr e)) + (string-append (number->string (cadr e)) + "U") (cadr e)))) )) (if (and san? include-sanitize-marker?)