X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fmacro.c;h=e39288355cbb7fbb63997262fad81264feb060be;hb=b2a5fbdc946c0b4a0032f4d9f8cf23d87f5a2dd6;hp=97f341473d6c5e96314f769a255f5d125be98f7e;hpb=aa27de954944df9e1af7c689ed6bbdf07a7b3ad0;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/macro.c b/gas/macro.c index 97f341473d..e39288355c 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -748,6 +748,8 @@ sub_actual (int start, sb *in, sb *t, struct hash_control *formal_hash, /* Doing this permits people to use & in macro bodies. */ sb_add_char (out, '&'); sb_add_sb (out, t); + if (src != start && in->ptr[src - 1] == '&') + sb_add_char (out, '&'); } else if (copyifnotthere) { @@ -788,9 +790,8 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, } else { - /* FIXME: Why do we do this? */ - /* At least in alternate mode this seems correct; without this - one can't append a literal to a parameter. */ + /* Permit macro parameter substition delineated with + an '&' prefix and optional '&' suffix. */ src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0); } } @@ -1072,9 +1073,13 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) /* Lookup the formal in the macro's list. */ ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); if (!ptr) - as_bad (_("Parameter named `%s' does not exist for macro `%s'"), - t.ptr, - m->name); + { + as_bad (_("Parameter named `%s' does not exist for macro `%s'"), + t.ptr, + m->name); + sb_reset (&t); + idx = get_any_string (idx + 1, in, &t); + } else { /* Insert this value into the right place. */