OSDN Git Service

* gcc.dg/compat/scalar-by-value-3_main.c: New file.
[pf3gnuchains/gcc-fork.git] / gcc / dwarfout.c
index 0ff75f5..8555443 100644 (file)
@@ -1,6 +1,6 @@
 /* Output Dwarf format symbol table information from the GNU C compiler.
-   Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003 Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices.
 
 This file is part of GCC.
@@ -43,7 +43,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
  The generation of DWARF debugging information by the GNU version 2.x C
  compiler has now been tested rather extensively for m88k, i386, i860, and
- Sparc targets.  The DWARF output of the GNU C compiler appears to inter-
+ SPARC targets.  The DWARF output of the GNU C compiler appears to inter-
  operate well with the standard SVR4 SDB debugger on these kinds of target
  systems (but of course, there are no guarantees).
 
@@ -162,7 +162,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  is required by the current DWARF draft specification.
 
  Specifically, the current DWARF draft specification seems to require that
- the type of an non-unsigned integral bit-field member of a struct or union
+ the type of a non-unsigned integral bit-field member of a struct or union
  type be represented as either a "signed" type or as a "plain" type,
  depending upon the exact set of keywords that were used in the
  type specification for the given bit-field member.  It was felt (by the
@@ -523,7 +523,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  are still being discussed.  Also, we in the PLSIG are still discussing
  whether or not we need to do anything special for C++ templates.  (At this
  time it is not yet clear whether we even need to do anything special for
- these.) 
+ these.)
 
  With regard to FORTRAN, the UI/PLSIG has defined what is believed to be a
  complete and sufficient set of codes and rules for adequately representing
@@ -560,15 +560,18 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
         Other possible `compacting' transformations designed to save disk
         space and to reduce linker & debugger I/O activity.
 
-*/  
+*/
 
 #include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 
 #ifdef DWARF_DEBUGGING_INFO
-#include "system.h"
 #include "dwarf.h"
 #include "tree.h"
 #include "flags.h"
+#include "function.h"
 #include "rtl.h"
 #include "hard-reg-set.h"
 #include "insn-config.h"
@@ -578,6 +581,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "toplev.h"
 #include "tm_p.h"
 #include "debug.h"
+#include "target.h"
 #include "langhooks.h"
 
 /* NOTE: In the comments in this file, many references are made to
@@ -599,7 +603,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   fprintf ((FILE), "%s", reg_names[REGNO (RTX)])
 #endif
 
-/* Define a macro which returns non-zero for any tagged type which is
+/* Define a macro which returns nonzero for any tagged type which is
    used (directly or indirectly) in the specification of either some
    function's return type or some formal parameter of some function.
    We use this macro when we are operating in "terse" mode to help us
@@ -611,12 +615,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    for these nodes.  For now, we have to just fake it.  It it safe for
    us to simply return zero for all complete tagged types (which will
    get forced out anyway if they were used in the specification of some
-   formal or return type) and non-zero for all incomplete tagged types.
+   formal or return type) and nonzero for all incomplete tagged types.
 */
 
 #define TYPE_USED_FOR_FUNCTION(tagged_type) (TYPE_SIZE (tagged_type) == 0)
 
-/* Define a macro which returns non-zero for a TYPE_DECL which was
+/* Define a macro which returns nonzero for a TYPE_DECL which was
    implicitly generated for a tagged type.
 
    Note that unlike the gcc front end (which generates a NULL named
@@ -631,8 +635,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
        && is_tagged_type (TREE_TYPE (decl))            \
        && decl == TYPE_STUB_DECL (TREE_TYPE (decl))))
 
-extern int flag_traditional;
-
 /* Maximum size (in bytes) of an artificially generated label. */
 
 #define MAX_ARTIFICIAL_LABEL_BYTES     30
@@ -671,10 +673,6 @@ static unsigned ft_entries;
 
 static const char *primary_filename;
 
-/* Pointer to the most recent filename for which we produced some line info.  */
-
-static const char *last_filename;
-
 /* Counter to generate unique names for DIEs.  */
 
 static unsigned next_unused_dienum = 1;
@@ -712,7 +710,7 @@ static unsigned pending_siblings_allocated;
 
 #define PENDING_SIBLINGS_INCREMENT 64
 
