summaryrefslogtreecommitdiff
path: root/gas/macro.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2010-08-18 05:56:41 +0000
committerAlan Modra <amodra@bigpond.net.au>2010-08-18 05:56:41 +0000
commit015540e1797f545c8500d7bd4df93ecc77eca9f5 (patch)
tree6eb2f41897755a9fa4937d8af3935994eedbb1e2 /gas/macro.c
parent7448f95fde6e78a949becc47a32832b65e84953e (diff)
downloadbinutils-redhat-015540e1797f545c8500d7bd4df93ecc77eca9f5.tar.gz
* macro.c (sub_actual): Add back ampersand suffix when no
substitution. (macro_expand_body): Correct comment.
Diffstat (limited to 'gas/macro.c')
-rw-r--r--gas/macro.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 3e3ffb11f5..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);
}
}