OSDN Git Service

* gcc.texi: Fixes for makeinfo 4.0 --html.
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 0540092..c34d1a1 100644 (file)
@@ -307,7 +307,7 @@ static int current_sym_nchars;
 #define CONTIN  \
   do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0)
 #else
-#define CONTIN
+#define CONTIN do { } while (0)
 #endif
 
 #if defined(ASM_OUTPUT_SECTION_NAME)
@@ -326,7 +326,7 @@ static void dbxout_type                     PARAMS ((tree, int, int));
 static void print_int_cst_octal                PARAMS ((tree));
 static void print_octal                        PARAMS ((unsigned HOST_WIDE_INT, int));
 static void dbxout_type_name           PARAMS ((tree));
-static void dbxout_symbol_location     PARAMS ((tree, tree, const char *, rtx));
+static int dbxout_symbol_location      PARAMS ((tree, tree, const char *, rtx));
 static void dbxout_symbol_name         PARAMS ((tree, const char *, int));
 static void dbxout_prepare_symbol      PARAMS ((tree));
 static void dbxout_finish_symbol       PARAMS ((tree));
@@ -473,7 +473,7 @@ dbxout_typedefs (syms)
          tree type = TREE_TYPE (syms);
          if (TYPE_NAME (type)
              && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
-             && TYPE_SIZE (type) != NULL_TREE
+             && COMPLETE_TYPE_P (type)
              && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
            dbxout_symbol (TYPE_NAME (type), 0);
        }
@@ -623,29 +623,28 @@ dbxout_type_fields (type)
      tree type;
 {
   tree tem;
+
   /* Output the name, type, position (in bits), size (in bits) of each
-     field.  */
+     field that we can support.  */
   for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
     {
       /* Omit here local type decls until we know how to support them.  */
-      if (TREE_CODE (tem) == TYPE_DECL)
-       continue;
-      /* Omit fields whose position or size are variable.  */
-      else if (TREE_CODE (tem) == FIELD_DECL
-              && (TREE_CODE (DECL_FIELD_BITPOS (tem)) != INTEGER_CST
-                  || TREE_CODE (DECL_SIZE (tem)) != INTEGER_CST))
-       continue;
-      /* Omit here the nameless fields that are used to skip bits.  */
-      else if (DECL_IGNORED_P (tem))
+      if (TREE_CODE (tem) == TYPE_DECL
+         /* Omit fields whose position or size are variable or too large to
+            represent.  */
+         || (TREE_CODE (tem) == FIELD_DECL
+             && (! host_integerp (bit_position (tem), 0)
+                 || ! host_integerp (DECL_SIZE (tem), 1)))
+         /* Omit here the nameless fields that are used to skip bits.  */
+          || DECL_IGNORED_P (tem))
        continue;
+
       else if (TREE_CODE (tem) != CONST_DECL)
        {
          /* Continue the line if necessary,
             but not before the first field.  */
          if (tem != TYPE_FIELDS (type))
-           {
-             CONTIN;
-           }
+           CONTIN;
 
          if (use_gnu_debug_info_extensions
              && flag_minimal_debug
@@ -661,7 +660,7 @@ dbxout_type_fields (type)
              dbxout_type (TREE_TYPE (tem), 0, 0);
              fputc (',', asmfile);
              fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                      TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
+                      int_bit_position (tem));
              fputc (';', asmfile);
              continue;
            }
@@ -691,8 +690,7 @@ dbxout_type_fields (type)
 
          dbxout_type ((TREE_CODE (tem) == FIELD_DECL
                        && DECL_BIT_FIELD_TYPE (tem))
-                      ? DECL_BIT_FIELD_TYPE (tem)
-                      : TREE_TYPE (tem), 0, 0);
+                      ? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0, 0);
 
          if (TREE_CODE (tem) == VAR_DECL)
            {
@@ -705,22 +703,20 @@ dbxout_type_fields (type)
                  CHARS (strlen (name));
                }
              else
-               {
-                 /* If TEM is non-static, GDB won't understand it.  */
-                 fprintf (asmfile, ",0,0;");
-               }
+               /* If TEM is non-static, GDB won't understand it.  */
+               fprintf (asmfile, ",0,0;");
            }
-         else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
+         else
            {
              fputc (',', asmfile);
              fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                      TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
+                      int_bit_position (tem));
              fputc (',', asmfile);
              fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                      TREE_INT_CST_LOW (DECL_SIZE (tem)));
+                      tree_low_cst (DECL_SIZE (tem), 1));
              fputc (';', asmfile);
+             CHARS (23);
            }
-         CHARS (23);
        }
     }
 }
@@ -758,13 +754,15 @@ dbxout_type_method_1 (decl, debug_name)
     }
 
   fprintf (asmfile, ":%s;%c%c%c", debug_name,
-          TREE_PRIVATE (decl) ? '0' : TREE_PROTECTED (decl) ? '1' : '2', c1, c2);
+          TREE_PRIVATE (decl) ? '0'
+          : TREE_PROTECTED (decl) ? '1' : '2', c1, c2);
   CHARS (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl)) + 6
         - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))));
