public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	cgen@sourceware.org, 	Alan Modra <amodra@gmail.com>,
	fche@sourceware.org, Christian Svensson <blue@cmd.nu>,
		Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Subject: Re: [PATCH] Make large enum constants unsigned
Date: Thu, 22 May 2014 06:52:00 -0000	[thread overview]
Message-ID: <CADzBsGObK_dNY81Lcv8HgPAP800xv2H8vf80M96-NfMo-CXcPA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1405220702380.512@tp.orcam.me.uk>

On Thu, May 22, 2014 at 9:21 AM, Maciej W. Rozycki
<macro@codesourcery.com> wrote:
> On Thu, 22 May 2014, Stefan Kristiansson wrote:
>
>> this fixes a bug noted in two threads on the binutils mailing list:
>> https://sourceware.org/ml/binutils/2014-05/msg00152.html
>> https://sourceware.org/ml/binutils/2014-05/msg00195.html
>>
>> Both threads describe the problem pretty well, but the gist of it
>> is that constants are generated that will be interpreted as signed.
>>
>> 2014-05-22  Stefan Kristiansson  <stefan.kristiansson@saunalahti.fi>
>>
>>       * enum.scm (gen-enum-decl): Emit 'ULL' after constants larger than
>>        #x80000000
>
>  Well, `ULL' is non-standard for pre-C99 compilers and also not needed
> because an enum will never have a type that is wider than `int'.  So for
> portability's sake I suggest that you use `U' or `u' as I proposed (I
> prefer lowercase `u' for decimal constants because I find it easier to
> spot among digits, however please feel free to take your pick).
>

Hmm, right.
I actually had a plain 'U' in my first version of the patch, but then
changed it to 'ULL' last minute with the thought of being future proof
against possible larger mask values.
But as you point out, that will have issues anyway, so I'll repost
with the original patch.

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?

Stefan

  reply	other threads:[~2014-05-22  6:52 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 [this message]
2014-05-22  7:10     ` Stefan Kristiansson
2014-05-22 13:33       ` Pierre Muller
     [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=CADzBsGObK_dNY81Lcv8HgPAP800xv2H8vf80M96-NfMo-CXcPA@mail.gmail.com \
    --to=stefan.kristiansson@saunalahti.fi \
    --cc=amodra@gmail.com \
    --cc=blue@cmd.nu \
    --cc=cgen@sourceware.org \
    --cc=fche@sourceware.org \
    --cc=macro@codesourcery.com \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    /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).