From patchwork Mon Sep 13 07:31:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 44937 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 075C63857C44 for ; Mon, 13 Sep 2021 07:31:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 075C63857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1631518300; bh=q2gMOGPOp9Jy0lLnNCfyQ6hw5CPBhCN+u23zT+khzNQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=pevkrLLngPYev3k05HeMXm388DiDAsRBG+gpM+mlMHYCOR4XQGjk3OL15/4nJlFXv wbJ2wnIXb1jX1XtY76lcKH/Ocl14J5JLhlhOQdUeIxxlChPw75AJak5G9l+FsZ7v0k TGEgiHz5D75K2vS8AM3bFaf/RZc/Zuoq/cjEbf+g= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 51F593858D35 for ; Mon, 13 Sep 2021 07:31:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51F593858D35 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2914B21F41; Mon, 13 Sep 2021 07:31:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 03FC013A09; Mon, 13 Sep 2021 07:31:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 53aQOzz+PmEZNAAAMHmgww (envelope-from ); Mon, 13 Sep 2021 07:31:08 +0000 Date: Mon, 13 Sep 2021 09:31:08 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH][v2] Always default to DWARF2_DEBUG if not specified, warn about deprecated STABS Message-ID: <66161527-98n2-3060-49ss-67oro67381nq@fhfr.qr> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Cc: dave.anglin@bell.net, schwab@linux-m68k.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. This leaves the following targets without debug support: pdp11-*-* pdp11 is a.out, dwarf support is difficult m68k*-*-openbsd* it looks like this is a.out as well, at least it does not pretend to support DWARF hppa[12]*-*-hpux10* does seem to not support DWARF vax-*-openbsd* seems to be a.out as well, does not support DWARF behavior will be like > ./cc1 -quiet t.c -g cc1: warning: target system does not support debug output > ./cc1 -quiet t.c -gstabs t.c: warning: STABS debugging information is obsolete and not supported anymore that is, -g is unsupported but -gstabs will generate STABS (the above is for pdp11). It would be nice if maintainers could confirm the above listed configurations do not support DWARF and weight in whether to (apart from pdp11) the specific configurations can be obsoleted or adjusted. It looks like we do not have any openbsd maintainer. I've discussed the situation for pdp11 with Paul already at some point but we didn't reach any conclusion besides that it would be nice to move pdp11 to ELF. 2021-09-10 Richard Biener 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..c390524babb 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\]*\[Ww\]arning: 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)