-/* Non-zero if we are performing our file-scope finalization pass and if
+/* Nonzero if we are performing our file-scope finalization pass and if
    we should force out Dwarf descriptions of any and all file-scope
    tagged types which are still incomplete types.  */
 
@@ -762,14 +760,6 @@ static unsigned incomplete_types;
 
 static tree fake_containing_scope;
 
-/* The number of the current function definition that we are generating
-   debugging information for.  These numbers range from 1 up to the maximum
-   number of function definitions contained within the current compilation
-   unit.  These numbers are used to create unique labels for various things
-   contained within various function definitions.  */
-
-static unsigned current_funcdef_number = 1;
-
 /* A pointer to the ..._DECL node which we have most recently been working
    on.  We keep this around just in case something about it looks screwy
    and we want to tell the user what the source coordinates for the actual
@@ -795,9 +785,9 @@ static void dwarfout_end_source_file        PARAMS ((unsigned));
 static void dwarfout_end_source_file_check PARAMS ((unsigned));
 static void dwarfout_begin_block       PARAMS ((unsigned, unsigned));
 static void dwarfout_end_block         PARAMS ((unsigned, unsigned));
-static void dwarfout_end_epilogue      PARAMS ((void));
+static void dwarfout_end_epilogue      PARAMS ((unsigned int, const char *));
 static void dwarfout_source_line       PARAMS ((unsigned int, const char *));
-static void dwarfout_end_prologue      PARAMS ((unsigned int));
+static void dwarfout_end_prologue      PARAMS ((unsigned int, const char *));
 static void dwarfout_end_function      PARAMS ((unsigned int));
 static void dwarfout_function_decl     PARAMS ((tree));
 static void dwarfout_global_decl       PARAMS ((tree));
@@ -948,9 +938,6 @@ static void retry_incomplete_types  PARAMS ((void));
 #ifndef FILE_ASM_OP
 #define FILE_ASM_OP            "\t.file\t"
 #endif
-#ifndef VERSION_ASM_OP
-#define VERSION_ASM_OP         "\t.version\t"
-#endif
 #ifndef SET_ASM_OP
 #define SET_ASM_OP             "\t.set\t"
 #endif
@@ -1031,7 +1018,7 @@ static void retry_incomplete_types        PARAMS ((void));
    stock m88k/svr4 assembler, both of which need to see .L at the start of
    a label in order to prevent that label from going into the linker symbol
    table).  When I get time, I'll have to fix this the right way so that we
-   will use ASM_GENERATE_INTERNAL_LABEL and ASM_OUTPUT_INTERNAL_LABEL herein,
+   will use ASM_GENERATE_INTERNAL_LABEL and (*targetm.asm_out.internal_label) herein,
    but that will require a rather massive set of changes.  For the moment,
    the following definitions out to produce the right results for all svr4
    and svr3 assemblers. -- rfg
@@ -1154,18 +1141,6 @@ static void retry_incomplete_types       PARAMS ((void));
 #ifndef BOUND_END_LABEL_FMT
 #define BOUND_END_LABEL_FMT    "*.L_b%u_%u_%c_e"
 #endif
-#ifndef DERIV_BEGIN_LABEL_FMT
-#define DERIV_BEGIN_LABEL_FMT  "*.L_d%u"
-#endif
-#ifndef DERIV_END_LABEL_FMT
-#define DERIV_END_LABEL_FMT    "*.L_d%u_e"
-#endif
-#ifndef SL_BEGIN_LABEL_FMT
-#define SL_BEGIN_LABEL_FMT     "*.L_sl%u"
-#endif
-#ifndef SL_END_LABEL_FMT
-#define SL_END_LABEL_FMT       "*.L_sl%u_e"
-#endif
 #ifndef BODY_BEGIN_LABEL_FMT
 #define BODY_BEGIN_LABEL_FMT   "*.L_b%u"
 #endif
@@ -1293,12 +1268,12 @@ static void retry_incomplete_types      PARAMS ((void));
   ASM_OUTPUT_ASCII ((FILE), P, strlen (P)+1)
 #else
 #define ASM_OUTPUT_DWARF_STRING_NEWLINE(FILE,P) \
-  ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n") 
+  ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n")
 #endif
 
 \f
 /* The debug hooks structure.  */