-  if (DECL_VINDEX (decl))
+
+  if (DECL_VINDEX (decl) && host_integerp (DECL_VINDEX (decl), 0))
     {
       fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-              TREE_INT_CST_LOW (DECL_VINDEX (decl)));
+              tree_low_cst (DECL_VINDEX (decl), 0));
       fputc (';', asmfile);
       dbxout_type (DECL_CONTEXT (decl), 0, 0);
       fprintf (asmfile, ";");
@@ -959,20 +957,23 @@ dbxout_range_type (type)
       else
        dbxout_type_index (integer_type_node);
     }
-  if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
+
+  if (TYPE_MIN_VALUE (type) != 0
+      && host_integerp (TYPE_MIN_VALUE (type), 0))
     {
       fputc (';', asmfile);
       fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-              TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)));
+              tree_low_cst (TYPE_MIN_VALUE (type), 0));
     }
   else
     fprintf (asmfile, ";0");
-  if (TYPE_MAX_VALUE (type) 
-      && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST)
+
+  if (TYPE_MAX_VALUE (type) != 0
+      && host_integerp (TYPE_MAX_VALUE (type), 0))
     {
       fputc (';', asmfile);
       fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-              TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
+              tree_low_cst (TYPE_MAX_VALUE (type), 0));
       fputc (';', asmfile);
     }
   else
@@ -1071,7 +1072,7 @@ dbxout_type (type, full, show_arg_types)
         and either that's all we want or that's the best we could do,
         don't repeat the cross reference.
         Sun dbx crashes if we do.  */
-      if (! full || TYPE_SIZE (type) == 0
+      if (! full || !COMPLETE_TYPE_P (type)
          /* No way in DBX fmt to describe a variable size.  */
          || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
        return;
@@ -1096,7 +1097,7 @@ dbxout_type (type, full, show_arg_types)
         && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
               && DECL_IGNORED_P (TYPE_NAME (type)))
         && !full)
-       || TYPE_SIZE (type) == 0
+       || !COMPLETE_TYPE_P (type)
        /* No way in DBX fmt to describe a variable size.  */
        || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
       {
@@ -1175,6 +1176,10 @@ dbxout_type (type, full, show_arg_types)
             and hence they can't span same size unsigned types.  */
 
          if (use_gnu_debug_info_extensions
+             && TYPE_MIN_VALUE (type) != 0
+             && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
+             && TYPE_MAX_VALUE (type) != 0
+             && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
              && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
                  || (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)
                      && TREE_UNSIGNED (type))
@@ -1361,7 +1366,7 @@ dbxout_type (type, full, show_arg_types)
             && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
                   && DECL_IGNORED_P (TYPE_NAME (type)))
             && !full)
-           || TYPE_SIZE (type) == 0
+           || !COMPLETE_TYPE_P (type)
            /* No way in DBX fmt to describe a variable size.  */
            || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
          {
@@ -1407,17 +1412,15 @@ dbxout_type (type, full, show_arg_types)
        for (i = 0; i < n_baseclasses; i++)
          {
            tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
+
            if (use_gnu_debug_info_extensions)
              {
                have_used_extensions = 1;
-               putc (TREE_VIA_VIRTUAL (child) ? '1'
-                     : '0',
-                     asmfile);
-               putc (TREE_VIA_PUBLIC (child) ? '2'
-                     : '0',
-                     asmfile);
+               putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile);
+               putc (TREE_VIA_PUBLIC (child) ? '2' : '0', asmfile);
                fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                        TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
+                        (tree_low_cst (BINFO_OFFSET (child), 0)
+                         * BITS_PER_UNIT));
                fputc (',', asmfile);
                CHARS (15);
                dbxout_type (BINFO_TYPE (child), 0, 0);
@@ -1432,10 +1435,13 @@ dbxout_type (type, full, show_arg_types)
                dbxout_type (BINFO_TYPE (child), full, 0);
                fputc (',', asmfile);
                fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                        TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
+                        tree_low_cst (BINFO_OFFSET (child), 0)
+                        * BITS_PER_UNIT);
                fputc (',', asmfile);
                fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
-                        TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT);
+                        (tree_low_cst (DECL_SIZE (TYPE_NAME
+                                                 (BINFO_TYPE (child))), 0)
+                         * BITS_PER_UNIT));
                fputc (';', asmfile);
                CHARS (20);
              }
@@ -1451,6 +1457,7 @@ dbxout_type (type, full, show_arg_types)
          have_used_extensions = 1;
          dbxout_type_methods (type);
        }
+
       putc (';', asmfile);
 
       if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
@@ -1484,7 +1491,7 @@ dbxout_type (type, full, show_arg_types)
           && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
                 && DECL_IGNORED_P (TYPE_NAME (type)))
           && !full)
