diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-09 19:30:17 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-09 19:30:17 +0000 |
commit | 5463f502e7fbb7a78581eb5d4969fb2a1addd2f5 (patch) | |
tree | 177b25e2ce79477e698b7aa0b558fd932dc0dc58 /gcc/optc-gen.awk | |
parent | ebb925e37d0ae442597e39bde2332734886a4152 (diff) | |
download | gcc-5463f502e7fbb7a78581eb5d4969fb2a1addd2f5.tar.gz |
gcc/ChangeLog:
2015-08-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
* doc/options.texi (EnabledBy): Document that the argument must be
a Common option.
* doc/invoke.texi (Wnull-dereference): Move after Wnonnull.
Not enabled by -Wall.
* optc-gen.awk: Give nicer error messages. Detect if the argument
of EnabledBy is not a Common option.
* common.opt (Wnull-dereference): Not enabled by -Wall.
* opt-functions.awk (lang_enabled_by): Nicer error messages.
gcc/c-family/ChangeLog:
2015-08-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c.opt (Wchkp): Use LangEnabledBy instead of EnabledBy.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226751 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optc-gen.awk')
-rw-r--r-- | gcc/optc-gen.awk | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index fb224053954..ed40f7f8f7c 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -30,7 +30,21 @@ # Dump that array of options into a C file. END { -# Record first EnabledBy and LangEnabledBy uses. + +# Combine the flags of identical switches. Switches +# appear many times if they are handled by many front +# ends, for example. +for (i = 0; i < n_opts; i++) { + merged_flags[i] = flags[i] +} +for (i = 0; i < n_opts; i++) { + while(i + 1 != n_opts && opts[i] == opts[i + 1] ) { + merged_flags[i + 1] = merged_flags[i] " " merged_flags[i + 1]; + i++; + } +} + +# Record EnabledBy and LangEnabledBy uses. n_enabledby = 0; for (i = 0; i < n_langs; i++) { n_enabledby_lang[i] = 0; @@ -48,15 +62,19 @@ for (i = 0; i < n_opts; i++) { } n_enabledby_names = split(enabledby_arg, enabledby_names, split_sep); if (logical_and != 0 && n_enabledby_names > 2) { - print "#error EnabledBy (Wfoo && Wbar && Wbaz) not currently supported" + print "#error " opts[i] " EnabledBy(Wfoo && Wbar && Wbaz) currently not supported" } for (j = 1; j <= n_enabledby_names; j++) { enabledby_name = enabledby_names[j]; enabledby_index = opt_numbers[enabledby_name]; if (enabledby_index == "") { - print "#error Enabledby: " enabledby_name - } else { - condition = ""; + print "#error " opts[i] " Enabledby(" enabledby_name "), unknown option '" enabledby_name "'" + } else if (!flag_set_p("Common", merged_flags[enabledby_index])) { + print "#error " opts[i] " Enabledby(" enabledby_name "), '" \ + enabledby_name "' must have flag 'Common'" \ + " to use Enabledby(), otherwise use LangEnabledBy()" + } else { + condition = ""; if (logical_and != 0) { opt_var_name_1 = search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts); opt_var_name_2 = search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts); |