From patchwork Thu Jan 27 10:37:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 50484 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 1268F394741A for ; Thu, 27 Jan 2022 10:37:48 +0000 (GMT) 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 683B23858C78 for ; Thu, 27 Jan 2022 10:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 683B23858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz 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 1D94A218B8; Thu, 27 Jan 2022 10:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643279850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oyEsJwZCBhJuLJrKqWUmYqHJrm0M49eprFB723PgC7g=; b=BV0W5kMWmsASOtQdN8NESZaUCCW59ekm0E/d3h6Fq8BrJkWVkoyYBrU1OqKuYFI8h0lO55 YcD6dxYQOsakl6GBKs+u/FAl2KLeGKUH9nHrAavyzmV4Q+dR0ypwkVkJwp1JptgBc+Q2xN xnodA5delVdbwJFKfDtghUto8qwoxBo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643279850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oyEsJwZCBhJuLJrKqWUmYqHJrm0M49eprFB723PgC7g=; b=YH3t/5nMR0/pM1h3YOv2no6FUjjBSLU/je8uUZmljgcC9qf64qI7eZ1ps3v0FhnZVpBeTR 7BzotOk1csmogkDA== 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 02DFA13F73; Thu, 27 Jan 2022 10:37:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZV02O+l18mGaRQAAMHmgww (envelope-from ); Thu, 27 Jan 2022 10:37:29 +0000 Message-ID: Date: Thu, 27 Jan 2022 11:37:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Improve wording for -freport-bug option. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: , Cc: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi. The patch addresses a few things related to ICE report: - 'Internal compiler error: Error reporting routines re-entered.' - unify 'internal' wording - I shortened: ''' Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. ''' - let's recommend using -freport-bug. Now one can see: $ ./xgcc -B. ~/Programming/testcases/pr100019.C -c ... Please submit a full bug report, with preprocessed source (by using -freport-bug) and the complete backtrace. See for instructions. $ ./xgcc -B. ~/Programming/testcases/pr100019.C -c -freport-bug ... Please submit a full bug report, with preprocessed source and the complete backtrace. See for instructions. Preprocessed source stored into /tmp/ccLgekCL.out file, please attach this to your bugreport. Ready to be installed? Thanks, Martin PR web/104254 gcc/ChangeLog: * diagnostic.cc (diagnostic_initialize): Initialize report_bug flag. (diagnostic_action_after_output): Explain that -freport-bug option can be used for pre-processed file creation. Make the message shorter. (error_recursion): Rename Internal to internal. * diagnostic.h (struct diagnostic_context): New field. * opts.cc (common_handle_option): Init the field here. --- gcc/diagnostic.cc | 20 +++++++++++--------- gcc/diagnostic.h | 3 +++ gcc/opts.cc | 4 ++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index f5f43d5e9a7..7acdee49551 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -219,6 +219,8 @@ diagnostic_initialize (diagnostic_context *context, int n_opts) context->show_line_numbers_p = false; context->min_margin_width = 0; context->show_ruler_p = false; + context->report_bug = false; + if (const char *var = getenv ("GCC_EXTRA_DIAGNOSTIC_OUTPUT")) { if (!strcmp (var, "fixits-v1")) @@ -665,12 +667,12 @@ diagnostic_action_after_output (diagnostic_context *context, if (context->abort_on_error) real_abort (); - fnotice (stderr, "Please submit a full bug report,\n" - "with preprocessed source if appropriate.\n"); - if (count > 0) - fnotice (stderr, - ("Please include the complete backtrace " - "with any bug report.\n")); + const char *details + = context->report_bug ? "" : "(by using -freport-bug) "; + const char *ending = count > 0 ? "and the complete backtrace" : ""; + + fnotice (stderr, "\nPlease submit a full bug report, " + "with preprocessed source %s%s.\n", details, ending); fnotice (stderr, "See %s for instructions.\n", bug_report_url); exit (ICE_EXIT_CODE); @@ -1437,8 +1439,8 @@ num_digits (int value) /* Given a partial pathname as input, return another pathname that shares no directory elements with the pathname of __FILE__. This - is used by fancy_abort() to print `Internal compiler error in expr.cc' - instead of `Internal compiler error in ../../GCC/gcc/expr.cc'. */ + is used by fancy_abort() to print `internal compiler error in expr.cc' + instead of `internal compiler error in ../../GCC/gcc/expr.cc'. */ const char * trim_filename (const char *name) @@ -1988,7 +1990,7 @@ error_recursion (diagnostic_context *context) pp_newline_and_flush (context->printer); fnotice (stderr, - "Internal compiler error: Error reporting routines re-entered.\n"); + "internal compiler error: Error reporting routines re-entered.\n"); /* Call diagnostic_action_after_output to get the "please submit a bug report" message. */ diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index ccaa33b5817..3ca32979dde 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -340,6 +340,9 @@ struct diagnostic_context source output. */ bool show_ruler_p; + /* True if -freport-bug option is used. */ + bool report_bug; + /* Used to specify additional diagnostic output to be emitted after the rest of the diagnostic. This is for implementing -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT. */ diff --git a/gcc/opts.cc b/gcc/opts.cc index f21c821ab2e..7d30deb8e4b 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -3158,6 +3158,10 @@ common_handle_option (struct gcc_options *opts, dc->tabstop = value; break; + case OPT_freport_bug: + dc->report_bug = value; + break; + default: /* If the flag was handled in a standard way, assume the lack of processing here is intentional. */