-struct gcc_debug_hooks dwarf_debug_hooks =
+const struct gcc_debug_hooks dwarf_debug_hooks =
 {
   dwarfout_init,
   dwarfout_finish,
@@ -1319,7 +1294,8 @@ struct gcc_debug_hooks dwarf_debug_hooks =
   dwarfout_global_decl,
   dwarfout_deferred_inline_function,
   debug_nothing_tree,          /* outlining_inline_function */
-  debug_nothing_rtx            /* label */
+  debug_nothing_rtx,           /* label */
+  debug_nothing_int            /* handle_pch */
 };
 \f
 /************************ general utility functions **************************/
@@ -1329,7 +1305,7 @@ is_pseudo_reg (rtl)
      rtx rtl;
 {
   return (((GET_CODE (rtl) == REG) && (REGNO (rtl) >= FIRST_PSEUDO_REGISTER))
-          || ((GET_CODE (rtl) == SUBREG)
+         || ((GET_CODE (rtl) == SUBREG)
              && (REGNO (SUBREG_REG (rtl)) >= FIRST_PSEUDO_REGISTER)));
 }
 
@@ -1347,13 +1323,13 @@ type_main_variant (type)
   if (TREE_CODE (type) == ARRAY_TYPE)
     {
       while (type != TYPE_MAIN_VARIANT (type))
-        type = TYPE_MAIN_VARIANT (type);
+       type = TYPE_MAIN_VARIANT (type);
     }
 
   return type;
 }
 
-/* Return non-zero if the given type node represents a tagged type.  */
+/* Return nonzero if the given type node represents a tagged type.  */
 
 static inline int
 is_tagged_type (type)
@@ -1613,7 +1589,7 @@ static tree
 decl_ultimate_origin (decl)
      tree decl;
 {
-#ifdef ENABLE_CHECKING 
+#ifdef ENABLE_CHECKING
   if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
     /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
        most distant ancestor, this should never happen.  */
@@ -1711,7 +1687,7 @@ output_signed_leb128 (value)
       if (negative)
        value |= 0xfe000000;  /* manually sign extend */
       if (((value == 0) && ((byte & 0x40) == 0))
-          || ((value == -1) && ((byte & 0x40) == 1)))
+         || ((value == -1) && ((byte & 0x40) == 1)))
        more = 0;
       else
        {
@@ -1978,7 +1954,7 @@ write_modifier_bytes (type, decl_const, decl_volatile)
   write_modifier_bytes_1 (type, decl_const, decl_volatile, 0);
 }
 \f
-/* Given a pointer to an arbitrary ..._TYPE tree node, return non-zero if the
+/* Given a pointer to an arbitrary ..._TYPE tree node, return nonzero if the
    given input type is a Dwarf "fundamental" type.  Otherwise return zero.  */
 
 static inline int
@@ -2090,7 +2066,8 @@ output_reg_number (rtl)
 
   if (regno >= DWARF_FRAME_REGISTERS)
     {
-      warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
+      warning_with_decl (dwarf_last_decl, 
+                        "internal regno botch: `%s' has regno = %d\n",
                         regno);
       regno = 0;
     }
@@ -2122,9 +2099,7 @@ output_mem_loc_descriptor (rtl)
      which is actually within the array.  That's *not* necessarily the
      same as the zeroth element of the array.  */
 
-#ifdef ASM_SIMPLIFY_DWARF_ADDR
-  rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
-#endif
+  rtl = (*targetm.delegitimize_address) (rtl);
 
   switch (GET_CODE (rtl))
     {
@@ -2307,7 +2282,8 @@ output_bound_representation (bound, dim_num, u_or_l)
                   || TREE_CODE (bound) == CONVERT_EXPR)
              bound = TREE_OPERAND (bound, 0);
 
-           if (TREE_CODE (bound) == SAVE_EXPR)
+           if (TREE_CODE (bound) == SAVE_EXPR 
+               && SAVE_EXPR_RTL (bound))
              output_loc_descriptor
                (eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX));
          }
