public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: <erik@dd.nec.com.au>
Cc: <binutils@sources.redhat.com>
Subject: Re: macro behavior
Date: Fri, 15 Apr 2005 06:42:00 -0000	[thread overview]
Message-ID: <s25f7070.030@emea1-mh.id2.novell.com> (raw)

>>> Erik Christiansen <erik@dd.nec.com.au> 15.04.05 04:47:03 >>>
>On Thu, Apr 14, 2005 at 04:42:59PM +0200, Jan Beulich wrote:
>> (1) If I want to append a constant suffix to the expanded string, I
>> see no way to do so in default mode; in .altmacro mode I am able to do
>> so using the & macro operator:
>>
>> 	.macro m sym
>> 	.equiv &sym&_, 1
>> 	.endm
>
>   For me, prepending of constants, and appending of the constant '.' and
>parameter names works fine in gas. (Tested only on avr-as 20030512, so far,
>I'm afraid). For some odd reason, your choice of '_' does break the
>appending mechanism. Here is what works for me:
>
>  .macro struct_elem name, size, elem    ; Declare an element of struct "name"
>  \name.\elem = oneof_\name              ; Generate element offset.
>  oneof_\name = oneof_\name + \size      ; Size of one struct.
>  .endm

Without having tried it out, I'd say this doesn't work anymore in mainline; . previously wasn't considered a character valid for macro arguments, but now macro argument names follow the rules for symbol names (as they always should have), and thus \name.\elem now gets split into "\name." and "\elem" rather than "\name", ".", and "\elem".

>   If a more flexible syntax evolves, that would be nifty, but the
>existing code is in volume production, so is fixing what we have an
>option?  ;-)

Zack's suggestion seems very promising to me, though. I'll look into whether that can be implemented without caveats.

Jan

             reply	other threads:[~2005-04-15  6:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15  6:42 Jan Beulich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-04-20  9:20 Jan Beulich
2005-04-20  9:34 ` Hans-Peter Nilsson
     [not found] <s25f7070.029@emea1-mh.id2.novell.com>
2005-04-15  8:32 ` Erik Christiansen
2005-04-14 14:43 Jan Beulich
2005-04-14 17:25 ` Zack Weinberg
2005-04-15  2:49 ` Erik Christiansen

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=s25f7070.030@emea1-mh.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=binutils@sources.redhat.com \
    --cc=erik@dd.nec.com.au \
    /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).