From f8ca7e49b358124e451580bf3bcd3b1d3cb05608 Mon Sep 17 00:00:00 2001
From: Zack Weinberg <zack@codesourcery.com>
Date: Wed, 25 Aug 2004 07:34:54 +0000
Subject: [PATCH] flags.h (enum debug_info_type): Remove DWARF_DEBUG.

	* flags.h (enum debug_info_type): Remove DWARF_DEBUG.
	* defaults.h (PREFERRED_DEBUGGING_TYPE): Remove check for
	DWARF_DEBUGGING_INFO from choice-of-definition chain;
	restructure using C89 features (#elif, #error).
	* c-lex.c, final.c, opts.c, config/cris/cris.c, config/frv/frv.c
	* config/sh/sh.h: Remove references to DWARF_DEBUG.
	* doc/invoke.texi: Remove references to DWARF version 1;
	clarify why -gdwarf-2<n> doesn't work.
cp:
	* class.c, search.c: Remove references to DWARF_DEBUG.

From-SVN: r86540
---
 gcc/ChangeLog          | 11 +++++++++++
 gcc/c-lex.c            |  2 +-
 gcc/config/cris/cris.c |  3 +--
 gcc/config/frv/frv.c   |  5 -----
 gcc/config/sh/sh.h     |  3 +--
 gcc/cp/ChangeLog       |  4 ++++
 gcc/cp/class.c         |  2 +-
 gcc/cp/search.c        | 10 +---------
 gcc/defaults.h         | 42 +++++++++++++++++++-----------------------
 gcc/doc/invoke.texi    | 20 +++++++++++++-------
 gcc/final.c            |  2 --
 gcc/flags.h            |  1 -
 gcc/opts.c             |  4 +---
 13 files changed, 53 insertions(+), 56 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0168ed18e0a1..1f1758ed13e1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2004-08-25  Zack Weinberg  <zack@codesourcery.com>
+
+	* flags.h (enum debug_info_type): Remove DWARF_DEBUG.
+	* defaults.h (PREFERRED_DEBUGGING_TYPE): Remove check for
+	DWARF_DEBUGGING_INFO from choice-of-definition chain;
+	restructure using C89 features (#elif, #error).
+	* c-lex.c, final.c, opts.c, config/cris/cris.c, config/frv/frv.c
+	* config/sh/sh.h: Remove references to DWARF_DEBUG.
+	* doc/invoke.texi: Remove references to DWARF version 1;
+	clarify why -gdwarf-2<n> doesn't work.
+
 2004-08-25  Zack Weinberg  <zack@codesourcery.com>
 
 	* basic-block.h (BB_SET_PARTITION): Clear old value first.
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 7fc47ba8db3d..74f8be69c94e 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -104,7 +104,7 @@ init_c_lex (void)
 
   /* Set the debug callbacks if we can use them.  */
   if (debug_info_level == DINFO_LEVEL_VERBOSE
-      && (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG
+      && (write_symbols == DWARF2_DEBUG
           || write_symbols == VMS_AND_DWARF2_DEBUG))
     {
       cb->define = cb_define;
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 50f5e59bf78a..25db5ecc34fc 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -2712,8 +2712,7 @@ cris_override_options (void)
       flag_no_function_cse = 1;
     }
 
-  if ((write_symbols == DWARF_DEBUG
-       || write_symbols == DWARF2_DEBUG) && ! TARGET_ELF)
+  if (write_symbols == DWARF2_DEBUG && ! TARGET_ELF)
     {
       warning ("that particular -g option is invalid with -maout and -melinux");
       write_symbols = DBX_DEBUG;
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index ccc26cffa5b1..7bd22f25af98 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -502,11 +502,6 @@ frv_override_options (void)
 	}
     }
 
-  /* Both -fpic and -gdwarf want to use .previous and the assembler only keeps
-     one level.  */
-  if (write_symbols == DWARF_DEBUG && flag_pic)
-    error ("-fpic and -gdwarf are incompatible (-fpic and -g/-gdwarf-2 are fine)");
-
   /* Change the branch cost value.  */
   if (frv_branch_cost_string)
     frv_branch_cost_int = atoi (frv_branch_cost_string);
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index c24966145298..5f6cc48f1cca 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -778,8 +778,7 @@ do {									\
         but gdb doesn't implement this yet */				\
      if (0)								\
       flag_omit_frame_pointer						\
-        = (PREFERRED_DEBUGGING_TYPE == DWARF_DEBUG			\
-	   || PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG);		\
+        = (PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG);			\
      else								\
       flag_omit_frame_pointer = 0;					\
    }									\
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8a23b73db262..d654d655455d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2004-08-25  Zack Weinberg  <zack@codesourcery.com>
+
+	* class.c, search.c: Remove references to DWARF_DEBUG.
+
 2004-08-25  Adam Nemet  <anemet@lnxw.com>
 
 	* repo.c (extract_string): Reset backquote after one character.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c7294146b3a0..e17a438b7992 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -636,7 +636,7 @@ build_vtable (tree class_type, tree name, tree vtable_type)
   DECL_EXTERNAL (decl) = 1;
   DECL_NOT_REALLY_EXTERN (decl) = 1;
 
-  if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
+  if (write_symbols == DWARF2_DEBUG)
     /* Mark the VAR_DECL node representing the vtable itself as a
        "gratuitous" one, thereby forcing dwarfout.c to ignore it.  It
        is rather important that such things be ignored because any
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 4aadf78adf8f..1c52a941c4ab 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1965,15 +1965,7 @@ dfs_unmark (tree binfo, void *data ATTRIBUTE_UNUSED)
 void
 maybe_suppress_debug_info (tree t)
 {
-  /* We can't do the usual TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
-     does not support name references between translation units.  It supports
-     symbolic references between translation units, but only within a single
-     executable or shared library.
-
-     For DWARF 2, we handle TYPE_DECL_SUPPRESS_DEBUG by pretending
-     that the type was never defined, so we only get the members we
-     actually define.  */
-  if (write_symbols == DWARF_DEBUG || write_symbols == NO_DEBUG)
+  if (write_symbols == NO_DEBUG)
     return;
 
   /* We might have set this earlier in cp_finish_decl.  */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 7f110d6c3e9c..d16adf4ad4a8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -535,38 +535,34 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
 #endif
 
 /* If more than one debugging type is supported, you must define
-   PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
+   PREFERRED_DEBUGGING_TYPE to choose the default.  */
 
-   This is one long line cause VAXC can't handle a \-newline.  */
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) + defined (VMS_DEBUGGING_INFO))
+#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \
+         + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \
+         + defined (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
-You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
+#error You must define PREFERRED_DEBUGGING_TYPE
 #endif /* no PREFERRED_DEBUGGING_TYPE */
-#else /* Only one debugging format supported.  Define PREFERRED_DEBUGGING_TYPE
-	 so other code needn't care.  */
-#ifdef DBX_DEBUGGING_INFO
+
+/* If only one debugging format is supported, define PREFERRED_DEBUGGING_TYPE
+   here so other code needn't care.  */
+#elif defined DBX_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#endif
-#ifdef SDB_DEBUGGING_INFO
+
+#elif defined SDB_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-#endif
-#ifdef DWARF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
+
+#elif defined DWARF2_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-#endif
-#ifdef VMS_DEBUGGING_INFO
+
+#elif defined VMS_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
+
+#elif defined XCOFF_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
-#endif
-#endif /* More than one debugger format enabled.  */
 
-/* If still not defined, must have been because no debugging formats
-   are supported.  */
-#ifndef PREFERRED_DEBUGGING_TYPE
+#else
+/* No debugging format is supported by this target.  */
 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
 #endif
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 0da40754606f..e10718901f03 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3115,7 +3115,7 @@ either your program or GCC:
 @item -g
 @opindex g
 Produce debugging information in the operating system's native format
-(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
+(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
 information.
 
 On most systems that use stabs format, @option{-g} enables use of extra
@@ -3126,7 +3126,7 @@ refuse to read the program.  If you want to control for certain whether
 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
 
-Unlike most other C compilers, GCC allows you to use @option{-g} with
+GCC allows you to use @option{-g} with
 @option{-O}.  The shortcuts taken by optimized code may occasionally
 produce surprising results: some variables you declared may not exist
 at all; flow of control may briefly move where you did not expect it;
@@ -3189,7 +3189,10 @@ assembler (GAS) to fail with an error.
 @item -gdwarf-2
 @opindex gdwarf-2
 Produce debugging information in DWARF version 2 format (if that is
-supported).  This is the format used by DBX on IRIX 6.
+supported).  This is the format used by DBX on IRIX 6.  With this
+option, GCC uses features of DWARF version 3 when they are useful;
+version 3 is upward compatible with version 2, but may still cause
+problems for older debuggers.
 
 @item -gvms
 @opindex gvms
@@ -3214,10 +3217,13 @@ Level 3 includes extra information, such as all the macro definitions
 present in the program.  Some debuggers support macro expansion when
 you use @option{-g3}.
 
-Note that in order to avoid confusion between DWARF1 debug level 2,
-and DWARF2 @option{-gdwarf-2} does not accept a concatenated debug
-level.  Instead use an additional @option{-g@var{level}} option to
-change the debug level for DWARF2.
+@option{-gdwarf-2} does not accept a concatenated debug level, because
+GCC used to support an option @option{-gdwarf} that meant to generate
+debug information in version 1 of the DWARF format (which is very
+different from version 2), and it would have been too confusing.  That
+debug format is long obsolete, but the option cannot be changed now.
+Instead use an additional @option{-g@var{level}} option to change the
+debug level for DWARF2.
 
 @item -feliminate-dwarf2-dups
 @opindex feliminate-dwarf2-dups
diff --git a/gcc/final.c b/gcc/final.c
index a59f3a2074c8..5b6767853a57 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1793,7 +1793,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
 	case NOTE_INSN_BLOCK_BEG:
 	  if (debug_info_level == DINFO_LEVEL_NORMAL
 	      || debug_info_level == DINFO_LEVEL_VERBOSE
-	      || write_symbols == DWARF_DEBUG
 	      || write_symbols == DWARF2_DEBUG
 	      || write_symbols == VMS_AND_DWARF2_DEBUG
 	      || write_symbols == VMS_DEBUG)
@@ -1815,7 +1814,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
 	case NOTE_INSN_BLOCK_END:
 	  if (debug_info_level == DINFO_LEVEL_NORMAL
 	      || debug_info_level == DINFO_LEVEL_VERBOSE
-	      || write_symbols == DWARF_DEBUG
 	      || write_symbols == DWARF2_DEBUG
 	      || write_symbols == VMS_AND_DWARF2_DEBUG
 	      || write_symbols == VMS_DEBUG)
diff --git a/gcc/flags.h b/gcc/flags.h
index 542a53fea389..c0fcc3c256d0 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -30,7 +30,6 @@ enum debug_info_type
   NO_DEBUG,	    /* Write no debug info.  */
   DBX_DEBUG,	    /* Write BSD .stabs for DBX (using dbxout.c).  */
   SDB_DEBUG,	    /* Write COFF for (old) SDB (using sdbout.c).  */
-  DWARF_DEBUG,	    /* Write Dwarf debug info (using dwarfout.c).  */
   DWARF2_DEBUG,	    /* Write Dwarf v2 debug info (using dwarf2out.c).  */
   XCOFF_DEBUG,	    /* Write IBM/Xcoff debug info (using dbxout.c).  */
   VMS_DEBUG,        /* Write VMS debug info (using vmsdbgout.c).  */
diff --git a/gcc/opts.c b/gcc/opts.c
index a6a7c337b217..b802bcf35a2d 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -647,9 +647,7 @@ decode_options (unsigned int argc, const char **argv)
      work correctly with DWARF debugging turned on.  Until this is fixed
      we will disable the optimization when DWARF debugging is set.  */
   
-  if (flag_reorder_blocks_and_partition
-      && (write_symbols == DWARF_DEBUG
-	  || write_symbols == DWARF2_DEBUG))
+  if (flag_reorder_blocks_and_partition && write_symbols == DWARF2_DEBUG)
     {
       warning
 	("-freorder-blocks-and-partition does not work with -g (currently)");
-- 
GitLab