From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 477E33858C2C for ; Tue, 28 Sep 2021 06:14:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 477E33858C2C Received: by mail-ed1-x52f.google.com with SMTP id x7so64106320edd.6 for ; Mon, 27 Sep 2021 23:14:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a9mOHAt8yf/EtXBgJJzST2rlPOoXdDzcLENmY6Oj444=; b=hUrWI35aEx/LbW8BjUery3eR0ggMvm9nldxTHzRPFpuppS3BeVgjJezF1llcLPHv55 QL/+R9u2NfWFb5NJhG3Jfq8FgS+NCWICi8oVcPvF5eqrZgFdgJvYGhbTJGqVRzDtYI8S +nQuX3YhWNDDkiVuD7KJ2MVZmgCKqH73kZGEzxQQA1kPqlL7Z93Pmqghr1NQtdN+03fe ldT2LkiUauxprWYcPh+3ZW5cntmIoNytFsOvo4qwjkp/GZOn4cxgdIrix5aNBPyQ9xH5 CMtvG/hycpxwdMkqQIFEfnbyu+27MhQTIzFAY+asnbYuXpRSYMluc8HXwRGWOa42Noon BbUA== X-Gm-Message-State: AOAM533CSaPIm1z4ofP0TUWXM/qg8pMhDF9XCi/08BfgseygjiClHKVS DsYHUeFwaDh4vRq3QXwl/261QxQwPa3yyed8yB4= X-Google-Smtp-Source: ABdhPJwd8DdMXbIFF6KHH51KhVgkoFr7Mdv3yKM4cEj86KNpqVCSm0juje5bEw1hrsJBSsXGioyB6NVk6lH7RZkG2PU= X-Received: by 2002:a17:907:244a:: with SMTP id yw10mr4603022ejb.571.1632809664142; Mon, 27 Sep 2021 23:14:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 28 Sep 2021 08:14:13 +0200 Message-ID: Subject: Re: [PATCH] Always default to DWARF2_DEBUG if not specified, warn about deprecated STABS To: Richard Biener Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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-List-Received-Date: Tue, 28 Sep 2021 06:14:27 -0000 On Tue, Sep 21, 2021 at 4:26 PM Richard Biener via Gcc-patches wrote: > > This makes defaults.h choose DWARF2_DEBUG if PREFERRED_DEBUGGING_TYPE > is not specified by the target and errors out if DWARF DWARF is not supported. > > It also makes us warn when STABS is enabled but not the preferred > debugging type and removes the corresponding diagnostic from the Ada frontend. > The warnings are pruned from the testsuite output via prune_gcc_output. > > The following target configurations now explicitely default to STABS: > pdp11-*-* pdp11 is a.out, dwarf support is difficult > hppa[12]*-*-hpux10* does not support DWARF > hppa[12]*-*-hpux11* likewise > note that the hppa configs have been deprecated. > > Targets with DWARF support will now see > > ./cc1 -quiet t.c -gstabs > t.c: warning: STABS debugging information is obsolete and not supported anymore > > that is, -gstabs will still generate STABS but use will be diagnosed > on targets where DWARF is available. > > I have built all targets from contrib/config-list.mk to make sure we > don't run into the #error and the following makes the STABS usage > explicit for pdp11 and hppa with SOM. > > This completes the series of deprecating STABS for GCC 12. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > OK for trunk? Ping. > Thanks, > Richard. > > 2021-09-21 Richard Biener > > gcc/ > * defaults.h (PREFERRED_DEBUGGING_TYPE): Choose DWARF2_DEBUG > when not set. > * toplev.c (process_options): Warn when STABS debugging is > enabled but not the preferred format. > * config/pa/som.h (PREFERRED_DEBUGGING_TYPE): Define to > DBX_DEBUG. > * config/pdp11/pdp11.h (PREFERRED_DEBUGGING_TYPE): Likewise. > > 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/config/pa/som.h | 4 ++++ > gcc/config/pdp11/pdp11.h | 3 +++ > gcc/defaults.h | 29 +++++------------------------ > gcc/testsuite/lib/prune.exp | 3 +++ > gcc/toplev.c | 5 +++++ > 6 files changed, 20 insertions(+), 30 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/config/pa/som.h b/gcc/config/pa/som.h > index 05cc315b9f9..36a1122b132 100644 > --- a/gcc/config/pa/som.h > +++ b/gcc/config/pa/som.h > @@ -21,6 +21,10 @@ along with GCC; see the file COPYING3. If not see > #undef TARGET_SOM > #define TARGET_SOM 1 > > +/* With SOM we can only do STABS. */ > +#undef PREFERRED_DEBUGGING_TYPE > +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG > + > /* We do not use BINCL stabs in SOM. > ??? If it does not hurt, we probably should to avoid useless divergence > from other embedded stabs implementations. */ > diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h > index 9bc5e089f49..91a8ce70751 100644 > --- a/gcc/config/pdp11/pdp11.h > +++ b/gcc/config/pdp11/pdp11.h > @@ -54,6 +54,9 @@ along with GCC; see the file COPYING3. If not see > > #define DBX_DEBUGGING_INFO > > +#undef PREFERRED_DEBUGGING_TYPE > +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG > + > #define TARGET_40_PLUS (TARGET_40 || TARGET_45) > #define TARGET_10 (! TARGET_40_PLUS) > > diff --git a/gcc/defaults.h b/gcc/defaults.h > index ba79a8e48ed..d7f2546f2cc 100644 > --- a/gcc/defaults.h > +++ b/gcc/defaults.h > @@ -900,33 +900,14 @@ 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)) > +/* Default to DWARF2_DEBUGGING_INFO. Legacy targets can choose different > + by defining PREFERRED_DEBUGGING_TYPE. */ > #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 > +#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. */ > -#define PREFERRED_DEBUGGING_TYPE NO_DEBUG > +#error You must define PREFERRED_DEBUGGING_TYPE if DWARF is not supported > +#endif > #endif > > #ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL > diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp > index fac212ecf60..131424861d5 100644 > --- a/gcc/testsuite/lib/prune.exp > +++ b/gcc/testsuite/lib/prune.exp > @@ -93,6 +93,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..8de8a92f2c6 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 and is not the default. */ > + if (PREFERRED_DEBUGGING_TYPE != DBX_DEBUG && (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