-         || TYPE_SIZE (type) == 0)
+         || !COMPLETE_TYPE_P (type))
        {
          fprintf (asmfile, "xe");
          CHARS (3);
@@ -1508,7 +1515,7 @@ dbxout_type (type, full, show_arg_types)
            fprintf (asmfile, HOST_WIDE_INT_PRINT_UNSIGNED,
                     TREE_INT_CST_LOW (TREE_VALUE (tem)));
          else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1
-                  && TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
+                  && (HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
            fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                     TREE_INT_CST_LOW (TREE_VALUE (tem)));
          else
@@ -1615,7 +1622,7 @@ print_int_cst_octal (c)
   unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (c);
   unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (c);
   int excess = (3 - (HOST_BITS_PER_WIDE_INT % 3));
-  int width = TYPE_PRECISION (TREE_TYPE (c));
+  unsigned int width = TYPE_PRECISION (TREE_TYPE (c));
 
   /* GDB wants constants with no extra leading "1" bits, so
      we need to remove any sign-extension that might be
@@ -1647,7 +1654,7 @@ print_int_cst_octal (c)
                  << (HOST_BITS_PER_WIDE_INT / 3 * 3))
                 - 1);
 
-      fprintf (asmfile, "%o%01o", (int)beg, (int)middle);
+      fprintf (asmfile, "%o%01o", (int) beg, (int) middle);
       print_octal (end, HOST_BITS_PER_WIDE_INT / 3);
     }
 }
@@ -1660,7 +1667,7 @@ print_octal (value, digits)
   int i;
 
   for (i = digits - 1; i >= 0; i--)
-    fprintf (asmfile, "%01o", (int)((value >> (3 * i)) & 7));
+    fprintf (asmfile, "%01o", (int) ((value >> (3 * i)) & 7));
 }
 
 /* Output the name of type TYPE, with no punctuation.
@@ -1863,7 +1870,7 @@ dbxout_symbol (decl, local)
        if (tag_needed && TYPE_NAME (type) != 0
            && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
                || (DECL_NAME (TYPE_NAME (type)) != 0))
-           && TYPE_SIZE (type) != 0
+           && COMPLETE_TYPE_P (type)
            && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
          {
            /* For a TYPE_DECL with no name, but the type has a name,
@@ -1928,6 +1935,7 @@ dbxout_symbol (decl, local)
         and not written in memory, inform the debugger.  */
       if (TREE_STATIC (decl) && TREE_READONLY (decl)
          && DECL_INITIAL (decl) != 0
+         && host_integerp (DECL_INITIAL (decl), 0)
          && ! TREE_ASM_WRITTEN (decl)
          && (DECL_FIELD_CONTEXT (decl) == NULL_TREE
              || TREE_CODE (DECL_FIELD_CONTEXT (decl)) == BLOCK))
@@ -1936,10 +1944,11 @@ dbxout_symbol (decl, local)
            {
              /* The sun4 assembler does not grok this.  */
              const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
+
              if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
                  || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
                {
-                 HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
+                 HOST_WIDE_INT ival = tree_low_cst (DECL_INITIAL (decl), 0);
 #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
                  DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival);
 #else
@@ -2365,8 +2374,7 @@ dbxout_parms (parms)
 
               If we use DECL_RTL, then we must use the declared type of
               the variable, not the type that it arrived in.  */
-           if (REGNO (DECL_RTL (parms)) >= 0
-               && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
+           if (REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
              {
                best_rtl = DECL_RTL (parms);
                parm_type = TREE_TYPE (parms);
@@ -2425,8 +2433,7 @@ dbxout_parms (parms)
            /* DECL_RTL looks like (MEM (REG...).  Get the register number.
               If it is an unallocated pseudo-reg, then use the register where
               it was passed instead.  */
-           if (REGNO (XEXP (DECL_RTL (parms), 0)) >= 0
-               && REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
+           if (REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
              current_sym_value = REGNO (XEXP (DECL_RTL (parms), 0));
            else
              current_sym_value = REGNO (DECL_INCOMING_RTL (parms));
@@ -2488,7 +2495,9 @@ dbxout_parms (parms)
                && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms))
                && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD)
              {
-               current_sym_value += UNITS_PER_WORD - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms)));
+               current_sym_value += 
+                   GET_MODE_SIZE (GET_MODE (DECL_RTL (parms)))
+                   - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms)));
              }
 
            FORCE_TEXT;
@@ -2551,7 +2560,6 @@ dbxout_reg_parms (parms)
        /* Report parms that live in registers during the function
           but were passed in memory.  */
        if (GET_CODE (DECL_RTL (parms)) == REG
-           && REGNO (DECL_RTL (parms)) >= 0
            && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
          dbxout_symbol_location (parms, TREE_TYPE (parms),
                                  0, DECL_RTL (parms));
@@ -2627,7 +2635,7 @@ dbxout_block (block, depth, args)
   int ignored;
 
 #if DBX_BLOCKS_FUNCTION_RELATIVE
-  char *begin_label; 
+  const char *begin_label; 
   if (current_function_func_begin_label != NULL_TREE)
     begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
   else