Re: or1k/opcodes: ISO C version compatibility issues

Stefan Kristiansson <[email protected]>
Newsgroups gmane.comp.gnu.binutils,gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
On Wed, May 21, 2014 at 04:47:20PM -0400, Peter Gavin wrote:
> On Wed, May 21, 2014 at 4:44 PM, Maciej W. Rozycki
> <[email protected]>wrote:
> 
> > (also for or1k-desc.c).  I have been able to make the files compile with
> > the change below, however these are generated files and a suitable change
> > would have to be applied to cpu/or1kcommon.cpu instead.  Unfortunately
> > that source has been written in Scheme that I have no immediate skills to
> > correct.  Would you please look into making the correct update to the
> > Scheme source?
> >
> 
> I think this is actually a bug in CGEN, and needs to be changed there.
> 

Without claiming any scheme skills, I think something like the patch below
should do it.

Stefan

diff --git a/cgen/enum.scm b/cgen/enum.scm
index 4279b00..d56a1a3 100644
--- a/cgen/enum.scm
+++ b/cgen/enum.scm
@@ -298,7 +298,10 @@
 		     ""
 		     (string-append " = "
 				    (if (number? (cadr e))
-					(number->string (cadr e))
+					(string-append (number->string (cadr e))
+						       (if (> (cadr e)
+							      #x80000000)
+							   "u" ""))
 					(cadr e))))
 		 ))
 	       (if (and san? include-sanitize-marker?)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.