* stack.c (print_frame_info): When checking PC_IN_CALL_DUMMY,
[deliverable/binutils-gdb.git] / gas / expr.c
index fa67fa3b930c56f5ddc195d8a078ff6cd8c1d21e..a7e32df20e5458e254788429c0fc72d9cc3b423c 100644 (file)
@@ -1,5 +1,5 @@
 /* expr.c -operands, expressions-
-   Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
 
 #include "obstack.h"
 
-#if __STDC__ == 1
-static void clean_up_expression (expressionS * expressionP);
-#else /* __STDC__ */
-static void clean_up_expression ();    /* Internal. */
-#endif /* not __STDC__ */
-extern const char EXP_CHARS[]; /* JF hide MD floating pt stuff all the same place */
-extern const char FLT_CHARS[];
+static void clean_up_expression PARAMS ((expressionS * expressionP));
+extern const char EXP_CHARS[], FLT_CHARS[];
 
 /*
  * Build any floating-point literal here.
  * Also build any bignum literal here.
  */
 
-/* LITTLENUM_TYPE      generic_buffer [6]; *//* JF this is a hack */
 /* Seems atof_machine can backscan through generic_bignum and hit whatever
    happens to be loaded before it in memory.  And its way too complicated
    for me to fix right.  Thus a hack.  JF:  Just make generic_bignum bigger,
    and never write into the early words, thus they'll always be zero.
-   I hate Dean's floating-point code.  Bleh.
-   */
+   I hate Dean's floating-point code.  Bleh.  */
 LITTLENUM_TYPE generic_bignum[SIZE_OF_LARGE_NUMBER + 6];
 FLONUM_TYPE generic_floating_point_number =
 {
@@ -63,6 +56,7 @@ FLONUM_TYPE generic_floating_point_number =
 /* If nonzero, we've been asked to assemble nan, +inf or -inf */
 int generic_floating_point_magic;
 \f
+void
 floating_constant (expressionP)
      expressionS *expressionP;
 {
@@ -85,47 +79,45 @@ floating_constant (expressionP)
          as_bad ("bad floating-point constant: unknown error code=%d.", error_code);
        }
     }
-  expressionP->X_seg = SEG_BIG;
+  expressionP->X_seg = big_section;
   /* input_line_pointer->just after constant, */
   /* which may point to whitespace. */
   expressionP->X_add_number = -1;
 }
 
 
