* input-file.c (input_file_open): Rearrange to avoid warning.
[deliverable/binutils-gdb.git] / gas / expr.c
index a18d6d87c0dfadc708226583a6b16150ae1a7ffb..460a8372dd232c932cf92362e6b27d6e140d59f1 100644 (file)
@@ -1021,6 +1021,10 @@ operand (expressionS *expressionP)
       break;
 
     case '+':
+      /* Do not accept ++e as +(+e).
+        Disabled, since the preprocessor removes whitespace.  */
+      if (0 && *input_line_pointer == '+')
+       goto target_op;
       (void) operand (expressionP);
       break;
 
@@ -1038,6 +1042,11 @@ operand (expressionS *expressionP)
     case '!':
     case '-':
       {
+        /* Do not accept --e as -(-e)
+          Disabled, since the preprocessor removes whitespace.  */
+       if (0 && c == '-' && *input_line_pointer == '-')
+         goto target_op;
+       
        operand (expressionP);
        if (expressionP->X_op == O_constant)
          {
@@ -1067,6 +1076,35 @@ operand (expressionS *expressionP)
            else
              generic_floating_point_number.sign = 'N';
          }
+       else if (expressionP->X_op == O_big
+                && expressionP->X_add_number > 0)
+         {
+           int i;
+
+           if (c == '~' || c == '-')
+             {
+               for (i = 0; i < expressionP->X_add_number; ++i)
+                 generic_bignum[i] = ~generic_bignum[i];
+               if (c == '-')
+                 for (i = 0; i < expressionP->X_add_number; ++i)
+                   {
+                     generic_bignum[i] += 1;
+                     if (generic_bignum[i])
+                       break;
+                   }
+             }
+           else if (c == '!')
+             {
+               int nonzero = 0;
+               for (i = 0; i < expressionP->X_add_number; ++i)
+                 {
+                   if (generic_bignum[i])
+                     nonzero = 1;
+                   generic_bignum[i] = 0;
+                 }
+               generic_bignum[0] = nonzero;
+             }
+         }
        else if (expressionP->X_op != O_illegal
                 && expressionP->X_op != O_absent)
          {
@@ -1289,6 +1327,7 @@ operand (expressionS *expressionP)
        }
       else
        {
+       target_op:
          /* Let the target try to parse it.  Success is indicated by changing
             the X_op field to something other than O_absent and pointing
             input_line_pointer past the expression.  If it can't parse the
@@ -1541,6 +1580,14 @@ operator (int *num_chars)
     default:
       return op_encoding[c];
 
+    case '+':
+    case '-':
+      /* 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;
+
     case '<':
       switch (input_line_pointer[1])
        {
This page took 0.023395 seconds and 4 git commands to generate.