diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-21 11:34:29 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-21 11:34:29 +0000 |
commit | 1e1273024835c9a2952eaafd9d796ff6126a7c2a (patch) | |
tree | ae156dc216d9a4a2a65ebcd0ee31c34599b4e278 /gcc/opth-gen.awk | |
parent | eb68828967d9048f2f590d117f2297bf190686b2 (diff) | |
download | gcc-1e1273024835c9a2952eaafd9d796ff6126a7c2a.tar.gz |
* opt-read.awk: New. Split out of optc-gen.awk and opth-gen.awk.
* optc-gen.awk: Move common code to opt-read.awk.
* opth-gen.awk: Likewise.
* Makefile.in (options.c, s-options-h): Update to use
opt-read.awk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173995 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r-- | gcc/opth-gen.awk | 98 |
1 files changed, 4 insertions, 94 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 01c2e46331b..7877d033b69 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -21,100 +21,10 @@ # opt-gather.awk, combines the flags of duplicate options and generates a # C header file. # -# This program uses functions from opt-functions.awk -# Usage: awk -f opt-functions.awk -f opth-gen.awk < inputfile > options.h - -BEGIN { - n_opts = 0 - n_langs = 0 - n_target_save = 0 - n_extra_vars = 0 - n_extra_target_vars = 0 - n_extra_masks = 0 - n_extra_c_includes = 0 - n_extra_h_includes = 0 - have_save = 0; - quote = "\042" - FS=SUBSEP -} - -# Collect the text and flags of each option into an array - { - if ($1 == "Language") { - langs[n_langs] = $2 - n_langs++; - } - else if ($1 == "TargetSave") { - # Make sure the declarations are put in source order - target_save_decl[n_target_save] = $2 - n_target_save++ - } - else if ($1 == "Variable") { - extra_vars[n_extra_vars] = $2 - n_extra_vars++ - } - else if ($1 == "TargetVariable") { - # Combination of TargetSave and Variable - extra_vars[n_extra_vars] = $2 - n_extra_vars++ - - var = $2 - sub(" *=.*", "", var) - orig_var = var - name = var - type = var - sub("^.*[ *]", "", name) - sub(" *" name "$", "", type) - target_save_decl[n_target_save] = type " x_" name - n_target_save++ - - extra_target_vars[n_extra_target_vars] = name - n_extra_target_vars++ - } - else if ($1 == "HeaderInclude") { - extra_h_includes[n_extra_h_includes++] = $2; - } - else if ($1 == "SourceInclude") { - extra_c_includes[n_extra_c_includes++] = $2; - } - else if ($1 == "Enum") { - props = $2 - name = opt_args("Name", props) - type = opt_args("Type", props) - unknown_error = opt_args("UnknownError", props) - enum_names[n_enums] = name - enum_type[name] = type - enum_index[name] = n_enums - enum_unknown_error[name] = unknown_error - enum_help[name] = $3 - n_enums++ - } - else if ($1 == "EnumValue") { - props = $2 - enum_name = opt_args("Enum", props) - string = opt_args("String", props) - value = opt_args("Value", props) - val_flags = "0" - val_flags = val_flags \ - test_flag("Canonical", props, "| CL_ENUM_CANONICAL") \ - test_flag("DriverOnly", props, "| CL_ENUM_DRIVER_ONLY") - enum_data[enum_name] = enum_data[enum_name] \ - " { " quote string quote ", " value ", " val_flags \ - " },\n" - } - else { - name = opt_args("Mask", $1) - if (name == "") { - opts[n_opts] = $1 - flags[n_opts] = $2 - help[n_opts] = $3 - n_opts++; - } - else { - extra_masks[n_extra_masks++] = name - } - } - } +# This program uses functions from opt-functions.awk and code from +# opt-read.awk. +# Usage: awk -f opt-functions.awk -f opt-read.awk -f opth-gen.awk \ +# < inputfile > options.h # Dump out an enumeration into a .h file. # Combine the flags of duplicate options. |