-
+void
 integer_constant (radix, expressionP)
      int radix;
      expressionS *expressionP;
 {
-  register char *digit_2;      /*->2nd digit of number. */
+  char *digit_2;       /*->2nd digit of number. */
   char c;
 
-  register valueT number;      /* offset or (absolute) value */
-  register short int digit;    /* value of next digit in current radix */
-  register short int maxdig = 0;/* highest permitted digit value. */
-  register int too_many_digits = 0;    /* if we see >= this number of */
-  register char *name;         /* points to name of symbol */
-  register symbolS *symbolP;   /* points to symbol */
+  valueT number;       /* offset or (absolute) value */
+  short int digit;     /* value of next digit in current radix */
+  short int maxdig = 0;/* highest permitted digit value. */
+  int too_many_digits = 0;     /* if we see >= this number of */
+  char *name;          /* points to name of symbol */
+  symbolS *symbolP;    /* points to symbol */
 
   int small;                   /* true if fits in 32 bits. */
-  extern char hex_value[];     /* in hex_value.c */
-
-  /* may be bignum, or may fit in 32 bits. */
-  /*
-   * most numbers fit into 32 bits, and we want this case to be fast.
-   * so we pretend it will fit into 32 bits. if, after making up a 32
-   * bit number, we realise that we have scanned more digits than
-   * comfortably fit into 32 bits, we re-scan the digits coding
-   * them into a bignum. for decimal and octal numbers we are conservative: some
-   * numbers may be assumed bignums when in fact they do fit into 32 bits.
-   * numbers of any radix can have excess leading zeros: we strive
-   * to recognise this and cast them back into 32 bits.
-   * we must check that the bignum really is more than 32
-   * bits, and change it back to a 32-bit number if it fits.
-   * the number we are looking for is expected to be positive, but
-   * if it fits into 32 bits as an unsigned number, we let it be a 32-bit
-   * number. the cavalier approach is for speed in ordinary cases.
-   */
+  extern const char hex_value[]; /* in hex_value.c */
+
+  /* May be bignum, or may fit in 32 bits. */
+  /* Most numbers fit into 32 bits, and we want this case to be fast.
+     so we pretend it will fit into 32 bits.  If, after making up a 32
+     bit number, we realise that we have scanned more digits than
+     comfortably fit into 32 bits, we re-scan the digits coding them
+     into a bignum.  For decimal and octal numbers we are
+     conservative: Some numbers may be assumed bignums when in fact
+     they do fit into 32 bits.  Numbers of any radix can have excess
+     leading zeros: We strive to recognise this and cast them back
+     into 32 bits.  We must check that the bignum really is more than
+     32 bits, and change it back to a 32-bit number if it fits.  The
+     number we are looking for is expected to be positive, but if it
+     fits into 32 bits as an unsigned number, we let it be a 32-bit
+     number.  The cavalier approach is for speed in ordinary cases. */
 
   switch (radix)
     {
@@ -246,9 +238,13 @@ integer_constant (radix, expressionP)
 
              }
            else
-             {                 /* either not seen or not defined. */
-               as_bad ("backw. ref to unknown label \"%d:\", 0 assumed.", number);
-               expressionP->X_seg = SEG_ABSOLUTE;
+             {
+               /* either not seen or not defined. */
+               /* @@ Should print out the original string instead of
+                  the parsed number.  */
+               as_bad ("backw. ref to unknown label \"%d:\", 0 assumed.",
+                       (int) number);
+               expressionP->X_seg = absolute_section;
              }
 
            expressionP->X_add_number = 0;
@@ -271,10 +267,10 @@ integer_constant (radix, expressionP)
 #ifndef many_segments
            /* since "know" puts its arg into a "string", we
               can't have newlines in the argument.  */
-           know (S_GET_SEGMENT (symbolP) == SEG_UNKNOWN || S_GET_SEGMENT (symbolP) == SEG_TEXT || S_GET_SEGMENT (symbolP) == SEG_DATA);
+           know (S_GET_SEGMENT (symbolP) == undefined_section || S_GET_SEGMENT (symbolP) == text_section || S_GET_SEGMENT (symbolP) == data_section);
 #endif
            expressionP->X_add_symbol = symbolP;
-           expressionP->X_seg = SEG_UNKNOWN;
+           expressionP->X_seg = undefined_section;
            expressionP->X_subtract_symbol = NULL;
            expressionP->X_add_number = 0;
 
@@ -317,7 +313,7 @@ integer_constant (radix, expressionP)
        default:
          {
            expressionP->X_add_number = number;
-           expressionP->X_seg = SEG_ABSOLUTE;
+           expressionP->X_seg = absolute_section;
            input_line_pointer--;       /* restore following character. */
            break;
          }                     /* really just a number */
@@ -327,11 +323,12 @@ integer_constant (radix, expressionP)
 
     }
   else
-    {                          /* not a small number */
+    {
+      /* not a small number */
       expressionP->X_add_number = number;
-      expressionP->X_seg = SEG_BIG;
+      expressionP->X_seg = big_section;
       input_line_pointer--;    /*->char following number. */
-    }                          /* if (small) */
+    }
 }                              /* integer_constant() */
 
 
@@ -352,22 +349,14 @@ integer_constant (radix, expressionP)
 
 static segT
 operand (expressionP)
