gas/
authorJan Beulich <jbeulich@novell.com>
Mon, 31 Jan 2005 14:30:34 +0000 (14:30 +0000)
committerJan Beulich <jbeulich@novell.com>
Mon, 31 Jan 2005 14:30:34 +0000 (14:30 +0000)
2005-01-31  Jan Beulich  <jbeulich@novell.com>

* macro.c (buffer_and_nest): Allow 'from' being NULL; handle anything
that can end with .endr in that case. Make requiring/permitting
pseudo-ops without leading dot closer to the logic in read.c serving
the same purpose.
(expand_irp): Don't pass a mnemonic to buffer_and_nest as it will be
ignored.

gas/testsuite/
2005-01-31  Jan Beulich  <jbeulich@novell.com>

* gas/macros/repeat.[ds]: New.
* gas/macros/macros.exp: Run new test.

gas/ChangeLog
gas/macro.c
gas/testsuite/ChangeLog
gas/testsuite/gas/macros/macros.exp
gas/testsuite/gas/macros/repeat.d [new file with mode: 0644]
gas/testsuite/gas/macros/repeat.s [new file with mode: 0644]

index 01e2c04a1a245b1a76ba41a53f5fc4c132f1a244..80fa64af8cde59db2f392e0d8f986f319b7bafee 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-31  Jan Beulich  <jbeulich@novell.com>
+
+       * macro.c (buffer_and_nest): Allow 'from' being NULL; handle anything
+       that can end with .endr in that case. Make requiring/permitting
+       pseudo-ops without leading dot closer to the logic in read.c serving
+       the same purpose.
+       (expand_irp): Don't pass a mnemonic to buffer_and_nest as it will be
+       ignored.
+
 2005-01-31  Jan Beulich  <jbeulich@novell.com>
 
        * macro.c (do_formals): Adjust to no longer accept empty parameter
index 2173d00a17cb5ad19691666df49a526775fd2cd6..44d2bf84c817557b3124bfb904a9d7ff790fa390 100644 (file)
@@ -152,6 +152,7 @@ macro_mri_mode (int mri)
 /* Read input lines till we get to a TO string.
    Increase nesting depth if we get a FROM string.
    Put the results into sb at PTR.
+   FROM may be NULL (or will be ignored) if TO is "ENDR".
    Add a new input line to an sb using GET_LINE.
    Return 1 on success, 0 on unexpected EOF.  */
 
