* include/bits/basic_string.h (getline): Qualify call to prevent ADL
[official-gcc.git] / gcc / opt-read.awk
blob467d5bebb87580a0d0de56c181fd5892bc23c424
1 # Copyright (C) 2003-2014 Free Software Foundation, Inc.
2 # Contributed by Kelley Cook, June 2004.
3 # Original code from Neil Booth, May 2003.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
19 # Read in the option records generated from opt-gather.awk.
21 BEGIN {
22 n_opts = 0
23 n_langs = 0
24 n_target_save = 0
25 n_extra_vars = 0
26 n_extra_target_vars = 0
27 n_extra_masks = 0
28 n_extra_c_includes = 0
29 n_extra_h_includes = 0
30 n_enums = 0
31 have_save = 0;
32 quote = "\042"
33 comma = ","
34 FS=SUBSEP
35 # Default the name of header created from opth-gen.awk to options.h
36 if (header_name == "") header_name="options.h"
39 # Collect the text and flags of each option into an array
41 if ($1 == "Language") {
42 langs[n_langs] = $2
43 lang_numbers[$2] = n_langs
44 n_langs++;
46 else if ($1 == "TargetSave") {
47 # Make sure the declarations are put in source order
48 target_save_decl[n_target_save] = $2
49 n_target_save++
51 else if ($1 == "Variable") {
52 extra_vars[n_extra_vars] = $2
53 n_extra_vars++
54 name = host_wide_int_var_name($2)
55 if (name != "")
56 host_wide_int[name] = "yes"
58 else if ($1 == "TargetVariable") {
59 # Combination of TargetSave and Variable
60 extra_vars[n_extra_vars] = $2
61 n_extra_vars++
63 var = $2
64 sub(" *=.*", "", var)
65 orig_var = var
66 name = var
67 type = var
68 sub("^.*[ *]", "", name)
69 sub(" *" name "$", "", type)
70 target_save_decl[n_target_save] = type " x_" name
71 n_target_save++
73 extra_target_vars[n_extra_target_vars] = name
74 n_extra_target_vars++
76 else if ($1 == "HeaderInclude") {
77 extra_h_includes[n_extra_h_includes++] = $2;
79 else if ($1 == "SourceInclude") {
80 extra_c_includes[n_extra_c_includes++] = $2;
82 else if ($1 == "Enum") {
83 props = $2
84 name = opt_args("Name", props)
85 type = opt_args("Type", props)
86 unknown_error = opt_args("UnknownError", props)
87 enum_names[n_enums] = name
88 enum_type[name] = type
89 enum_index[name] = n_enums
90 enum_unknown_error[name] = unknown_error
91 enum_help[name] = $3
92 n_enums++
94 else if ($1 == "EnumValue") {
95 props = $2
96 enum_name = opt_args("Enum", props)
97 string = opt_args("String", props)
98 value = opt_args("Value", props)
99 val_flags = "0"
100 val_flags = val_flags \
101 test_flag("Canonical", props, "| CL_ENUM_CANONICAL") \
102 test_flag("DriverOnly", props, "| CL_ENUM_DRIVER_ONLY")
103 enum_data[enum_name] = enum_data[enum_name] \
104 " { " quote string quote ", " value ", " val_flags \
105 " },\n"
107 else {
108 name = opt_args("Mask", $1)
109 if (name == "") {
110 opts[n_opts] = $1
111 opt_numbers[$1] = n_opts
112 flags[n_opts] = $2
113 help[n_opts] = $3
114 for (i = 4; i <= NF; i++)
115 help[n_opts] = help[n_opts] " " $i
116 n_opts++;
118 else {
119 extra_masks[n_extra_masks++] = name