Correctly check gcc version.
[deliverable/binutils-gdb.git] / gas / expr.c
index c50e2c2f33d444608a8c5b7f94eb1019b625ca65..851a406e018096743c544605d12297c4c360bf92 100644 (file)
@@ -1,5 +1,5 @@
 /* expr.c -operands, expressions-
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -327,7 +327,7 @@ integer_constant (radix, expressionP)
 #define valuesize 32
 #endif
 
-  if (flag_m68k_mri && radix == 0)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0)
     {
       int flt = 0;
 
@@ -389,7 +389,7 @@ integer_constant (radix, expressionP)
       break;
     case 10:
       maxdig = radix = 10;
-      too_many_digits = (valuesize + 12) / 4; /* very rough */
+      too_many_digits = (valuesize + 11) / 4; /* very rough */
     }
 #undef valuesize
   start = input_line_pointer;
@@ -541,7 +541,9 @@ integer_constant (radix, expressionP)
        }
     }
 
-  if (flag_m68k_mri && suffix != NULL && input_line_pointer - 1 == suffix)
+  if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+      && suffix != NULL 
+      && input_line_pointer - 1 == suffix)
     c = *input_line_pointer++;
 
   if (small)
@@ -810,13 +812,15 @@ operand (expressionP)
     case '9':
       input_line_pointer--;
 
-      integer_constant (flag_m68k_mri ? 0 : 10, expressionP);
+      integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) 
+                        ? 0 : 10,
+                        expressionP);
       break;
 
     case '0':
       /* non-decimal radix */
 
-      if (flag_m68k_mri)
+      if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
        {
          char *s;
 
@@ -829,8 +833,7 @@ operand (expressionP)
              integer_constant (0, expressionP);
              break;
            }
-       }
-
+        }
       c = *input_line_pointer;
       switch (c)
        {
@@ -840,7 +843,7 @@ operand (expressionP)
        case 'Q':
        case '8':
        case '9':
-         if (flag_m68k_mri)
+         if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
            {
              integer_constant (0, expressionP);
              break;
@@ -873,7 +876,7 @@ operand (expressionP)
          break;
 
        case 'b':
-         if (LOCAL_LABELS_FB && ! flag_m68k_mri)
+         if (LOCAL_LABELS_FB && ! (flag_m68k_mri || NUMBERS_WITH_SUFFIX))
            {
              /* This code used to check for '+' and '-' here, and, in
                 some conditions, fall through to call
@@ -895,7 +898,7 @@ operand (expressionP)
          /* Fall through.  */
        case 'B':
          input_line_pointer++;
-         if (flag_m68k_mri)
+         if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
            goto default_case;
          integer_constant (2, expressionP);
          break;
@@ -908,7 +911,9 @@ operand (expressionP)
        case '5':
        case '6':
        case '7':
-         integer_constant (flag_m68k_mri ? 0 : 8, expressionP);
+         integer_constant ((flag_m68k_mri || NUMBERS_WITH_SUFFIX)
+                            ? 0 : 8, 
+                            expressionP);
          break;
 
        case 'f':
@@ -918,7 +923,8 @@ operand (expressionP)
                 number, make it one.  Otherwise, make it a local label,
                 and try to deal with parsing the rest later.  */
              if (!input_line_pointer[1]
-                 || (is_end_of_line[0xff & input_line_pointer[1]]))
+                 || (is_end_of_line[0xff & input_line_pointer[1]])
+                 || strchr (FLT_CHARS, 'f') == NULL)
                goto is_0f_label;
              {
                char *cp = input_line_pointer + 1;
@@ -958,7 +964,7 @@ operand (expressionP)
 
        case 'd':
        case 'D':
-         if (flag_m68k_mri)
+         if (flag_m68k_mri || NUMBERS_WITH_SUFFIX)
            {
              integer_constant (0, expressionP);
              break;
@@ -1005,6 +1011,7 @@ operand (expressionP)
       /* here with input_line_pointer->char after "(...)" */
       return segment;
 
+#ifdef TC_M68K
     case 'E':
       if (! flag_m68k_mri || *input_line_pointer != '\'')
        goto de_fault;
@@ -1015,6 +1022,7 @@ operand (expressionP)
        goto de_fault;
       ++input_line_pointer;
       /* Fall through.  */
+#endif
     case '\'':
       if (! flag_m68k_mri)
        {
@@ -1034,11 +1042,13 @@ operand (expressionP)
       (void) operand (expressionP);
       break;
 
+#ifdef TC_M68K
     case '"':
       /* Double quote is the bitwise not operator in MRI mode.  */
       if (! flag_m68k_mri)
        goto de_fault;
       /* Fall through.  */
+#endif
     case '~':
       /* ~ is permitted to start a label on the Delta.  */
       if (is_name_beginner (c))
@@ -1080,6 +1090,7 @@ operand (expressionP)
       }
       break;
 
+#if defined (DOLLAR_DOT) || defined (TC_M68K)
     case '$':
       /* $ is the program counter when in MRI mode, or when DOLLAR_DOT
          is defined.  */
@@ -1100,6 +1111,7 @@ operand (expressionP)
 
       current_location (expressionP);
       break;
+#endif
 
     case '.':
       if (!is_part_of_name (*input_line_pointer))
@@ -1163,6 +1175,7 @@ operand (expressionP)
       input_line_pointer--;
       break;
 
+#ifdef TC_M68K
     case '%':
       if (! flag_m68k_mri)
        goto de_fault;
@@ -1192,9 +1205,12 @@ operand (expressionP)
 
       current_location (expressionP);
       break;
+#endif
 
     default:
+#ifdef TC_M68K
     de_fault:
+#endif
       if (is_end_of_line[(unsigned char) c])
        goto eol;
       if (is_name_beginner (c))        /* here if did not begin with a digit */
@@ -1484,6 +1500,22 @@ static operator_rankT op_rank[] =
   3,   /* O_logical_and */
   2,   /* O_logical_or */
   1,   /* O_index */
+  0,   /* O_md1 */
+  0,   /* O_md2 */
+  0,   /* O_md3 */
+  0,   /* O_md4 */
+  0,   /* O_md5 */
+  0,   /* O_md6 */
+  0,   /* O_md7 */
+  0,   /* O_md8 */
+  0,   /* O_md9 */
+  0,   /* O_md10 */
+  0,   /* O_md11 */
+  0,   /* O_md12 */
+  0,   /* O_md13 */
+  0,   /* O_md14 */
+  0,   /* O_md15 */
+  0,   /* O_md16 */
 };
 
 /* Unfortunately, in MRI mode for the m68k, multiplication and
@@ -1616,10 +1648,11 @@ operator ()
 /* Parse an expression.  */
 
 segT
-expr (rank, resultP)
-     operator_rankT rank;      /* Larger # is higher rank. */
+expr (rankarg, resultP)
+     int rankarg;      /* Larger # is higher rank. */
      expressionS *resultP;     /* Deliver result here. */
 {
+  operator_rankT rank = (operator_rankT) rankarg;
   segT retval;
   expressionS right;
   operatorT op_left;
@@ -1711,6 +1744,13 @@ expr (rank, resultP)
        }
 
       /* Optimize common cases.  */
+#ifdef md_optimize_expr
+      if (md_optimize_expr (resultP, op_left, &right))
+       {
+         /* skip */;
+       }
+      else
+#endif
       if (op_left == O_add && right.X_op == O_constant)
        {
          /* X + constant.  */
This page took 0.026252 seconds and 4 git commands to generate.