public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Thomas Preudhomme" <thomas.preudhomme@linaro.org>
Cc: gcc-patches@gcc.gnu.org,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	james.greenhalgh@arm.com, kyrylo.tkachov@foss.arm.com
Subject: Re: [PATCH] Show valid options for -march and -mtune in --help=target for arm32 (PR driver/83193).
Date: Thu, 19 Jul 2018 09:28:00 -0000	[thread overview]
Message-ID: <9f99cc79-8d31-ea53-b265-7d7bdd58d6c2@arm.com> (raw)
In-Reply-To: <6910f5f6-f898-fd8b-c035-35fc0197c3c8@suse.cz>

On 19/07/18 08:30, Martin Liška wrote:
> This is correct version of the patch. Anyway, I'm thinking about the ForceHelp
> attribute. I may do it in a bit different version. Let me come up with one another
> version of the patch.
> 
> Martin
> 

I don't understand how this is supposed to work.  -mcpu, -march and
-mtune all take strings now and have to be parsed to identify various
sub-components of the parameter.  So why do you talk about these being
enum types?

R.

> 
> 0001-Show-valid-options-for-march-and-mtune-in-help-targe-v3.patch
> 
> 
> From 9bfc1400213911b4508e90198df7b2dd11efc85c Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Tue, 20 Feb 2018 10:39:09 +0100
> Subject: [PATCH] Show valid options for -march and -mtune in --help=target for
>  arm32 (PR driver/83193).
> 
> gcc/ChangeLog:
> 
> 2018-07-18  Martin Liska  <mliska@suse.cz>
> 
>         PR driver/83193
> 	* config/arm/arm-tables.opt: Add ForceHelp flag for
>         processor_type and arch_name enum types.
> 	* config/arm/parsecpu.awk: Likewise.
> 	* doc/options.texi: Document new flag ForceHelp.
> 	* opt-read.awk: Parse ForceHelp and set it in construction.
> 	* optc-gen.awk: Likewise.
> 	* opts.c (print_filtered_help): Handle force_help option.
> 	* opts.h (struct cl_enum): New field force_help.
> ---
>  gcc/config/arm/arm-tables.opt | 4 ++--
>  gcc/config/arm/parsecpu.awk   | 4 ++--
>  gcc/doc/options.texi          | 4 ++++
>  gcc/opt-read.awk              | 3 +++
>  gcc/optc-gen.awk              | 3 ++-
>  gcc/opts.c                    | 3 ++-
>  gcc/opts.h                    | 3 +++
>  7 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/config/arm/arm-tables.opt b/gcc/config/arm/arm-tables.opt
> index eacee746a39..c74229e27d7 100644
> --- a/gcc/config/arm/arm-tables.opt
> +++ b/gcc/config/arm/arm-tables.opt
> @@ -21,7 +21,7 @@
>  ; <http://www.gnu.org/licenses/>.
>  
>  Enum
> -Name(processor_type) Type(enum processor_type)
> +Name(processor_type) Type(enum processor_type) ForceHelp
>  Known ARM CPUs (for use with the -mcpu= and -mtune= options):
>  
>  EnumValue
> @@ -298,7 +298,7 @@ EnumValue
>  Enum(processor_type) String(cortex-r52) Value( TARGET_CPU_cortexr52)
>  
>  Enum
> -Name(arm_arch) Type(int)
> +Name(arm_arch) Type(int) ForceHelp
>  Known ARM architectures (for use with the -march= option):
>  
>  EnumValue
> diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk
> index aabe1b0c64c..c499a5ed0ce 100644
> --- a/gcc/config/arm/parsecpu.awk
> +++ b/gcc/config/arm/parsecpu.awk
> @@ -441,7 +441,7 @@ function gen_opt () {
>      boilerplate("md")
>  
>      print "Enum"
> -    print "Name(processor_type) Type(enum processor_type)"
> +    print "Name(processor_type) Type(enum processor_type) ForceHelp"
>      print "Known ARM CPUs (for use with the -mcpu= and -mtune= options):\n"
>  
>      ncpus = split (cpu_list, cpus)
> @@ -454,7 +454,7 @@ function gen_opt () {
>      }
>  
>      print "Enum"
> -    print "Name(arm_arch) Type(int)"
> +    print "Name(arm_arch) Type(int) ForceHelp"
>      print "Known ARM architectures (for use with the -march= option):\n"
>  
>      narchs = split (arch_list, archs)
> diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
> index b3ca9f6fce6..af77ad78e8c 100644
> --- a/gcc/doc/options.texi
> +++ b/gcc/doc/options.texi
> @@ -120,6 +120,10 @@ being described by this record.
>  This property is required; it says what value (representable as
>  @code{int}) should be used for the given string.
>  
> +@item ForceHelp
> +This property is optional.  If present, enum values are printed
> +in @option{--help} output.
> +
>  @item Canonical
>  This property is optional.  If present, it says the present string is
>  the canonical one among all those with the given value.  Other strings
> diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk
> index 2072958e6ba..6d2be9e99d7 100644
> --- a/gcc/opt-read.awk
> +++ b/gcc/opt-read.awk
> @@ -89,6 +89,9 @@ BEGIN {
>  			enum_index[name] = n_enums
>  			enum_unknown_error[name] = unknown_error
>  			enum_help[name] = $3
> +			enum_force_help[name] = test_flag("ForceHelp", props, "true")
> +			if (enum_force_help[name] == "")
> +			  enum_force_help[name] = "false"
>  			n_enums++
>  		}
>  		else if ($1 == "EnumValue")  {
> diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
> index bf177e86330..5c4f4239db0 100644
> --- a/gcc/optc-gen.awk
> +++ b/gcc/optc-gen.awk
> @@ -167,7 +167,8 @@ for (i = 0; i < n_enums; i++) {
>  	print "    cl_enum_" name "_data,"
>  	print "    sizeof (" enum_type[name] "),"
>  	print "    cl_enum_" name "_set,"
> -	print "    cl_enum_" name "_get"
> +	print "    cl_enum_" name "_get,"
> +	print "    " enum_force_help[name]
>  	print "  },"
>  }
>  print "};"
> diff --git a/gcc/opts.c b/gcc/opts.c
> index b8ae8756b4f..214ef806cd5 100644
> --- a/gcc/opts.c
> +++ b/gcc/opts.c
> @@ -1337,7 +1337,8 @@ print_filtered_help (unsigned int include_flags,
>      {
>        unsigned int j, pos;
>  
> -      if (opts->x_help_enum_printed[i] != 1)
> +      if (opts->x_help_enum_printed[i] != 1
> +	  && !cl_enums[i].force_help)
>  	continue;
>        if (cl_enums[i].help == NULL)
>  	continue;
> diff --git a/gcc/opts.h b/gcc/opts.h
> index 3723bdbf95b..c8777b3cd6a 100644
> --- a/gcc/opts.h
> +++ b/gcc/opts.h
> @@ -193,6 +193,9 @@ struct cl_enum
>  
>    /* Function to get the value of a variable of this type.  */
>    int (*get) (const void *var);
> +
> +  /* Force enum to be printed in help.  */
> +  bool force_help;
>  };
>  
>  extern const struct cl_enum cl_enums[];
> 

  reply	other threads:[~2018-07-19  9:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18 15:50 Martin Liška
2018-07-18 16:28 ` Thomas Preudhomme
2018-07-19  7:20   ` Martin Liška
2018-07-19  7:31     ` Martin Liška
2018-07-19  9:28       ` Richard Earnshaw (lists) [this message]
2018-07-19  9:57         ` Martin Liška
2018-07-19 10:01           ` Richard Earnshaw (lists)
2018-07-19 10:22             ` Martin Liška
2018-07-19 10:31               ` Richard Earnshaw (lists)
2018-07-19 12:53                 ` Martin Liška
2018-07-20  8:04                 ` [PATCH] Prototype of hook for possible list of option values Martin Liška
2018-07-20  9:48                   ` Richard Earnshaw (lists)
2018-07-20 10:14                     ` Martin Liška
2018-07-20 10:25                       ` Richard Earnshaw (lists)
2018-07-20 10:54                         ` Martin Liška
2018-07-20 10:58                           ` Richard Earnshaw (lists)
2018-07-20 11:06                             ` Martin Liška
2018-07-23 13:47                               ` Richard Earnshaw (lists)
2018-07-23 14:35                                 ` Martin Liška
2018-07-24 12:05                                   ` [PATCH] Come up with TARGET_GET_VALID_OPTION_VALUES option hook (PR driver/83193) Martin Liška
2018-08-13 12:49                                     ` Martin Liška
2018-08-13 12:54                                       ` Ramana Radhakrishnan
2018-08-13 13:00                                         ` Martin Liška
2018-08-13 13:35                                           ` Ramana Radhakrishnan
2018-08-27 10:00                                           ` Martin Liška
2018-08-29 11:06                                             ` Richard Biener
2018-08-29 12:47                                               ` Martin Liška
2018-08-30 10:17                                                 ` Richard Biener
2018-08-31  9:30                                                   ` Martin Liška
2018-09-03  8:09                                                     ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f99cc79-8d31-ea53-b265-7d7bdd58d6c2@arm.com \
    --to=richard.earnshaw@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.greenhalgh@arm.com \
    --cc=kyrylo.tkachov@foss.arm.com \
    --cc=mliska@suse.cz \
    --cc=thomas.preudhomme@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).