From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14431 invoked by alias); 2 May 2019 08:15:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14280 invoked by uid 89); 2 May 2019 08:15:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 May 2019 08:15:38 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 54C7DAEE2; Thu, 2 May 2019 08:15:36 +0000 (UTC) Subject: Re: [RFC][PATCH] Postpone print of --help=* option. To: Jeff Law , gcc-patches@gcc.gnu.org References: <89537b9e-fac3-40eb-145a-3390d90050bf@suse.cz> <8633a722-e8c4-5965-810e-4b0f33c27187@redhat.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <7ba27916-cffb-5eb8-4585-69a30cfa4033@suse.cz> Date: Thu, 02 May 2019 08:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <8633a722-e8c4-5965-810e-4b0f33c27187@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00024.txt.bz2 On 4/30/19 6:18 PM, Jeff Law wrote: > On 4/1/19 6:11 AM, Martin Liška wrote: >> Hi. >> >> Last week I was curious which warnings are disabled by default on top >> of -Wall and -Wextra. Thus I used --help=warning and noticed some discrepancy >> in between documentation and output of the --help option. >> >> I created PR89885 where I explained that OPT__help_ option handling happens >> early. That's why LangEnabledBy are not reflected and similarly target overrides >> don't take place. >> >> I'm attaching diff for --help=warning for C++ and -Ofast. >> >> Thoughts? >> >> gcc/ChangeLog: >> >> 2019-04-01 Martin Liska >> >> * gcc.c (process_command): Add dummy file only >> if n_infiles == 0. >> * opts-global.c (decode_options): Pass lang_mask. >> * opts.c (print_help): New function. >> (finish_options): Print --help if help_option_argument >> is set. >> (common_handle_option): Factor out content of OPT__help_ >> into print_help. >> * opts.h (finish_options): Add new argument. >> --- >> gcc/gcc.c | 3 +- >> gcc/opts-global.c | 2 +- >> gcc/opts.c | 267 ++++++++++++++++++++++++---------------------- >> gcc/opts.h | 3 +- >> 4 files changed, 146 insertions(+), 129 deletions(-) >> >> >> >> 0001-Postpone-print-of-help-option.patch >> >> diff --git a/gcc/gcc.c b/gcc/gcc.c >> index 4f57765b012..7ce1cae28a7 100644 >> --- a/gcc/gcc.c >> +++ b/gcc/gcc.c >> @@ -4751,7 +4751,8 @@ process_command (unsigned int decoded_options_count, >> } >> >> /* Ensure we only invoke each subprocess once. */ >> - if (print_subprocess_help || print_help_list || print_version) >> + if (n_infiles == 0 >> + && (print_subprocess_help || print_help_list || print_version)) >> { >> n_infiles = 0; > The assignment to n_infiles is redundant after your change. I suspect > the optimizers will catch this, so if you want to keep it for clarity > that's fine with me. > > OK for the trunk. Your call whether or not to remove the redundant > assignment. Thank you for review. I've removed the redundancy assignment before commit. Martin > > jeff >