@@ -2845,8 +2821,8 @@ location_or_const_value_attribute (decl)
     if (rtl == NULL_RTX || is_pseudo_reg (rtl))
       {
        /* This decl represents a formal parameter which was optimized out.  */
-        tree declared_type = type_main_variant (TREE_TYPE (decl));
-        tree passed_type = type_main_variant (DECL_ARG_TYPE (decl));
+       tree declared_type = type_main_variant (TREE_TYPE (decl));
+       tree passed_type = type_main_variant (DECL_ARG_TYPE (decl));
 
        /* Note that DECL_INCOMING_RTL may be NULL in here, but we handle
           *all* cases where (rtl == NULL_RTX) just below.  */
@@ -3332,6 +3308,13 @@ member_attribute (context)
 }
 
 #if 0
+#ifndef SL_BEGIN_LABEL_FMT
+#define SL_BEGIN_LABEL_FMT     "*.L_sl%u"
+#endif
+#ifndef SL_END_LABEL_FMT
+#define SL_END_LABEL_FMT       "*.L_sl%u_e"
+#endif
+
 static inline void
 string_length_attribute (upper_bound)
      tree upper_bound;
@@ -3470,10 +3453,10 @@ pure_or_virtual_attribute (func_decl)
     {
 #if 0 /* DECL_ABSTRACT_VIRTUAL_P is C++-specific.  */
       if (DECL_ABSTRACT_VIRTUAL_P (func_decl))
-        ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_pure_virtual);
+       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_pure_virtual);
       else
 #endif
-        ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
+       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
 }
@@ -3512,7 +3495,7 @@ name_and_src_coords_attributes (decl)
        file_index = lookup_filename (DECL_SOURCE_FILE (decl));
        ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
 
-        src_coords_attribute (file_index, DECL_SOURCE_LINE (decl));
+       src_coords_attribute (file_index, DECL_SOURCE_LINE (decl));
       }
 #endif /* defined(DWARF_DECL_COORDINATES) */
     }
@@ -3593,7 +3576,7 @@ type_tag (type)
       if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
        t = TYPE_NAME (type);
 
-      /* The g++ front end makes the TYPE_NAME of *each* tagged type point to 
+      /* The g++ front end makes the TYPE_NAME of *each* tagged type point to
          a TYPE_DECL node, regardless of whether or not a `typedef' was
          involved.  */
       else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
@@ -3900,13 +3883,14 @@ output_global_subroutine_die (arg)
          char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
          low_pc_attribute (function_start_label (decl));
-         sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
+         sprintf (label, FUNC_END_LABEL_FMT, current_function_funcdef_no);
          high_pc_attribute (label);
          if (use_gnu_debug_info_extensions)
            {
-             sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
+             sprintf (label, BODY_BEGIN_LABEL_FMT,
+                      current_function_funcdef_no);
              body_begin_attribute (label);
-             sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
+             sprintf (label, BODY_END_LABEL_FMT, current_function_funcdef_no);
              body_end_attribute (label);
            }
        }
@@ -4156,15 +4140,12 @@ output_compile_unit_die (arg)
     language_attribute (LANG_PASCAL83);
   else if (strcmp (language_string, "GNU Java") == 0)
     language_attribute (LANG_JAVA);
-  else if (flag_traditional)
-    language_attribute (LANG_C);
   else
     language_attribute (LANG_C89);
   low_pc_attribute (TEXT_BEGIN_LABEL);
   high_pc_attribute (TEXT_END_LABEL);
   if (debug_info_level >= DINFO_LEVEL_NORMAL)
     stmt_list_attribute (LINE_BEGIN_LABEL);
-  last_filename = xstrdup (main_input_filename);
 
   {
     const char *wd = getpwd ();
@@ -4177,7 +4158,7 @@ output_compile_unit_die (arg)
       sf_names_attribute (SFNAMES_BEGIN_LABEL);
       src_info_attribute (SRCINFO_BEGIN_LABEL);
       if (debug_info_level >= DINFO_LEVEL_VERBOSE)
-        mac_info_attribute (MACINFO_BEGIN_LABEL);
+       mac_info_attribute (MACINFO_BEGIN_LABEL);
     }
 }
 
@@ -4199,7 +4180,8 @@ static void
 output_inheritance_die (arg)
      void *arg;
 {
-  tree binfo = arg;
+  tree binfo = ((tree *)arg)[0];
+  tree access = ((tree *)arg)[1];
 
   ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_inheritance);
   sibling_attribute ();