-     register expressionS *expressionP;
+     expressionS *expressionP;
 {
-  register char c;
-  register symbolS *symbolP;   /* points to symbol */
-  register char *name;         /* points to name of symbol */
-  /* invented for humans only, hope */
-  /* optimising compiler flushes it! */
-  register short int radix;    /* 2, 8, 10 or 16, 0 when floating */
-  /* 0 means we saw start of a floating- */
-  /* point constant. */
+  char c;
+  symbolS *symbolP;    /* points to symbol */
+  char *name;          /* points to name of symbol */
 
   /* digits, assume it is a bignum. */
 
-
-
-
   SKIP_WHITESPACE ();          /* leading whitespace is part of operand. */
   c = *input_line_pointer++;   /* input_line_pointer->past char in c. */
 
@@ -417,7 +406,7 @@ operand (expressionP)
              /* The string was only zero */
              expressionP->X_add_symbol = 0;
              expressionP->X_add_number = 0;
-             expressionP->X_seg = SEG_ABSOLUTE;
+             expressionP->X_seg = absolute_section;
            }
 
          break;
@@ -458,7 +447,7 @@ operand (expressionP)
        case 'f':
 #ifdef LOCAL_LABELS_FB
          /* if it says '0f' and the line ends or it doesn't look like
-        a floating point #, its a local label ref.  dtrt */
+            a floating point #, its a local label ref.  dtrt */
          /* likewise for the b's.  xoxorich. */
          if (c == 'f'
              && (!*input_line_pointer ||
@@ -482,6 +471,7 @@ operand (expressionP)
 
          input_line_pointer++;
          floating_constant (expressionP);
+         expressionP->X_add_number = -(isupper (c) ? tolower (c) : c);
          break;
 
 #ifdef LOCAL_LABELS_DOLLAR
@@ -508,74 +498,73 @@ operand (expressionP)
 
 
     case '\'':
-      /*
-     * Warning: to conform to other people's assemblers NO ESCAPEMENT is permitted
-     * for a single quote. The next character, parity errors and all, is taken
-     * as the value of the operand. VERY KINKY.
-     */
+      /* Warning: to conform to other people's assemblers NO ESCAPEMENT is
+        permitted for a single quote. The next character, parity errors and
+        all, is taken as the value of the operand. VERY KINKY.  */
       expressionP->X_add_number = *input_line_pointer++;
-      expressionP->X_seg = SEG_ABSOLUTE;
+      expressionP->X_seg = absolute_section;
       break;
 
-    case '~':
-    case '-':
     case '+':
+      operand (expressionP);
+      break;
 
+    case '~':
+    case '-':
       {
        /* unary operator: hope for SEG_ABSOLUTE */
-       switch (operand (expressionP))
+       segT opseg = operand (expressionP);
+       if (opseg == absolute_section)
          {
-         case SEG_ABSOLUTE:
            /* input_line_pointer -> char after operand */
            if (c == '-')
              {
                expressionP->X_add_number = -expressionP->X_add_number;
-               /*
-          * Notice: '-' may  overflow: no warning is given. This is compatible
-          * with other people's assemblers. Sigh.
-          */
+               /* Notice: '-' may overflow: no warning is given. This is
+                  compatible with other people's assemblers. Sigh.  */
              }
            else
              {
                expressionP->X_add_number = ~expressionP->X_add_number;
              }
-           break;
-
-         case SEG_TEXT:
-         case SEG_DATA:
-         case SEG_BSS:
-         case SEG_PASS1:
-         case SEG_UNKNOWN:
+         }
+       else if (opseg == text_section
+                || opseg == data_section
+                || opseg == bss_section
+                || opseg == pass1_section
+                || opseg == undefined_section)
+         {
            if (c == '-')
-             {                 /* JF I hope this hack works */
+             {
                expressionP->X_subtract_symbol = expressionP->X_add_symbol;
                expressionP->X_add_symbol = 0;
-               expressionP->X_seg = SEG_DIFFERENCE;
-               break;
+               expressionP->X_seg = diff_section;
              }
-         default:              /* unary on non-absolute is unsuported */
-           as_warn ("Unary operator %c ignored because bad operand follows", c);
-           break;
-           /* Expression undisturbed from operand(). */
+           else
+             as_warn ("Unary operator %c ignored because bad operand follows",
+                      c);
          }
+       else
+         as_warn ("Unary operator %c ignored because bad operand follows", c);
       }
-
-
-
       break;
 
     case '.':
       if (!is_part_of_name (*input_line_pointer))
        {
+         char *fake;
          extern struct obstack frags;
 
-         /*
-       JF:  '.' is pseudo symbol with value of current location in current
-       segment. . .
-       */
-         symbolP = symbol_new ("L0\001",
+         /* JF: '.' is pseudo symbol with value of current location
+            in current segment.  */
+#ifdef DOT_LABEL_PREFIX
+         fake = ".L0\001";
+#else
+         fake = "L0\001";
+#endif
+         symbolP = symbol_new (fake,
                                now_seg,
-              (valueT) (obstack_next_free (&frags) - frag_now->fr_literal),
+              (valueT) ((char*)obstack_next_free (&frags) - frag_now->fr_literal),
                                frag_now);
 
          expressionP->X_add_number = 0;
@@ -592,35 +581,35 @@ operand (expressionP)
        }
     case ',':
     case '\n':
+    case '\0':
+    eol:
       /* can't imagine any other kind of operand */
-      expressionP->X_seg = SEG_ABSENT;
+      expressionP->X_seg = absent_section;
       input_line_pointer--;
       md_operand (expressionP);
       break;
-      /* Fall through */
+
     default:
+      if (is_end_of_line[c])
+       goto eol;
       if (is_name_beginner (c))        /* here if did not begin with a digit */
        {
          /*
-       * Identifier begins here.
-       * This is kludged for speed, so code is repeated.
-       */
+          * Identifier begins here.
+          * This is kludged for speed, so code is repeated.
+          */
        isname:
          name = --input_line_pointer;
          c = get_symbol_end ();
          symbolP = symbol_find_or_make (name);
-         /*
-       * If we have an absolute symbol or a reg, then we know its value now.
-       */
+         /* If we have an absolute symbol or a reg, then we know its value
+            now.  */
          expressionP->X_seg = S_GET_SEGMENT (symbolP);
-         switch (expressionP->X_seg)
+         if (expressionP->X_seg == absolute_section
+             || expressionP->X_seg == reg_section)
+           expressionP->X_add_number = S_GET_VALUE (symbolP);
+         else
            {
-           case SEG_ABSOLUTE:
-           case SEG_REGISTER:
-             expressionP->X_add_number = S_GET_VALUE (symbolP);
-             break;
-
-           default:
              expressionP->X_add_number = 0;
              expressionP->X_add_symbol = symbolP;
            }
@@ -631,18 +620,10 @@ operand (expressionP)
        {
          as_bad ("Bad expression");
          expressionP->X_add_number = 0;
-         expressionP->X_seg = SEG_ABSOLUTE;
-
+         expressionP->X_seg = absolute_section;
        }
-
     }
 
-
-
-
-
-
-
   /*
    * It is more 'efficient' to clean up the expressionS when they are created.
    * Doing it here saves lines of code.
@@ -669,52 +650,52 @@ operand (expressionP)
 
 static void
 clean_up_expression (expressionP)
-     register expressionS *expressionP;
+     expressionS *expressionP;
 {
-  switch (expressionP->X_seg)
+  segT s = expressionP->X_seg;
+  if (s == absent_section
+      || s == pass1_section)
     {
-    case SEG_ABSENT:
-    case SEG_PASS1:
       expressionP->X_add_symbol = NULL;
       expressionP->X_subtract_symbol = NULL;
       expressionP->X_add_number = 0;
-      break;
-
-    case SEG_BIG:
-    case SEG_ABSOLUTE:
+    }
+  else if (s == big_section
+          || s == absolute_section)
+    {
       expressionP->X_subtract_symbol = NULL;
       expressionP->X_add_symbol = NULL;
-      break;
-
-    case SEG_UNKNOWN:
-      expressionP->X_subtract_symbol = NULL;
-      break;
-
-    case SEG_DIFFERENCE:
+    }
+  else if (s == undefined_section)
+    expressionP->X_subtract_symbol = NULL;
+  else if (s == diff_section)
+    {
       /*
-        * It does not hurt to 'cancel' NULL==NULL
-        * when comparing symbols for 'eq'ness.
-        * It is faster to re-cancel them to NULL
-        * than to check for this special case.
-        */
+       * It does not hurt to 'cancel' NULL==NULL
+       * when comparing symbols for 'eq'ness.
+       * It is faster to re-cancel them to NULL
+       * than to check for this special case.
+       */
       if (expressionP->X_subtract_symbol == expressionP->X_add_symbol
          || (expressionP->X_subtract_symbol
              && expressionP->X_add_symbol
-             && expressionP->X_subtract_symbol->sy_frag == expressionP->X_add_symbol->sy_frag
-             && S_GET_VALUE (expressionP->X_subtract_symbol) == S_GET_VALUE (expressionP->X_add_symbol)))
+             && (expressionP->X_subtract_symbol->sy_frag
+                 == expressionP->X_add_symbol->sy_frag)
+             && (S_GET_VALUE (expressionP->X_subtract_symbol)
+                 == S_GET_VALUE (expressionP->X_add_symbol))))
        {
          expressionP->X_subtract_symbol = NULL;
          expressionP->X_add_symbol = NULL;
-         expressionP->X_seg = SEG_ABSOLUTE;
+         expressionP->X_seg = absolute_section;
        }
-      break;
-
-    case SEG_REGISTER:
+    }
+  else if (s == reg_section)
+    {
       expressionP->X_add_symbol = NULL;
       expressionP->X_subtract_symbol = NULL;
-      break;
-
-    default:
+    }
+  else
+    {
       if (SEG_NORMAL (expressionP->X_seg))
        {
          expressionP->X_subtract_symbol = NULL;
@@ -723,9 +704,8 @@ clean_up_expression (expressionP)
        {
          BAD_CASE (expressionP->X_seg);
        }
-      break;
     }
-}                              /* clean_up_expression() */
+}
 \f
 /*
  *                     expr_part ()
@@ -744,9 +724,20 @@ expr_part (symbol_1_PP, symbol_2_P)
      symbolS *symbol_2_P;
 {
   segT return_value;
-#ifndef MANY_SEGMENTS
-  know ((*symbol_1_PP) == NULL || (S_GET_SEGMENT (*symbol_1_PP) == SEG_TEXT) || (S_GET_SEGMENT (*symbol_1_PP) == SEG_DATA) || (S_GET_SEGMENT (*symbol_1_PP) == SEG_BSS) || (!S_IS_DEFINED (*symbol_1_PP)));
-  know (symbol_2_P == NULL || (S_GET_SEGMENT (symbol_2_P) == SEG_TEXT) || (S_GET_SEGMENT (symbol_2_P) == SEG_DATA) || (S_GET_SEGMENT (symbol_2_P) == SEG_BSS) || (!S_IS_DEFINED (symbol_2_P)));
+
+#if !defined (BFD_ASSEMBLER) && (defined (OBJ_AOUT) || defined (OBJ_BOUT))
+  int test = ((*symbol_1_PP) == NULL
+             || (S_GET_SEGMENT (*symbol_1_PP) == text_section)
+             || (S_GET_SEGMENT (*symbol_1_PP) == data_section)
+             || (S_GET_SEGMENT (*symbol_1_PP) == bss_section)
+             || (!S_IS_DEFINED (*symbol_1_PP)));
+  assert (test);
+  test = (symbol_2_P == NULL
+         || (S_GET_SEGMENT (symbol_2_P) == text_section)
+         || (S_GET_SEGMENT (symbol_2_P) == data_section)
+         || (S_GET_SEGMENT (symbol_2_P) == bss_section)
+         || (!S_IS_DEFINED (symbol_2_P)));
+  assert (test);
 #endif
   if (*symbol_1_PP)
     {
@@ -754,13 +745,13 @@ expr_part (symbol_1_PP, symbol_2_P)
        {
          if (symbol_2_P)
            {
-             return_value = SEG_PASS1;
+             return_value = pass1_section;
              *symbol_1_PP = NULL;
            }
          else
            {
              know (!S_IS_DEFINED (*symbol_1_PP));
-             return_value = SEG_UNKNOWN;
+             return_value = undefined_section;
            }
        }
       else
@@ -770,7 +761,7 @@ expr_part (symbol_1_PP, symbol_2_P)
              if (!S_IS_DEFINED (symbol_2_P))
                {
                  *symbol_1_PP = NULL;
-                 return_value = SEG_PASS1;
+                 return_value = pass1_section;
                }
              else
                {
@@ -778,7 +769,7 @@ expr_part (symbol_1_PP, symbol_2_P)
                  as_bad ("Expression too complex, 2 symbolS forgotten: \"%s\" \"%s\"",
                        S_GET_NAME (*symbol_1_PP), S_GET_NAME (symbol_2_P));
                  *symbol_1_PP = NULL;
-                 return_value = SEG_ABSOLUTE;
+                 return_value = absolute_section;
                }
            }
          else
@@ -797,15 +788,22 @@ expr_part (symbol_1_PP, symbol_2_P)
       else
        {
          *symbol_1_PP = NULL;
-         return_value = SEG_ABSOLUTE;
+         return_value = absolute_section;
        }
     }
-#ifndef MANY_SEGMENTS
-  know (return_value == SEG_ABSOLUTE || return_value == SEG_TEXT || return_value == SEG_DATA || return_value == SEG_BSS || return_value == SEG_UNKNOWN || return_value == SEG_PASS1);
+#if defined (OBJ_AOUT) && !defined (BFD_ASSEMBLER)
+  test = (return_value == absolute_section
+         || return_value == text_section
+         || return_value == data_section
+         || return_value == bss_section
+         || return_value == undefined_section
+         || return_value == pass1_section);
+  assert (test);
 #endif
-  know ((*symbol_1_PP) == NULL || (S_GET_SEGMENT (*symbol_1_PP) == return_value));
+  know ((*symbol_1_PP) == NULL
+       || (S_GET_SEGMENT (*symbol_1_PP) == return_value));
   return (return_value);
-}                              /* expr_part() */
+}
 \f
 /* Expression parser. */
 
