* dw2gencfi.c (TC_DWARF2_EMIT_OFFSET): Provide default.
[binutils-gdb.git] / gas / macro.c
index 97f341473d6c5e96314f769a255f5d125be98f7e..e39288355cbb7fbb63997262fad81264feb060be 100644 (file)
@@ -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.  */