@@ -4210,17 +4192,17 @@ output_inheritance_die (arg)
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
-  if (TREE_VIA_PUBLIC (binfo))
+  if (access == access_public_node)
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public);
       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
-  else if (TREE_VIA_PROTECTED (binfo))
+  else if (access == access_protected_node)
     {
       ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected);
       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
     }
-}  
+}
 
 static void
 output_structure_type_die (arg)
@@ -4284,13 +4266,14 @@ output_local_subroutine_die (arg)
        {
          char label[MAX_ARTIFICIAL_LABEL_BYTES];
          low_pc_attribute (function_start_label (decl));
-         sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
+         sprintf (label, FUNC_END_LABEL_FMT, current_function_funcdef_no);
          high_pc_attribute (label);
          if (use_gnu_debug_info_extensions)
            {
-             sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
+             sprintf (label, BODY_BEGIN_LABEL_FMT,
+                      current_function_funcdef_no);
              body_begin_attribute (label);
-             sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
+             sprintf (label, BODY_END_LABEL_FMT, current_function_funcdef_no);
              body_end_attribute (label);
            }
        }
@@ -4553,7 +4536,7 @@ pend_type (type)
   TREE_ASM_WRITTEN (type) = 1;
 }
 
-/* Return non-zero if it is legitimate to output DIEs to represent a
+/* Return nonzero if it is legitimate to output DIEs to represent a
    given type while we are generating the list of child DIEs for some
    DIE (e.g. a function or lexical block DIE) associated with a given scope.
 
@@ -4804,7 +4787,7 @@ output_type (type, containing_scope)
        end_sibling_chain ();
        break;
 
-      case ARRAY_TYPE: 
+      case ARRAY_TYPE:
        if (TYPE_STRING_FLAG (type) && TREE_CODE(TREE_TYPE(type)) == CHAR_TYPE)
          {
            output_type (TREE_TYPE (type), containing_scope);
@@ -4915,18 +4898,25 @@ output_type (type, containing_scope)
 
        if (COMPLETE_TYPE_P (type))
          {
+           tree binfo = TYPE_BINFO (type);
+           
            /* First output info about the base classes.  */
-           if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
+           if (binfo)
              {
-               register tree bases = TYPE_BINFO_BASETYPES (type);
-               register int n_bases = TREE_VEC_LENGTH (bases);
+               tree bases = BINFO_BASETYPES (binfo);
+               tree accesses = BINFO_BASEACCESSES (binfo);
+               register int n_bases = BINFO_N_BASETYPES (binfo);
                register int i;
 
                for (i = 0; i < n_bases; i++)
                  {
-                   tree binfo = TREE_VEC_ELT (bases, i);
+                   tree arg[2];
+
+                   arg[0] = TREE_VEC_ELT (bases, i);
+                   arg[1] = (accesses ? TREE_VEC_ELT (accesses, i)
+                             : access_public_node);
                    output_type (BINFO_TYPE (binfo), containing_scope);
-                   output_die (output_inheritance_die, binfo);
+                   output_die (output_inheritance_die, arg);
                  }
              }
 
@@ -5159,8 +5149,8 @@ output_decls_for_scope (stmt, depth)
     tree subblocks;
 
     for (subblocks = BLOCK_SUBBLOCKS (stmt);
-         subblocks;
-         subblocks = BLOCK_CHAIN (subblocks))
+        subblocks;
+        subblocks = BLOCK_CHAIN (subblocks))
       output_block (subblocks, depth + 1);
   }
 }