@@ -159,23 +160,31 @@ int
 buffer_and_nest (const char *from, const char *to, sb *ptr,
                 int (*get_line) (sb *))
 {
-  int from_len = strlen (from);
+  int from_len;
   int to_len = strlen (to);
   int depth = 1;
   int line_start = ptr->len;
 
   int more = get_line (ptr);
 
+  if (to_len == 4 && strcasecmp(to, "ENDR") == 0)
+    {
+      from = NULL;
+      from_len = 0;
+    }
+  else
+    from_len = strlen (from);
+
   while (more)
     {
       /* Try and find the first pseudo op on the line.  */
       int i = line_start;
 
-      if (! macro_alternate && ! macro_mri)
+      if (! NO_PSEUDO_DOT && ! flag_m68k_mri)
        {
          /* With normal syntax we can suck what we want till we get
             to the dot.  With the alternate, labels have to start in
-            the first column, since we cant tell what's a label and
+            the first column, since we can't tell what's a label and
             whats a pseudoop.  */
 
          /* Skip leading whitespace.  */
@@ -200,12 +209,22 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
        i++;
 
       if (i < ptr->len && (ptr->ptr[i] == '.'
-                          || macro_alternate
+                          || NO_PSEUDO_DOT
                           || macro_mri))
        {
-         if (ptr->ptr[i] == '.')
+         if (! flag_m68k_mri && ptr->ptr[i] == '.')
            i++;
-         if (strncasecmp (ptr->ptr + i, from, from_len) == 0
+         if (from == NULL
+            && strncasecmp (ptr->ptr + i, "IRPC", from_len = 4) != 0
+            && strncasecmp (ptr->ptr + i, "IRP", from_len = 3) != 0
+            && strncasecmp (ptr->ptr + i, "IREPC", from_len = 5) != 0
+            && strncasecmp (ptr->ptr + i, "IREP", from_len = 4) != 0
+            && strncasecmp (ptr->ptr + i, "REPT", from_len = 4) != 0
+            && strncasecmp (ptr->ptr + i, "REP", from_len = 3) != 0)
+           from_len = 0;
+         if ((from != NULL
+              ? strncasecmp (ptr->ptr + i, from, from_len) == 0
+              : from_len > 0)
              && (ptr->len == (i + from_len)
                  || ! ISALNUM (ptr->ptr[i + from_len])))
            depth++;
@@ -1122,21 +1141,15 @@ delete_macro (const char *name)
 const char *
 expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *))
 {
-  const char *mn;
   sb sub;
   formal_entry f;
   struct hash_control *h;
   const char *err;
 
-  if (irpc)
-    mn = "IRPC";
-  else
-    mn = "IRP";
-
   idx = sb_skip_white (idx, in);
 
   sb_new (&sub);
-  if (! buffer_and_nest (mn, "ENDR", &sub, get_line))
+  if (! buffer_and_nest (NULL, "ENDR", &sub, get_line))
     return _("unexpected end of file in irp or irpc");
 
   sb_new (&f.name);
index aba29e04158151bdc38c1885c7c4634168571adc..30c921777b0cae57197e3ad346a648f3fad46ef8 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-31  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/macros/repeat.[ds]: New.
+       * gas/macros/macros.exp: Run new test.
+
 2005-01-31  Jan Beulich  <jbeulich@novell.com>
 
        * gas/macros/badarg.[ls]: New.
index 100a3a3d40c682ba960da3adece3a62aec0c9f93..8b99de118608ed81fd870e78554b63742ec08ac1 100644 (file)
@@ -26,6 +26,7 @@ run_dump_test test3
 if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] } {
     run_dump_test irp
     run_dump_test rept
+    run_dump_test repeat
 }
 
 
diff --git a/gas/testsuite/gas/macros/repeat.d b/gas/testsuite/gas/macros/repeat.d
new file mode 100644 (file)
index 0000000..272e441
--- /dev/null
@@ -0,0 +1,43 @@
+#objdump: -r
+#name: nested irp/irpc/rept
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR .*
+OFFSET[        ]+TYPE[         ]+VALUE.*
+0+00[  ]+[a-zA-Z0-9_]+[        ]+irp_irp_19
+0+04[  ]+[a-zA-Z0-9_]+[        ]+irp_irp_18
+0+08[  ]+[a-zA-Z0-9_]+[        ]+irp_irp_29
+0+0c[  ]+[a-zA-Z0-9_]+[        ]+irp_irp_28
+0+10[  ]+[a-zA-Z0-9_]+[        ]+irp_irpc_19
+0+14[  ]+[a-zA-Z0-9_]+[        ]+irp_irpc_18
+0+18[  ]+[a-zA-Z0-9_]+[        ]+irp_irpc_29
+0+1c[  ]+[a-zA-Z0-9_]+[        ]+irp_irpc_28
+0+20[  ]+[a-zA-Z0-9_]+[        ]+irp_rept_1
+0+24[  ]+[a-zA-Z0-9_]+[        ]+irp_rept_1
+0+28[  ]+[a-zA-Z0-9_]+[        ]+irp_rept_2
+0+2c[  ]+[a-zA-Z0-9_]+[        ]+irp_rept_2
+0+30[  ]+[a-zA-Z0-9_]+[        ]+irpc_irp_19
+0+34[  ]+[a-zA-Z0-9_]+[        ]+irpc_irp_18
+0+38[  ]+[a-zA-Z0-9_]+[        ]+irpc_irp_29
+0+3c[  ]+[a-zA-Z0-9_]+[        ]+irpc_irp_28
+0+40[  ]+[a-zA-Z0-9_]+[        ]+irpc_irpc_19
+0+44[  ]+[a-zA-Z0-9_]+[        ]+irpc_irpc_18
+0+48[  ]+[a-zA-Z0-9_]+[        ]+irpc_irpc_29
+0+4c[  ]+[a-zA-Z0-9_]+[        ]+irpc_irpc_28
+0+50[  ]+[a-zA-Z0-9_]+[        ]+irpc_rept_1
+0+54[  ]+[a-zA-Z0-9_]+[        ]+irpc_rept_1
+0+58[  ]+[a-zA-Z0-9_]+[        ]+irpc_rept_2
+0+5c[  ]+[a-zA-Z0-9_]+[        ]+irpc_rept_2
+0+60[  ]+[a-zA-Z0-9_]+[        ]+rept_irp_9
+0+64[  ]+[a-zA-Z0-9_]+[        ]+rept_irp_8
+0+68[  ]+[a-zA-Z0-9_]+[        ]+rept_irp_9
+0+6c[  ]+[a-zA-Z0-9_]+[        ]+rept_irp_8
+0+70[  ]+[a-zA-Z0-9_]+[        ]+rept_irpc_9
+0+74[  ]+[a-zA-Z0-9_]+[        ]+rept_irpc_8
+0+78[  ]+[a-zA-Z0-9_]+[        ]+rept_irpc_9
+0+7c[  ]+[a-zA-Z0-9_]+[        ]+rept_irpc_8
+0+80[  ]+[a-zA-Z0-9_]+[        ]+rept_rept
+0+84[  ]+[a-zA-Z0-9_]+[        ]+rept_rept
+0+88[  ]+[a-zA-Z0-9_]+[        ]+rept_rept
+0+8c[  ]+[a-zA-Z0-9_]+[        ]+rept_rept
diff --git a/gas/testsuite/gas/macros/repeat.s b/gas/testsuite/gas/macros/repeat.s
new file mode 100644 (file)
index 0000000..70329f7
--- /dev/null
@@ -0,0 +1,53 @@
+       .irp    param1,1,2
+        .irp   param2,9,8
+         .long irp_irp_\param1\param2
+        .endr
+       .endr
+
+       .irp    param1,1,2
+        .irpc  param2,98
+         .long irp_irpc_\param1\param2
+        .endr
+       .endr
+
+       .irp    param1,1,2
+        .rept  2
+         .long irp_rept_\param1
+        .endr
+       .endr
+
+       .irpc   param1,12
+        .irp   param2,9,8
+         .long irpc_irp_\param1\param2
+        .endr
+       .endr
+
+       .irpc   param1,12
+        .irpc  param2,98
+         .long irpc_irpc_\param1\param2
+        .endr
+       .endr
+
+       .irpc   param1,12
+        .rept  2
+         .long irpc_rept_\param1
+        .endr
+       .endr
+
+       .rept   2
+        .irp   param2,9,8
+         .long rept_irp_\param2
+        .endr
+       .endr
+
+       .rept   2
+        .irpc  param2,98
+         .long rept_irpc_\param2
+        .endr
+       .endr
+
+       .rept   2
+        .rept  2
+         .long rept_rept
+        .endr
+       .endr
This page took 0.034952 seconds and 4 git commands to generate.