@@ -846,6 +844,7 @@ typedef enum
 
 operatorT;
 
+#undef __
 #define __ O_illegal
 
 static const operatorT op_encoding[256] =
@@ -892,14 +891,14 @@ static const operator_rankT
 /* Return resultP->X_seg. */
 segT 
 expr (rank, resultP)
-     register operator_rankT rank;     /* Larger # is higher rank. */
-     register expressionS *resultP;    /* Deliver result here. */
+     operator_rankT rank;      /* Larger # is higher rank. */
+     expressionS *resultP;     /* Deliver result here. */
 {
   expressionS right;
-  register operatorT op_left;
-  register char c_left;                /* 1st operator character. */
-  register operatorT op_right;
-  register char c_right;
+  operatorT op_left;
+  char c_left;         /* 1st operator character. */
+  operatorT op_right;
+  char c_right;
 
   know (rank >= 0);
   (void) operand (resultP);
@@ -914,13 +913,13 @@ expr (rank, resultP)
        {
          input_line_pointer++;
        }                       /*->after operator. */
-      if (SEG_ABSENT == expr (op_rank[(int) op_left], &right))
+      if (absent_section == expr (op_rank[(int) op_left], &right))
        {
          as_warn ("Missing operand value assumed absolute 0.");
          resultP->X_add_number = 0;
          resultP->X_subtract_symbol = NULL;
          resultP->X_add_symbol = NULL;
-         resultP->X_seg = SEG_ABSOLUTE;
+         resultP->X_seg = absolute_section;
        }
       know (*input_line_pointer != ' ');
       c_right = *input_line_pointer;
@@ -934,26 +933,26 @@ expr (rank, resultP)
       /* left-hand quantity in resultP */
       /* right-hand quantity in right. */
       /* operator in op_left. */
-      if (resultP->X_seg == SEG_PASS1 || right.X_seg == SEG_PASS1)
+      if (resultP->X_seg == pass1_section || right.X_seg == pass1_section)
        {
-         resultP->X_seg = SEG_PASS1;
+         resultP->X_seg = pass1_section;
        }
       else
        {
-         if (resultP->X_seg == SEG_BIG)
+         if (resultP->X_seg == big_section)
            {
              as_warn ("Left operand of %c is a %s.  Integer 0 assumed.",
                    c_left, resultP->X_add_number > 0 ? "bignum" : "float");
-             resultP->X_seg = SEG_ABSOLUTE;
+             resultP->X_seg = absolute_section;
              resultP->X_add_symbol = 0;
              resultP->X_subtract_symbol = 0;
              resultP->X_add_number = 0;
            }
-         if (right.X_seg == SEG_BIG)
+         if (right.X_seg == big_section)
            {
              as_warn ("Right operand of %c is a %s.  Integer 0 assumed.",
                       c_left, right.X_add_number > 0 ? "bignum" : "float");
-             right.X_seg = SEG_ABSOLUTE;
+             right.X_seg = absolute_section;
              right.X_add_symbol = 0;
              right.X_subtract_symbol = 0;
              right.X_add_number = 0;
@@ -967,7 +966,7 @@ expr (rank, resultP)
               * does not cause any further inaccuracy.
               */
 
-             register symbolS *symbolP;
+             symbolS *symbolP;
 
              right.X_add_number = -right.X_add_number;
              symbolP = right.X_add_symbol;
@@ -975,7 +974,7 @@ expr (rank, resultP)
              right.X_subtract_symbol = symbolP;
              if (symbolP)
                {
-                 right.X_seg = SEG_DIFFERENCE;
+                 right.X_seg = diff_section;
                }
              op_left = O_add;
            }
@@ -984,65 +983,70 @@ expr (rank, resultP)
            {
              segT seg1;
              segT seg2;
-#ifndef MANY_SEGMENTS
+#if 0 /* @@ This rejects stuff in common sections too.  Figure out some
+        reasonable test, and make it clean...  */
+#if !defined (MANY_SEGMENTS) && !defined (OBJ_ECOFF)
+             know (resultP->X_seg == data_section || resultP->X_seg == text_section || resultP->X_seg == bss_section || resultP->X_seg == undefined_section || resultP->X_seg == diff_section || resultP->X_seg == absolute_section || resultP->X_seg == pass1_section || resultP->X_seg == reg_section);
 
-             know (resultP->X_seg == SEG_DATA || resultP->X_seg == SEG_TEXT || resultP->X_seg == SEG_BSS || resultP->X_seg == SEG_UNKNOWN || resultP->X_seg == SEG_DIFFERENCE || resultP->X_seg == SEG_ABSOLUTE || resultP->X_seg == SEG_PASS1 || resultP->X_seg == SEG_REGISTER);
-
-             know (right.X_seg == SEG_DATA || right.X_seg == SEG_TEXT || right.X_seg == SEG_BSS || right.X_seg == SEG_UNKNOWN || right.X_seg == SEG_DIFFERENCE || right.X_seg == SEG_ABSOLUTE || right.X_seg == SEG_PASS1);
+             know (right.X_seg == data_section || right.X_seg == text_section || right.X_seg == bss_section || right.X_seg == undefined_section || right.X_seg == diff_section || right.X_seg == absolute_section || right.X_seg == pass1_section);
 #endif
+#endif /* 0 */
              clean_up_expression (&right);
              clean_up_expression (resultP);
 
              seg1 = expr_part (&resultP->X_add_symbol, right.X_add_symbol);
              seg2 = expr_part (&resultP->X_subtract_symbol, right.X_subtract_symbol);
-             if (seg1 == SEG_PASS1 || seg2 == SEG_PASS1)
+             if (seg1 == pass1_section || seg2 == pass1_section)
                {
                  need_pass_2 = 1;
-                 resultP->X_seg = SEG_PASS1;
+                 resultP->X_seg = pass1_section;
                }
-             else if (seg2 == SEG_ABSOLUTE)
+             else if (seg2 == absolute_section)
                resultP->X_seg = seg1;
-             else if (seg1 != SEG_UNKNOWN
-                      && seg1 != SEG_ABSOLUTE
-                      && seg2 != SEG_UNKNOWN
+             else if (seg1 != undefined_section
+                      && seg1 != absolute_section
+                      && seg2 != undefined_section
                       && seg1 != seg2)
                {
-                 know (seg2 != SEG_ABSOLUTE);
+                 know (seg2 != absolute_section);
                  know (resultP->X_subtract_symbol);
 #ifndef MANY_SEGMENTS
-                 know (seg1 == SEG_TEXT || seg1 == SEG_DATA || seg1 == SEG_BSS);
-                 know (seg2 == SEG_TEXT || seg2 == SEG_DATA || seg2 == SEG_BSS);
+#ifndef OBJ_ECOFF
+                 know (seg1 == text_section || seg1 == data_section || seg1 == bss_section);
+                 know (seg2 == text_section || seg2 == data_section || seg2 == bss_section);
+#endif
 #endif
                  know (resultP->X_add_symbol);
                  know (resultP->X_subtract_symbol);
                  as_bad ("Expression too complex: forgetting %s - %s",
                          S_GET_NAME (resultP->X_add_symbol),
                          S_GET_NAME (resultP->X_subtract_symbol));
-                 resultP->X_seg = SEG_ABSOLUTE;
+                 resultP->X_seg = absolute_section;
                  /* Clean_up_expression() will do the rest. */
                }
              else
-               resultP->X_seg = SEG_DIFFERENCE;
+               resultP->X_seg = diff_section;
 
              resultP->X_add_number += right.X_add_number;
              clean_up_expression (resultP);
            }
          else
            {                   /* Not +. */
-             if (resultP->X_seg == SEG_UNKNOWN || right.X_seg == SEG_UNKNOWN)
+             if (resultP->X_seg == undefined_section || right.X_seg == undefined_section)
                {
-                 resultP->X_seg = SEG_PASS1;
+                 resultP->X_seg = pass1_section;
                  need_pass_2 = 1;
                }
              else
                {
                  resultP->X_subtract_symbol = NULL;
                  resultP->X_add_symbol = NULL;
-                 /* Will be SEG_ABSOLUTE. */
-                 if (resultP->X_seg != SEG_ABSOLUTE || right.X_seg != SEG_ABSOLUTE)
+                 /* Will be absolute_section. */
+                 if (resultP->X_seg != absolute_section || right.X_seg != absolute_section)
                    {
-                     as_bad ("Relocation error. Absolute 0 assumed.");
-                     resultP->X_seg = SEG_ABSOLUTE;
+                     as_bad ("Relocation error: Symbolic expressions may only involve");
+                     as_bad ("  addition and subtraction. Absolute 0 assumed.");
+                     resultP->X_seg = absolute_section;
                      resultP->X_add_number = 0;
                    }
                  else
@@ -1060,7 +1064,7 @@ expr (rank, resultP)
                            }
                          else
                            {
-                             as_warn ("Division by 0. 0 assumed.");
+                             as_warn ("Division by 0.  Result of 0 substituted.");
                              resultP->X_add_number = 0;
                            }
                          break;
@@ -1090,6 +1094,8 @@ expr (rank, resultP)
                          break;
 
                        case O_right_shift:
+                         /* @@ We should distinguish signed versus
+                            unsigned here somehow.  */
                          resultP->X_add_number >>= right.X_add_number;
                          break;
 
@@ -1132,7 +1138,7 @@ expr (rank, resultP)
 char
 get_symbol_end ()
 {
-  register char c;
+  char c;
 
   while (is_part_of_name (c = *input_line_pointer++))
     ;
@@ -1150,11 +1156,4 @@ get_single_number ()
 
 }
 
-/*
- * Local Variables:
- * comment-column: 0
- * fill-column: 131
- * End:
- */
-
 /* end of expr.c */
This page took 0.042014 seconds and 4 git commands to generate.