@@ -5206,10 +5196,10 @@ output_decl (decl, containing_scope)
   if ((TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
        || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE)
       && ((DECL_NAME (decl) == 0 && TYPE_NAME (TREE_TYPE (decl)) == 0)
-         || (TYPE_FIELDS (TREE_TYPE (decl)) 
+         || (TYPE_FIELDS (TREE_TYPE (decl))
              && (TREE_CODE (TYPE_FIELDS (TREE_TYPE (decl))) == ERROR_MARK))))
     return;
-  
+
   /* If this ..._DECL node is marked to be ignored, then ignore it.  */
 
   if (DECL_IGNORED_P (decl))
@@ -5334,7 +5324,7 @@ output_decl (decl, containing_scope)
 
          for (parm = arg_decls; parm; parm = TREE_CHAIN (parm))
            if (TREE_CODE (parm) == PARM_DECL)
-              {
+             {
                if (DECL_NAME(parm) &&
                    !strcmp(IDENTIFIER_POINTER(DECL_NAME(parm)),
                            "__builtin_va_alist") )
@@ -5371,13 +5361,13 @@ output_decl (decl, containing_scope)
              /* this is the prototyped case, check for ...  */
              if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node)
                output_die (output_unspecified_parameters_die, decl);
-              }
-            else
-              {
-             /* this is unprototyped, check for undefined (just declaration) */
-              if (!DECL_INITIAL (decl))
-                output_die (output_unspecified_parameters_die, decl);
-              }
+             }
+           else
+             {
+               /* this is unprototyped, check for undefined (just declaration) */
+               if (!DECL_INITIAL (decl))
+                 output_die (output_unspecified_parameters_die, decl);
+             }
          }
 
          /* Output Dwarf info for all of the stuff within the body of the
@@ -5436,7 +5426,7 @@ output_decl (decl, containing_scope)
       if (debug_info_level <= DINFO_LEVEL_TERSE)
        if (! TYPE_DECL_IS_STUB (decl)
            || (! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)) && ! in_class))
-          return;
+         return;
 
       /* In the special case of a TYPE_DECL node representing
         the declaration of some type tag, if the given TYPE_DECL is
@@ -5477,7 +5467,7 @@ output_decl (decl, containing_scope)
         any variable declarations or definitions.  */
 
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-        break;
+       break;
 
       /* Output any DIEs that are needed to specify the type of this data
         object.  */
@@ -5511,7 +5501,7 @@ output_decl (decl, containing_scope)
         function.  */
 
       {
-        void (*func) PARAMS ((void *));
+       void (*func) PARAMS ((void *));
        register tree origin = decl_ultimate_origin (decl);
 
        if (origin != NULL && TREE_CODE (origin) == PARM_DECL)
@@ -5532,7 +5522,7 @@ output_decl (decl, containing_scope)
       if (DECL_NAME (decl) != 0)
        {
          output_type (member_declared_type (decl), containing_scope);
-          output_die (output_member_die, decl);
+         output_die (output_member_die, decl);
        }
       break;
 
@@ -5632,7 +5622,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
         these same functions should NOT be ignored however.  */
 
       if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
-        return;
+       return;
 
       /* What we would really like to do here is to filter out all mere
         file-scope declarations of file-scope functions which are never
@@ -5732,7 +5722,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
              ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_ARANGES_SECTION);
              ASM_OUTPUT_DWARF_ADDR (asm_out_file,
                              IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
-             ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 
+             ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
                        (unsigned) int_size_in_bytes (TREE_TYPE (decl)));
              ASM_OUTPUT_POP_SECTION (asm_out_file);
            }
@@ -5742,7 +5732,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
         any variable declarations or definitions.  */
 
       if (debug_info_level <= DINFO_LEVEL_TERSE)
-        return;
+       return;
 
       break;
 
@@ -5780,7 +5770,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
       if (debug_info_level <= DINFO_LEVEL_TERSE)
        if (! TYPE_DECL_IS_STUB (decl)
            || ! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
-          return;
+         return;
 
       break;
 
@@ -5810,7 +5800,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
      if this is not a nested function or class.  If this is a nested type,
      then the remaining pending_types will be emitted when the containing type
      is handled.  */
-  
+
   if (! DECL_CONTEXT (decl))
     {
       if (pending_types != 0)
@@ -5818,9 +5808,6 @@ dwarfout_file_scope_decl (decl, set_finalizing)
     }
 
   ASM_OUTPUT_POP_SECTION (asm_out_file);
-
-  if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
-    current_funcdef_number++;
 }
 \f
 /* Output a marker (i.e. a label) for the beginning of the generated code
@@ -5858,8 +5845,9 @@ dwarfout_end_block (line, blocknum)
    to their home locations).  */
 
 static void
-dwarfout_end_prologue (line)
+dwarfout_end_prologue (line, file)
      unsigned int line ATTRIBUTE_UNUSED;
+     const char *file ATTRIBUTE_UNUSED;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
@@ -5867,7 +5855,7 @@ dwarfout_end_prologue (line)
     return;
 
   function_section (current_function_decl);
-  sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
+  sprintf (label, BODY_BEGIN_LABEL_FMT, current_function_funcdef_no);
   ASM_OUTPUT_LABEL (asm_out_file, label);
 }
 
