public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Saleem Abdulrasool <compnerd@compnerd.org>
Cc: "gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libgcc: quote ARM macro parameters
Date: Sat, 03 Oct 2015 19:21:00 -0000	[thread overview]
Message-ID: <87si5r4v1u.fsf@igel.home> (raw)
In-Reply-To: <CANXyDxuZ0XnZjbSTO8+6=6Pt2joA=m4X7zBW3yQN9Ma_hikXUQ@mail.gmail.com>	(Saleem Abdulrasool's message of "Sat, 3 Oct 2015 11:43:25 -0700")

Saleem Abdulrasool <compnerd@compnerd.org> writes:

> On Saturday, October 3, 2015, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
>> Saleem Abdulrasool <compnerd@compnerd.org <javascript:;>> writes:
>>
>> > For ARM EHABI _Unwind_{G,S}setIP are macros rather than proper functions
>> as they
>> > are extensions to the EHABI specification (though they are part of the
>> Level 1
>> > interface).  Quote the macro parameters, as otherwise, a complex
>> parameter may
>> > be ambiguously mis-expanded.
>> > ---
>> >  libgcc/config/arm/unwind-arm.h | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libgcc/config/arm/unwind-arm.h
>> b/libgcc/config/arm/unwind-arm.h
>> > index f1f789c..3821c08 100644
>> > --- a/libgcc/config/arm/unwind-arm.h
>> > +++ b/libgcc/config/arm/unwind-arm.h
>> > @@ -74,10 +74,10 @@ extern "C" {
>> >      }
>> >    /* Return the address of the instruction, not the actual IP value.  */
>> >  #define _Unwind_GetIP(context) \
>> > -  (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
>> > +  (_Unwind_GetGR ((context), 15) & ~(_Unwind_Word)1)
>>
>> How can that get mis-expanded (other than cheating with a macro that
>> expands to a comma)?
>>
>
> Poor choice of words on my part.  It won't mis-expand, it may expand into
> an "ambiguous" statement (which will be diagnosed with a warning) if the
> argument is an expression in the sense of:
>
> a + b | 1

That cannot happen here, unless the caller already passes such an
expression.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

      parent reply	other threads:[~2015-10-03 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-03 16:51 Saleem Abdulrasool
2015-10-03 18:29 ` Andreas Schwab
     [not found]   ` <CANXyDxuZ0XnZjbSTO8+6=6Pt2joA=m4X7zBW3yQN9Ma_hikXUQ@mail.gmail.com>
2015-10-03 19:21     ` Andreas Schwab [this message]

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=87si5r4v1u.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=compnerd@compnerd.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).