From patchwork Thu Aug 6 12:37:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1341679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=FAERlE06; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMp0y3lgjz9sPB for ; Thu, 6 Aug 2020 22:37:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50BF9385700F; Thu, 6 Aug 2020 12:37:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50BF9385700F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596717455; bh=3Zaxc7VlfI2hHqIPEz6K+SFLh61+ftoKtyI9ScLL3uA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=FAERlE06pGrTAg3hIBBb3Z3JbZXegwyGqPYP9TGKwN2D0KrG4dD2qxp1hIdskq/bu 1IhFwfFDm0jFXO8BhTstO86oBtmxv1J77SEbwNF1OXwjNetwnE/IicnN7Cp2DLGDJy d0CJ2+3bXpriJcdRC9GwzB4CeStaxs15xmSkZeF8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 51ABB3857C6C for ; Thu, 6 Aug 2020 12:37:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 51ABB3857C6C Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 076CVSHo075803; Thu, 6 Aug 2020 08:37:31 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 32rfpx4341-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Aug 2020 08:37:31 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 076CYUC5020463; Thu, 6 Aug 2020 12:37:29 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 32n0185f4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Aug 2020 12:37:29 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 076CbRB724183094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Aug 2020 12:37:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE51C11C050; Thu, 6 Aug 2020 12:37:26 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B28A11C04C; Thu, 6 Aug 2020 12:37:25 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.197.227.232]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 6 Aug 2020 12:37:24 +0000 (GMT) To: GCC Patches Subject: [PATCH/RFC] options: Make --help= to emit values post-overrided Message-ID: <9eb8a897-e4ee-a80a-4456-1e088ab8f301@linux.ibm.com> Date: Thu, 6 Aug 2020 20:37:23 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-06_06:2020-08-06, 2020-08-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 priorityscore=1501 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008060088 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Bill Schmidt , Segher Boessenkool Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, When I was working to update patch as Richard's review comments here https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551474.html, I noticed that the options "-Q --help=params" don't show the final values after target option overriding, instead it emits the default values in params.opt (without any explicit param settings). I guess it's more meaningful to get it to emit values post-overrided, to avoid possible confusion for users. Does it make sense? Or are there any concerns? btw, not sure whether it's a good idea to move target_option_override_hook call into print_specific_help and use one function local static variable to control it's called once for all kinds of help dumping (possible combination), then can remove the calls in function common_handle_option. BR, Kewen ----- gcc/ChangeLog: * opts-global.c (decode_options): Adjust call to print_help. * opts.c (print_help): Add one function point argument target_option_override_hook and call it before print_specific_help. * opts.h (print_help): Add one more argument to function declare. diff --git a/gcc/opts-global.c b/gcc/opts-global.c index b1a8429dc3c..ec960c87c9a 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -328,7 +328,7 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set, const char *arg; FOR_EACH_VEC_ELT (help_option_arguments, i, arg) - print_help (opts, lang_mask, arg); + print_help (opts, lang_mask, arg, target_option_override_hook); } /* Hold command-line options associated with stack limitation. */ diff --git a/gcc/opts.c b/gcc/opts.c index 499eb900643..df184f909e6 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2017,7 +2017,8 @@ check_alignment_argument (location_t loc, const char *flag, const char *name) void print_help (struct gcc_options *opts, unsigned int lang_mask, - const char *help_option_argument) + const char *help_option_argument, + void (*target_option_override_hook) (void)) { const char *a = help_option_argument; unsigned int include_flags = 0; @@ -2145,9 +2146,11 @@ print_help (struct gcc_options *opts, unsigned int lang_mask, if (!(include_flags & CL_PARAMS)) exclude_flags |= CL_PARAMS; - if (include_flags) + if (include_flags) { + target_option_override_hook (); print_specific_help (include_flags, exclude_flags, 0, opts, lang_mask); + } } /* Handle target- and language-independent options. Return zero to diff --git a/gcc/opts.h b/gcc/opts.h index 8f594b46e33..9a837305af1 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -419,8 +419,9 @@ extern bool target_handle_option (struct gcc_options *opts, extern void finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc); -extern void print_help (struct gcc_options *opts, unsigned int lang_mask, const - char *help_option_argument); +extern void print_help (struct gcc_options *opts, unsigned int lang_mask, + const char *help_option_argument, + void (*target_option_override_hook) (void)); extern void default_options_optimization (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options,