@@ -5883,7 +5871,7 @@ dwarfout_end_function (line)
   if (! use_gnu_debug_info_extensions)
     return;
   function_section (current_function_decl);
-  sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
+  sprintf (label, BODY_END_LABEL_FMT, current_function_funcdef_no);
   ASM_OUTPUT_LABEL (asm_out_file, label);
 }
 
@@ -5892,14 +5880,16 @@ dwarfout_end_function (line)
    has been generated. */
 
 static void
-dwarfout_end_epilogue ()
+dwarfout_end_epilogue (line, file)
+     unsigned int line ATTRIBUTE_UNUSED;
+     const char *file ATTRIBUTE_UNUSED;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
   /* Output a label to mark the endpoint of the code generated for this
      function. */
 
-  sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
+  sprintf (label, FUNC_END_LABEL_FMT, current_function_funcdef_no);
   ASM_OUTPUT_LABEL (asm_out_file, label);
 }
 
@@ -5939,9 +5929,9 @@ generate_new_sfname_entry ()
   sprintf (label, SFNAMES_ENTRY_LABEL_FMT, filename_table[0].number);
   ASM_OUTPUT_LABEL (asm_out_file, label);
   ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
-                          filename_table[0].name
-                            ? filename_table[0].name
-                            : "");
+                                  filename_table[0].name
+                                  ? filename_table[0].name
+                                  : "");
   ASM_OUTPUT_POP_SECTION (asm_out_file);
 }
 
@@ -5993,7 +5983,7 @@ lookup_filename (file_name)
           same filename will find it as quickly as possible.  */
 
        shuffle_filename_entry (search_p);
-        return filename_table[0].number;
+       return filename_table[0].number;
       }
 
   /* We come here whenever we have a new filename which is not registered
@@ -6071,18 +6061,18 @@ dwarfout_source_line (line, filename)
 
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
       if (this_file_entry_num != prev_file_entry_num)
-        {
-          char line_entry_label[MAX_ARTIFICIAL_LABEL_BYTES];
+       {
+         char line_entry_label[MAX_ARTIFICIAL_LABEL_BYTES];
 
-          sprintf (line_entry_label, LINE_ENTRY_LABEL_FMT, last_line_entry_num);
-          ASM_OUTPUT_LABEL (asm_out_file, line_entry_label);
-        }
+         sprintf (line_entry_label, LINE_ENTRY_LABEL_FMT, last_line_entry_num);
+         ASM_OUTPUT_LABEL (asm_out_file, line_entry_label);
+       }
 
       {
-        const char *tail = strrchr (filename, '/');
+       const char *tail = strrchr (filename, '/');
 
-        if (tail != NULL)
-          filename = tail;
+       if (tail != NULL)
+         filename = tail;
       }
 
       dw2_asm_output_data (4, line, "%s:%u", filename, line);
@@ -6091,7 +6081,7 @@ dwarfout_source_line (line, filename)
       ASM_OUTPUT_POP_SECTION (asm_out_file);
 
       if (this_file_entry_num != prev_file_entry_num)
-        generate_srcinfo_entry (last_line_entry_num, this_file_entry_num);
+       generate_srcinfo_entry (last_line_entry_num, this_file_entry_num);
       prev_file_entry_num = this_file_entry_num;
     }
 }
@@ -6198,6 +6188,8 @@ static void
 dwarfout_init (main_input_filename)
      const char *main_input_filename;
 {
+  warning ("support for the DWARF1 debugging format is deprecated");
+
   /* Remember the name of the primary input file.  */
 
   primary_filename = main_input_filename;
@@ -6284,7 +6276,7 @@ dwarfout_init (main_input_filename)
          /* Output a starting label and an initial (compilation directory)
             entry for the .debug_sfnames section.  The starting label will be
             referenced by the initial entry in the .debug_srcinfo section.  */
