diff options
author | Joseph Myers <joseph@codesourcery.com> | 2011-03-31 23:37:14 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2011-03-31 23:37:14 +0100 |
commit | 300d83d9de11381aa48273d5bdacb006955aa85f (patch) | |
tree | 329a018906d50347a718b59278baff52475262ef /gcc/opt-functions.awk | |
parent | 4bce572db2a654c9f17bb798b8469df11d3147e3 (diff) | |
download | gcc-300d83d9de11381aa48273d5bdacb006955aa85f.zip gcc-300d83d9de11381aa48273d5bdacb006955aa85f.tar.gz gcc-300d83d9de11381aa48273d5bdacb006955aa85f.tar.bz2 |
opts.h (cl_option): Add comments to fields.
* opts.h (cl_option): Add comments to fields. Add bit-fields for
various flags.
(CL_SEPARATE_NARGS_SHIFT, CL_SEPARATE_NARGS_MASK,
CL_SEPARATE_ALIAS, CL_NO_DRIVER_ARG, CL_REJECT_DRIVER, CL_SAVE,
CL_DISABLED, CL_REPOR, CL_REJECT_NEGATIVE, CL_MISSING_OK,
CL_UINTEGER, CL_NEGATIVE_ALIAS): Remove.
(CL_JOINED, CL_SEPARATE, CL_UNDOCUMENTED): Update bit positions.
* opt-functions.awk (flag_init, switch_bit_fields): New.
(switch_flags): Don't handle flags moved to bit-fields. Don't
generate CL_MISSING_OK or CL_SAVE.
* optc-gen.awk: Update to generate bit-field output as well as
flags field.
* gcc.c (driver_wrong_lang_callback): Use cl_reject_driver
bit-field instead of CL_REJECT_DRIVER flag.
* opts-common.c (generate_canonical_option,
decode_cmdline_option): Use bit-fields instead of CL_* flags.
* opts.c (maybe_default_option): Use cl_reject_negative bit-field
instead of CL_REJECT_NEGATIVE flag.
* toplev.c (print_switch_values): Use cl_report bit-field instead
of CL_REPORT flag.
From-SVN: r171804
Diffstat (limited to 'gcc/opt-functions.awk')
-rw-r--r-- | gcc/opt-functions.awk | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index f5f5cd4..19bdf3a 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -42,6 +42,16 @@ function test_flag(regex, flags, string) return "" } +# Return a field initializer, with trailing comma, for a field that is +# 1 if FLAGS contains a flag matching REGEX and 0 otherwise. +function flag_init(regex, flags) +{ + if (flag_set_p(regex, flags)) + return "1 /* " regex " */, " + else + return "0, " +} + # If FLAGS contains a "NAME(...argument...)" flag, return the value # of the argument. Return the empty string otherwise. function opt_args(name, flags) @@ -87,27 +97,38 @@ function switch_flags (flags) test_flag("Common", flags, " | CL_COMMON") \ test_flag("Target", flags, " | CL_TARGET") \ test_flag("Driver", flags, " | CL_DRIVER") \ - test_flag("RejectDriver", flags, " | CL_REJECT_DRIVER") \ - test_flag("NoDriverArg", flags, " | CL_NO_DRIVER_ARG") \ - test_flag("SeparateAlias", flags, " | CL_SEPARATE_ALIAS") \ - test_flag("NegativeAlias", flags, " | CL_NEGATIVE_ALIAS") \ - test_flag("Save", flags, " | CL_SAVE") \ test_flag("Joined", flags, " | CL_JOINED") \ - test_flag("JoinedOrMissing", flags, " | CL_JOINED | CL_MISSING_OK") \ + test_flag("JoinedOrMissing", flags, " | CL_JOINED") \ test_flag("Separate", flags, " | CL_SEPARATE") \ - test_flag("RejectNegative", flags, " | CL_REJECT_NEGATIVE") \ - test_flag("UInteger", flags, " | CL_UINTEGER") \ test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \ test_flag("Warning", flags, " | CL_WARNING") \ - test_flag("Optimization", flags, " | CL_OPTIMIZATION") \ - test_flag("Report", flags, " | CL_REPORT") + test_flag("Optimization", flags, " | CL_OPTIMIZATION") + sub( "^0 \\| ", "", result ) + return result +} + +# Return bit-field initializers for option flags FLAGS. +function switch_bit_fields (flags) +{ + result = "" sep_args = opt_args("Args", flags) - if (sep_args != "") { + if (sep_args == "") + sep_args = 0 + else sep_args-- - result = result " | (" sep_args \ - " << CL_SEPARATE_NARGS_SHIFT)" - } - sub( "^0 \\| ", "", result ) + result = result sep_args ", " + + result = result \ + flag_init("SeparateAlias", flags) \ + flag_init("NegativeAlias", flags) \ + flag_init("NoDriverArg", flags) \ + flag_init("RejectDriver", flags) \ + flag_init("RejectNegative", flags) \ + flag_init("JoinedOrMissing", flags) \ + flag_init("UInteger", flags) \ + flag_init("Report", flags) + + sub(", $", "", result) return result } |