public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Always default to DWARF2_DEBUG if not specified, warn about deprecated STABS
Date: Fri, 10 Sep 2021 14:12:08 +0200 (CEST)	[thread overview]
Message-ID: <op904q4q-sq37-2594-761-s315543r820@fhfr.qr> (raw)

This makes defaults.h choose DWARF2_DEBUG if PREFERRED_DEBUGGING_TYPE
is not specified by the target and NO_DEBUG if DWARF is not supported.

It also makes us warn when STABS is enabled and removes the corresponding
diagnostic from the Ada frontend.  The warnings are pruned from the
testsuite output via prune_gcc_output but somehow this doesn't work
for the tests in gfortran.dg/debug which are now failing with excess
errors.  That seems to be the case for other fortran .exp as well
when appending -gstabs, something which works fine for gcc or g++ dgs.

Bootstrapped / tested on x86_64-unknown-linux-gnu with the mentioned
excess errors from all gfortran.dg/debug/

I need to still edit doc/invoke.texi somehow but I wonder if somebody
has insights into the testsuite pruning issue.

Richard.

2021-09-10  Richard Biener  <rguenther@suse.de>

gcc/
	* defaults.h (PREFERRED_DEBUGGING_TYPE): Choose DWARF2_DEBUG
	or NO_DEBUG.
	* toplev.c (process_options): Warn when STABS debugging is
	enabled.

gcc/ada/
	* gcc-interface/misc.c (gnat_post_options): Do not warn
	about DBX_DEBUG use here.

gcc/testsuite/
	* lib/prune.exp: Prune STABS obsoletion message.
---
 gcc/ada/gcc-interface/misc.c |  6 ------
 gcc/defaults.h               | 27 ++++-----------------------
 gcc/testsuite/lib/prune.exp  |  3 +++
 gcc/toplev.c                 |  5 +++++
 4 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 96199bd4b63..87a4c8662cb 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -274,12 +274,6 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   if (!global_options_set.x_flag_diagnostics_show_caret)
     global_dc->show_caret = false;
 
-  /* Warn only if STABS is not the default: we don't want to emit a warning if
-     the user did not use a -gstabs option.  */
-  if (PREFERRED_DEBUGGING_TYPE != DBX_DEBUG && write_symbols == DBX_DEBUG)
-    warning (0, "STABS debugging information for Ada is obsolete and not "
-		"supported anymore");
-
   /* Copy global settings to local versions.  */
   gnat_encodings = global_options.x_gnat_encodings;
   optimize = global_options.x_optimize;
diff --git a/gcc/defaults.h b/gcc/defaults.h
index ba79a8e48ed..773b93b1a2e 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -900,34 +900,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define DEFAULT_GDB_EXTENSIONS 1
 #endif
 
-/* If more than one debugging type is supported, you must define
-   PREFERRED_DEBUGGING_TYPE to choose the default.  */
-
-#if 1 < (defined (DBX_DEBUGGING_INFO) \
-         + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \
-         + defined (VMS_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
-#error You must define PREFERRED_DEBUGGING_TYPE
-#endif /* no PREFERRED_DEBUGGING_TYPE */
-
-/* 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
-
-#elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
+/* We default to DWARF2_DEBUGGING_INFO.  */
+#if defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-
-#elif defined VMS_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
-
-#elif defined XCOFF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
-
 #else
-/* No debugging format is supported by this target.  */
+/* DWARF is not supported by this target.  */
 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
 #endif
+#endif
 
 #ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL
 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false
diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp
index 91f165bec38..62fcd3731cc 100644
--- a/gcc/testsuite/lib/prune.exp
+++ b/gcc/testsuite/lib/prune.exp
@@ -90,6 +90,9 @@ proc prune_gcc_output { text } {
     # Ignore dsymutil warning (tool bug is actually linker)
     regsub -all "(^|\n)\[^\n\]*could not find object file symbol for symbol\[^\n\]*" $text "" text
 
+    # Ignore stabs obsoletion warnings
+    regsub -all "(^|\n)\[^\n\]*warning: STABS debugging information is obsolete and not supported anymore\[^\n\]*" $text "" text
+
     # If dg-enable-nn-line-numbers was provided, then obscure source-margin
     # line numbers by converting them to "NN" form.
     set text [maybe-handle-nn-line-numbers $text]
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 14d1335e79e..2b58fd373bf 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1452,6 +1452,11 @@ process_options (void)
       && ctf_debug_info_level == CTFINFO_LEVEL_NONE)
     write_symbols = NO_DEBUG;
 
+  /* Warn if STABS debug gets enabled.  */
+  if (write_symbols & DBX_DEBUG)
+    warning (0, "STABS debugging information is obsolete and not "
+	     "supported anymore");
+
   if (write_symbols == NO_DEBUG)
     ;
 #if defined(DBX_DEBUGGING_INFO)
-- 
2.31.1

             reply	other threads:[~2021-09-10 12:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 12:12 Richard Biener [this message]
2021-09-10 15:08 ` Michael Matz
2021-09-21 14:25 Richard Biener
2021-09-28  6:14 ` Richard Biener
2021-09-28 13:18   ` Koning, Paul
2021-10-15  8:23     ` Richard Biener
2021-10-23 20:00 ` Jan-Benedict Glaw
2021-10-23 22:19   ` Jeff Law
2021-10-24  6:36   ` Richard Biener
2021-10-24  7:20     ` Jan-Benedict Glaw
2021-10-25  8:25       ` Richard Biener
2021-10-26  1:28         ` Joseph Myers
2021-10-29 14:48           ` ibuclaw
2022-08-28  7:50 ` Jan-Benedict Glaw
2022-08-28 21:32   ` Jeff Law
2022-08-29 20:11     ` Jan-Benedict Glaw
2022-08-31 16:05       ` Jeff Law
2022-09-07 10:50       ` Jan-Benedict Glaw
2022-09-07 11:57         ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op904q4q-sq37-2594-761-s315543r820@fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).