[PATCH] gas/macro.c(buffer_and_nest) skip labels when looking for "ENDM"

Alan Modra amodra@bigpond.net.au
Mon Nov 7 01:45:00 GMT 2005


On Tue, Oct 18, 2005 at 08:29:57PM +0200, Arnold Metselaar wrote:
> In the current version, buffer_and_nest() in macro.c only skips 
> labels when searching for "ENDM" if NO_PSEUDO_DOT is not set. 
> The result is that the "macros dot"-test fails with "unexpected 
> end of file in macro definition".
> 
> The patch below removes the test on NO_PSEUDO_DOT. I'm not sure 
> whether the test on flag_m68k_mri should remain; putting a 
> label before "ENDM" may or may not be allowed in mri mode. If 
> it is allowed, the whole condition should be removed.

I'm going to remove the whole condition.  I think the tests on
LABELS_WITHOUT_COLONS that Jan added make this reasonable.  The effect
will be that on targets that use LABELS_WITHOUT_COLONS, "endm" (or
".endm") and "endr" (or ".endr") at the start of a line will be treated
as a label.  This is consistent with the way other pseudos are treated
on such targets.

	* macro.c (buffer_and_nest): Skip labels regardless of
	NO_PSEUDO_DOT and flag_m68k_mri.

Index: gas/macro.c
===================================================================
RCS file: /cvs/src/src/gas/macro.c,v
retrieving revision 1.39
diff -u -p -r1.39 macro.c
--- gas/macro.c	9 Aug 2005 15:47:46 -0000	1.39
+++ gas/macro.c	7 Nov 2005 01:44:15 -0000
@@ -180,49 +180,46 @@ buffer_and_nest (const char *from, const
 
   while (more)
     {
-      /* Try and find the first pseudo op on the line.  */
+      /* Try to find the first pseudo op on the line.  */
       int i = line_start;
 
-      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 can't tell what's a label and
+	 what's a pseudoop.  */
+
+      if (! LABELS_WITHOUT_COLONS)
 	{
-	  /* 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 can't tell what's a label and
-	     whats a pseudoop.  */
-
-	  if (! LABELS_WITHOUT_COLONS)
-	    {
-	      /* Skip leading whitespace.  */
-	      while (i < ptr->len && ISWHITE (ptr->ptr[i]))
-		i++;
-	    }
-
-	  for (;;)
-	    {
-	      /* Skip over a label, if any.  */
-	      if (i >= ptr->len || ! is_name_beginner (ptr->ptr[i]))
-		break;
-	      i++;
-	      while (i < ptr->len && is_part_of_name (ptr->ptr[i]))
-		i++;
-	      if (i < ptr->len && is_name_ender (ptr->ptr[i]))
-		i++;
-	      if (LABELS_WITHOUT_COLONS)
-		break;
-	      /* Skip whitespace.  */
-	      while (i < ptr->len && ISWHITE (ptr->ptr[i]))
-		i++;
-	      /* Check for the colon.  */
-	      if (i >= ptr->len || ptr->ptr[i] != ':')
-		{
-		  i = line_start;
-		  break;
-		}
-	      i++;
-	      line_start = i;
-	    }
+	  /* Skip leading whitespace.  */
+	  while (i < ptr->len && ISWHITE (ptr->ptr[i]))
+	    i++;
+	}
 
+      for (;;)
+	{
+	  /* Skip over a label, if any.  */
+	  if (i >= ptr->len || ! is_name_beginner (ptr->ptr[i]))
+	    break;
+	  i++;
+	  while (i < ptr->len && is_part_of_name (ptr->ptr[i]))
+	    i++;
+	  if (i < ptr->len && is_name_ender (ptr->ptr[i]))
+	    i++;
+	  if (LABELS_WITHOUT_COLONS)
+	    break;
+	  /* Skip whitespace.  */
+	  while (i < ptr->len && ISWHITE (ptr->ptr[i]))
+	    i++;
+	  /* Check for the colon.  */
+	  if (i >= ptr->len || ptr->ptr[i] != ':')
+	    {
+	      i = line_start;
+	      break;
+	    }
+	  i++;
+	  line_start = i;
 	}
+
       /* Skip trailing whitespace.  */
       while (i < ptr->len && ISWHITE (ptr->ptr[i]))
 	i++;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list