From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Stefan Kristiansson'" <stefan.kristiansson@saunalahti.fi>,
"'Maciej W. Rozycki'" <macro@codesourcery.com>
Cc: <cgen@sourceware.org>, "'Alan Modra'" <amodra@gmail.com>,
<fche@sourceware.org>,
"'Christian Svensson'" <blue@cmd.nu>
Subject: RE: [PATCH] Make large enum constants unsigned
Date: Thu, 22 May 2014 13:33:00 -0000 [thread overview]
Message-ID: <00c201cf75c2$72e15930$58a40b90$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20140522071001.GA30918@chokladfabriken.org>
Couldn't we support 64-bit constants already,
by adding
+ (if (> (cadr e)
+ #x100000000)
+ "LL" ""))
Right after the conditional "U" postfix?
This way, the pre C-99 standard would only be violated when
it is really required anyhow, no?
Pierre Muller
> -----Message d'origine-----
> De : Stefan Kristiansson [mailto:stefan.kristiansson@saunalahti.fi]
> Envoyé : jeudi 22 mai 2014 09:10
> À : Maciej W. Rozycki
> Cc : cgen@sourceware.org; Alan Modra; fche@sourceware.org; Christian
> Svensson; Pierre Muller
> Objet : Re: [PATCH] Make large enum constants unsigned
>
> On Thu, May 22, 2014 at 09:52:50AM +0300, Stefan Kristiansson wrote:
> >
> > As for 'u' vs 'U', a 'U' is emitted in the .h file even if I put a
> 'u'
> > in the .scm.
> > If 'u' in the output is preferred, maybe someone can point out the
> > reason for this?
> >
>
> I found the reason, there's a 'string-upcase' a couple of rows above
> what the patch touches.
> I'm not sure getting around that is worth pursuing though?
>
> Anyway, below is the updated patch.
>
> 2014-05-22 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
>
> * enum.scm (gen-enum-decl): Emit 'U' after constants larger than
> #x80000000
>
> Index: cgen/enum.scm
> ===================================================================
> RCS file: /cvs/src/src/cgen/enum.scm,v
> retrieving revision 1.13
> diff -u -r1.13 enum.scm
> --- cgen/enum.scm 13 Feb 2010 03:39:15 -0000 1.13
> +++ cgen/enum.scm 22 May 2014 07:09:00 -0000
> @@ -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?)
next prev parent reply other threads:[~2014-05-22 13:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 5:30 Stefan Kristiansson
2014-05-22 6:22 ` Maciej W. Rozycki
2014-05-22 6:52 ` Stefan Kristiansson
2014-05-22 7:10 ` Stefan Kristiansson
2014-05-22 13:33 ` Pierre Muller [this message]
[not found] ` <5561926758764771034@unknownmsgid>
2014-05-22 14:10 ` Stefan Kristiansson
2014-05-22 16:14 ` Maciej W. Rozycki
2014-05-22 15:11 ` Frank Ch. Eigler
2014-05-22 17:34 ` Stefan Kristiansson
2014-05-22 21:06 ` Frank Ch. Eigler
2014-05-22 21:42 ` Maciej W. Rozycki
2014-05-22 22:20 ` Frank Ch. Eigler
2014-05-29 20:09 ` Stefan Kristiansson
2014-05-29 20:32 ` Frank Ch. Eigler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00c201cf75c2$72e15930$58a40b90$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=amodra@gmail.com \
--cc=blue@cmd.nu \
--cc=cgen@sourceware.org \
--cc=fche@sourceware.org \
--cc=macro@codesourcery.com \
--cc=stefan.kristiansson@saunalahti.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).