This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gas:Reject ++ and --


On Sat, May 22, 2004 at 11:49:59AM -0400, Jakub Jelinek wrote:
> Still, I'm not sure I like the new gas behaviour.

Yes, it's wrong.  I should have thought of the wretched preprocessor
before allowing the patch.  x86 has some hacks to prevent whitespace
being eaten, and "- - c" isn't turned into "--c", so the case you
found for sparc would work on x86.  However,"+ + c" is turned into
"++c".  See tc-i386.c:extra_symbol_chars.

Really, the preprocessor should never completely consume whitespace,
but curing that will no doubt expose many places in target files that
expect all whitespace to be eaten.  Until someone spends the time to
rewrite the preprocessor, I think Nathan's patch should be reverted.

	* expr.c (operand, operator): Don't reject '++' and '--'.

Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.50
diff -u -p -r1.50 expr.c
--- gas/expr.c	16 Apr 2004 01:55:27 -0000	1.50
+++ gas/expr.c	23 May 2004 04:29:45 -0000
@@ -1021,8 +1021,9 @@ operand (expressionS *expressionP)
       break;
 
     case '+':
-      /* Do not accept ++e as +(+e) */
-      if (*input_line_pointer == '+')
+      /* Do not accept ++e as +(+e).
+	 Disabled, since the preprocessor removes whitespace.  */
+      if (0 && *input_line_pointer == '+')
 	goto target_op;
       (void) operand (expressionP);
       break;
@@ -1041,8 +1042,9 @@ operand (expressionS *expressionP)
     case '!':
     case '-':
       {
-        /* Do not accept --e as -(-e) */
-	if (c == '-' && *input_line_pointer == '-')
+        /* Do not accept --e as -(-e)
+	   Disabled, since the preprocessor removes whitespace.  */
+	if (0 && c == '-' && *input_line_pointer == '-')
 	  goto target_op;
 	
 	operand (expressionP);
@@ -1551,8 +1553,9 @@ operator (int *num_chars)
 
     case '+':
     case '-':
-      /* Do not allow a++b and a--b to be a + (+b) and a - (-b) */
-      if (input_line_pointer[1] != c)
+      /* Do not allow a++b and a--b to be a + (+b) and a - (-b)
+	 Disabled, since the preprocessor removes whitespace.  */
+      if (1 || input_line_pointer[1] != c)
 	return op_encoding[c];
       return O_illegal;
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]