This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make large enum constants unsigned


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  <stefan.kristiansson@saunalahti.fi>

	* 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?)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]