-    
+
          fputc ('\n', asm_out_file);
          ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SFNAMES_SECTION);
          ASM_OUTPUT_LABEL (asm_out_file, SFNAMES_BEGIN_LABEL);
@@ -6293,7 +6285,7 @@ dwarfout_init (main_input_filename)
            char *dirname;
 
            if (!pwd)
-             fatal_io_error ("can't get current directory");
+             fatal_error ("can't get current directory: %m");
 
            dirname = concat (pwd, "/", NULL);
            ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname);
@@ -6301,29 +6293,29 @@ dwarfout_init (main_input_filename)
          }
          ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
-    
+
       if (debug_info_level >= DINFO_LEVEL_VERBOSE
          && use_gnu_debug_info_extensions)
        {
-          /* Output a starting label for the .debug_macinfo section.  This
+         /* Output a starting label for the .debug_macinfo section.  This
             label will be referenced by the AT_mac_info attribute in the
             TAG_compile_unit DIE.  */
-        
-          fputc ('\n', asm_out_file);
-          ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_MACINFO_SECTION);
-          ASM_OUTPUT_LABEL (asm_out_file, MACINFO_BEGIN_LABEL);
-          ASM_OUTPUT_POP_SECTION (asm_out_file);
+
+         fputc ('\n', asm_out_file);
+         ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_MACINFO_SECTION);
+         ASM_OUTPUT_LABEL (asm_out_file, MACINFO_BEGIN_LABEL);
+         ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
 
       /* Generate the initial entry for the .line section.  */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
       ASM_OUTPUT_LABEL (asm_out_file, LINE_BEGIN_LABEL);
       ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, LINE_END_LABEL, LINE_BEGIN_LABEL);
       ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
       ASM_OUTPUT_POP_SECTION (asm_out_file);
-    
+
       if (use_gnu_debug_info_extensions)
        {
          /* Generate the initial entry for the .debug_srcinfo section.  */
@@ -6342,16 +6334,16 @@ dwarfout_init (main_input_filename)
 #endif
          ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
-    
+
       /* Generate the initial entry for the .debug_pubnames section.  */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_PUBNAMES_SECTION);
       ASM_OUTPUT_DWARF_ADDR (asm_out_file, DEBUG_BEGIN_LABEL);
       ASM_OUTPUT_POP_SECTION (asm_out_file);
-    
+
       /* Generate the initial entry for the .debug_aranges section.  */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_ARANGES_SECTION);
       ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
@@ -6477,7 +6469,7 @@ dwarfout_finish (main_input_filename)
   if (debug_info_level >= DINFO_LEVEL_NORMAL)
     {
       /* Output a terminating entry for the .line section.  */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
       ASM_OUTPUT_LABEL (asm_out_file, LINE_LAST_ENTRY_LABEL);
@@ -6486,7 +6478,7 @@ dwarfout_finish (main_input_filename)
       ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, TEXT_END_LABEL, TEXT_BEGIN_LABEL);
       ASM_OUTPUT_LABEL (asm_out_file, LINE_END_LABEL);
       ASM_OUTPUT_POP_SECTION (asm_out_file);
-    
+
       if (use_gnu_debug_info_extensions)
        {
          /* Output a terminating entry for the .debug_srcinfo section.  */
@@ -6502,7 +6494,7 @@ dwarfout_finish (main_input_filename)
       if (debug_info_level >= DINFO_LEVEL_VERBOSE)
        {
          /* Output terminating entries for the .debug_macinfo section.  */
-       
+
          dwarfout_end_source_file (0);
 
          fputc ('\n', asm_out_file);
@@ -6511,15 +6503,15 @@ dwarfout_finish (main_input_filename)
          ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
          ASM_OUTPUT_POP_SECTION (asm_out_file);
        }
-    
+
       /* Generate the terminating entry for the .debug_pubnames section.  */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_PUBNAMES_SECTION);
       ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
       ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
       ASM_OUTPUT_POP_SECTION (asm_out_file);
-    
+
       /* Generate the terminating entries for the .debug_aranges section.
 
         Note that we want to do this only *after* we have output the end
@@ -6533,7 +6525,7 @@ dwarfout_finish (main_input_filename)
         entries at this late point in the assembly output, we skirt the
         issue simply by avoiding forward-references.
       */
-    
+
       fputc ('\n', asm_out_file);
       ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_ARANGES_SECTION);