]>
Commit | Line | Data |
---|---|---|
2772ef3e | 1 | /* Command line option handling. |
7adcbafe | 2 | Copyright (C) 2002-2022 Free Software Foundation, Inc. |
2772ef3e NB |
3 | |
4 | This file is part of GCC. | |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
2772ef3e NB |
9 | version. |
10 | ||
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
2772ef3e NB |
19 | |
20 | #ifndef GCC_OPTS_H | |
21 | #define GCC_OPTS_H | |
22 | ||
dc357798 | 23 | #include "obstack.h" |
a4d8c676 | 24 | |
75685792 | 25 | /* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */ |
55bea00a | 26 | enum cl_var_type { |
8e836af6 ML |
27 | /* The switch is an integer value. */ |
28 | CLVC_INTEGER, | |
75685792 RS |
29 | |
30 | /* The switch is enabled when FLAG_VAR == VAR_VALUE. */ | |
31 | CLVC_EQUAL, | |
32 | ||
33 | /* The switch is enabled when VAR_VALUE is not set in FLAG_VAR. */ | |
34 | CLVC_BIT_CLEAR, | |
35 | ||
36 | /* The switch is enabled when VAR_VALUE is set in FLAG_VAR. */ | |
55bea00a RS |
37 | CLVC_BIT_SET, |
38 | ||
00abf86c MS |
39 | /* The switch is enabled when FLAG_VAR is less than HOST_WIDE_INT_M1U. */ |
40 | CLVC_SIZE, | |
41 | ||
55bea00a RS |
42 | /* The switch takes a string argument and FLAG_VAR points to that |
43 | argument. */ | |
21bf1558 JM |
44 | CLVC_STRING, |
45 | ||
e6d4b984 JM |
46 | /* The switch takes an enumerated argument (VAR_ENUM says what |
47 | enumeration) and FLAG_VAR points to that argument. */ | |
48 | CLVC_ENUM, | |
49 | ||
21bf1558 JM |
50 | /* The switch should be stored in the VEC pointed to by FLAG_VAR for |
51 | later processing. */ | |
52 | CLVC_DEFER | |
75685792 | 53 | }; |
2772ef3e | 54 | |
0ebb09f5 JJ |
55 | /* Values for var_value member of CLVC_ENUM. */ |
56 | enum cl_enum_var_value { | |
57 | /* Enum without EnumSet or EnumBitSet. */ | |
58 | CLEV_NORMAL, | |
59 | ||
60 | /* EnumSet. */ | |
61 | CLEV_SET, | |
62 | ||
63 | /* EnumBitSet. */ | |
64 | CLEV_BITSET | |
65 | }; | |
66 | ||
35399bdc NB |
67 | struct cl_option |
68 | { | |
300d83d9 | 69 | /* Text of the option, including initial '-'. */ |
35399bdc | 70 | const char *opt_text; |
300d83d9 | 71 | /* Help text for --help, or NULL. */ |
cf03fd63 | 72 | const char *help; |
300d83d9 | 73 | /* Error message for missing argument, or NULL. */ |
61ff2bdc | 74 | const char *missing_argument_error; |
300d83d9 | 75 | /* Warning to give when this option is used, or NULL. */ |
2d2bd949 | 76 | const char *warn_message; |
300d83d9 | 77 | /* Argument of alias target when positive option given, or NULL. */ |
5de8299c | 78 | const char *alias_arg; |
300d83d9 | 79 | /* Argument of alias target when negative option given, or NULL. */ |
5de8299c | 80 | const char *neg_alias_arg; |
300d83d9 | 81 | /* Alias target, or N_OPTS if not an alias. */ |
5de8299c | 82 | unsigned short alias_target; |
300d83d9 JM |
83 | /* Previous option that is an initial substring of this one, or |
84 | N_OPTS if none. */ | |
9cd23ed2 | 85 | unsigned short back_chain; |
300d83d9 | 86 | /* Option length, not including initial '-'. */ |
35399bdc | 87 | unsigned char opt_len; |
00abf86c MS |
88 | /* Next option in a sequence marked with Negative, or -1 if none. |
89 | For a single option with both a negative and a positve form | |
90 | (such as -Wall and -Wno-all), NEG_IDX is equal to the option's | |
91 | own index (i.e., cl_options[IDX].neg_idx == IDX holds). */ | |
14c7833c | 92 | int neg_index; |
300d83d9 | 93 | /* CL_* flags for this option. */ |
d7b42618 | 94 | unsigned int flags; |
300d83d9 JM |
95 | /* Disabled in this configuration. */ |
96 | BOOL_BITFIELD cl_disabled : 1; | |
97 | /* Options marked with CL_SEPARATE take a number of separate | |
98 | arguments (1 to 4) that is one more than the number in this | |
99 | bit-field. */ | |
100 | unsigned int cl_separate_nargs : 2; | |
101 | /* Option is an alias when used with separate argument. */ | |
102 | BOOL_BITFIELD cl_separate_alias : 1; | |
103 | /* Alias to negative form of option. */ | |
104 | BOOL_BITFIELD cl_negative_alias : 1; | |
105 | /* Option takes no argument in the driver. */ | |
106 | BOOL_BITFIELD cl_no_driver_arg : 1; | |
107 | /* Reject this option in the driver. */ | |
108 | BOOL_BITFIELD cl_reject_driver : 1; | |
109 | /* Reject no- form. */ | |
110 | BOOL_BITFIELD cl_reject_negative : 1; | |
111 | /* Missing argument OK (joined). */ | |
112 | BOOL_BITFIELD cl_missing_ok : 1; | |
113 | /* Argument is an integer >=0. */ | |
114 | BOOL_BITFIELD cl_uinteger : 1; | |
99114bbf L |
115 | /* Argument is a HOST_WIDE_INT. */ |
116 | BOOL_BITFIELD cl_host_wide_int : 1; | |
413519ae JM |
117 | /* Argument should be converted to lowercase. */ |
118 | BOOL_BITFIELD cl_tolower : 1; | |
00abf86c MS |
119 | /* Argument is an unsigned integer with an optional byte suffix. */ |
120 | BOOL_BITFIELD cl_byte_size: 1; | |
300d83d9 JM |
121 | /* Offset of field for this option in struct gcc_options, or |
122 | (unsigned short) -1 if none. */ | |
46625112 | 123 | unsigned short flag_var_offset; |
300d83d9 JM |
124 | /* Index in cl_enums of enum used for this option's arguments, for |
125 | CLVC_ENUM options. */ | |
e6d4b984 | 126 | unsigned short var_enum; |
300d83d9 | 127 | /* How this option's value is determined and sets a field. */ |
55bea00a | 128 | enum cl_var_type var_type; |
300d83d9 | 129 | /* Value or bit-mask with which to set a field. */ |
99114bbf | 130 | HOST_WIDE_INT var_value; |
63010089 ML |
131 | /* Range info minimum, or -1. */ |
132 | int range_min; | |
133 | /* Range info maximum, or -1. */ | |
134 | int range_max; | |
35399bdc NB |
135 | }; |
136 | ||
84e0549c JJ |
137 | struct cl_var |
138 | { | |
139 | /* Name of the variable. */ | |
140 | const char *var_name; | |
141 | /* Offset of field for this var in struct gcc_options. */ | |
142 | unsigned short var_offset; | |
143 | }; | |
144 | ||
5c60a017 RS |
145 | /* Records that the state of an option consists of SIZE bytes starting |
146 | at DATA. DATA might point to CH in some cases. */ | |
147 | struct cl_option_state { | |
148 | const void *data; | |
149 | size_t size; | |
150 | char ch; | |
151 | }; | |
152 | ||
35399bdc NB |
153 | extern const struct cl_option cl_options[]; |
154 | extern const unsigned int cl_options_count; | |
84e0549c JJ |
155 | #ifdef ENABLE_PLUGIN |
156 | extern const struct cl_var cl_vars[]; | |
157 | #endif | |
f18754d6 | 158 | extern const char *const lang_names[]; |
c662432e | 159 | extern const unsigned int cl_lang_count; |
35399bdc | 160 | |
58265ea6 GF |
161 | #define CL_PARAMS (1U << 16) /* Fake entry. Used to display --param info with --help. */ |
162 | #define CL_WARNING (1U << 17) /* Enables an (optional) warning message. */ | |
163 | #define CL_OPTIMIZATION (1U << 18) /* Enables an (optional) optimization. */ | |
164 | #define CL_DRIVER (1U << 19) /* Driver option. */ | |
165 | #define CL_TARGET (1U << 20) /* Target-specific option. */ | |
166 | #define CL_COMMON (1U << 21) /* Language-independent. */ | |
a1fd13d0 JJ |
167 | |
168 | #define CL_MIN_OPTION_CLASS CL_PARAMS | |
c662432e NC |
169 | #define CL_MAX_OPTION_CLASS CL_COMMON |
170 | ||
171 | /* From here on the bits describe attributes of the options. | |
172 | Before this point the bits have described the class of the option. | |
173 | This distinction is important because --help will not list options | |
174 | which only have these higher bits set. */ | |
175 | ||
58265ea6 GF |
176 | #define CL_JOINED (1U << 22) /* If takes joined argument. */ |
177 | #define CL_SEPARATE (1U << 23) /* If takes a separate argument. */ | |
178 | #define CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. */ | |
77ee7190 | 179 | #define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. */ |
212bfe71 | 180 | #define CL_PCH_IGNORE (1U << 26) /* Do compare state for pch. */ |
2772ef3e | 181 | |
e6d4b984 JM |
182 | /* Flags for an enumerated option argument. */ |
183 | #define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */ | |
184 | #define CL_ENUM_DRIVER_ONLY (1 << 1) /* Only accepted in the driver. */ | |
385196ad | 185 | #define CL_ENUM_SET_SHIFT 2 /* Shift for enum set. */ |
e6d4b984 JM |
186 | |
187 | /* Structure describing an enumerated option argument. */ | |
188 | ||
189 | struct cl_enum_arg | |
190 | { | |
191 | /* The argument text, or NULL at the end of the array. */ | |
192 | const char *arg; | |
193 | ||
194 | /* The corresponding integer value. */ | |
195 | int value; | |
196 | ||
197 | /* Flags associated with this argument. */ | |
198 | unsigned int flags; | |
199 | }; | |
200 | ||
201 | /* Structure describing an enumerated set of option arguments. */ | |
202 | ||
203 | struct cl_enum | |
204 | { | |
205 | /* Help text, or NULL if the values should not be listed in --help | |
206 | output. */ | |
207 | const char *help; | |
208 | ||
209 | /* Error message for unknown arguments, or NULL to use a generic | |
210 | error. */ | |
211 | const char *unknown_error; | |
212 | ||
213 | /* Array of possible values. */ | |
214 | const struct cl_enum_arg *values; | |
215 | ||
216 | /* The size of the type used to store a value. */ | |
217 | size_t var_size; | |
218 | ||
219 | /* Function to set a variable of this type. */ | |
220 | void (*set) (void *var, int value); | |
221 | ||
222 | /* Function to get the value of a variable of this type. */ | |
223 | int (*get) (const void *var); | |
224 | }; | |
225 | ||
226 | extern const struct cl_enum cl_enums[]; | |
227 | extern const unsigned int cl_enums_count; | |
228 | ||
5d4b393f JM |
229 | /* Possible ways in which a command-line option may be erroneous. |
230 | These do not include not being known at all; an option index of | |
6e2f1956 | 231 | OPT_SPECIAL_unknown is used for that. */ |
5d4b393f JM |
232 | |
233 | #define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */ | |
234 | #define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */ | |
235 | #define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */ | |
236 | #define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */ | |
63010089 ML |
237 | #define CL_ERR_INT_RANGE_ARG (1 << 4) /* Bad unsigned integer argument. */ |
238 | #define CL_ERR_ENUM_ARG (1 << 5) /* Bad enumerated argument. */ | |
239 | #define CL_ERR_NEGATIVE (1 << 6) /* Negative form of option | |
184eb658 JM |
240 | not permitted (together |
241 | with OPT_SPECIAL_unknown). */ | |
385196ad | 242 | #define CL_ERR_ENUM_SET_ARG (1 << 7) /* Bad argument of enumerated set. */ |
5d4b393f JM |
243 | |
244 | /* Structure describing the result of decoding an option. */ | |
245 | ||
246 | struct cl_decoded_option | |
247 | { | |
6e2f1956 JM |
248 | /* The index of this option, or an OPT_SPECIAL_* value for |
249 | non-options and unknown options. */ | |
5d4b393f JM |
250 | size_t opt_index; |
251 | ||
2d2bd949 JM |
252 | /* Any warning to give for use of this option, or NULL if none. */ |
253 | const char *warn_message; | |
254 | ||
6e2f1956 JM |
255 | /* The string argument, or NULL if none. For OPT_SPECIAL_* cases, |
256 | the option or non-option command-line argument. */ | |
5d4b393f JM |
257 | const char *arg; |
258 | ||
6e2f1956 JM |
259 | /* The original text of option plus arguments, with separate argv |
260 | elements concatenated into one string with spaces separating | |
261 | them. This is for such uses as diagnostics and | |
262 | -frecord-gcc-switches. */ | |
263 | const char *orig_option_with_args_text; | |
264 | ||
7a9bf9a4 JM |
265 | /* The canonical form of the option and its argument, for when it is |
266 | necessary to reconstruct argv elements (in particular, for | |
267 | processing specs and passing options to subprocesses from the | |
eea13ead JM |
268 | driver). */ |
269 | const char *canonical_option[4]; | |
270 | ||
271 | /* The number of elements in the canonical form of the option and | |
272 | arguments; always at least 1. */ | |
273 | size_t canonical_option_num_elements; | |
7a9bf9a4 | 274 | |
5d4b393f JM |
275 | /* For a boolean option, 1 for the true case and 0 for the "no-" |
276 | case. For an unsigned integer option, the value of the | |
385196ad JJ |
277 | argument. For enum the value of the enumerator corresponding |
278 | to argument string. 1 in all other cases. */ | |
00abf86c | 279 | HOST_WIDE_INT value; |
5d4b393f | 280 | |
385196ad JJ |
281 | /* For EnumSet the value mask. Variable should be changed to |
282 | value | (prev_value & ~mask). */ | |
283 | HOST_WIDE_INT mask; | |
284 | ||
5d4b393f JM |
285 | /* Any flags describing errors detected in this option. */ |
286 | int errors; | |
287 | }; | |
288 | ||
21bf1558 JM |
289 | /* Structure describing an option deferred for handling after the main |
290 | option handlers. */ | |
291 | ||
84562394 | 292 | struct cl_deferred_option |
21bf1558 JM |
293 | { |
294 | /* Elements from struct cl_decoded_option used for deferred | |
295 | options. */ | |
296 | size_t opt_index; | |
297 | const char *arg; | |
298 | int value; | |
84562394 | 299 | }; |
21bf1558 | 300 | |
5f20c657 JM |
301 | /* Structure describing a single option-handling callback. */ |
302 | ||
303 | struct cl_option_handler_func | |
304 | { | |
305 | /* The function called to handle the option. */ | |
46625112 | 306 | bool (*handler) (struct gcc_options *opts, |
d4d24ba4 | 307 | struct gcc_options *opts_set, |
46625112 | 308 | const struct cl_decoded_option *decoded, |
a4d8c676 | 309 | unsigned int lang_mask, int kind, location_t loc, |
d5478783 | 310 | const struct cl_option_handlers *handlers, |
130fcab0 ML |
311 | diagnostic_context *dc, |
312 | void (*target_option_override_hook) (void)); | |
5f20c657 JM |
313 | |
314 | /* The mask that must have some bit in common with the flags for the | |
315 | option for this particular handler to be used. */ | |
316 | unsigned int mask; | |
317 | }; | |
318 | ||
319 | /* Structure describing the callbacks used in handling options. */ | |
320 | ||
321 | struct cl_option_handlers | |
322 | { | |
323 | /* Callback for an unknown option to determine whether to give an | |
324 | error for it, and possibly store information to diagnose the | |
325 | option at a later point. Return true if an error should be | |
326 | given, false otherwise. */ | |
481e1176 | 327 | bool (*unknown_option_callback) (const struct cl_decoded_option *decoded); |
5f20c657 JM |
328 | |
329 | /* Callback to handle, and possibly diagnose, an option for another | |
330 | language. */ | |
481e1176 | 331 | void (*wrong_lang_callback) (const struct cl_decoded_option *decoded, |
5f20c657 JM |
332 | unsigned int lang_mask); |
333 | ||
130fcab0 ML |
334 | /* Target option override hook. */ |
335 | void (*target_option_override_hook) (void); | |
336 | ||
5f20c657 JM |
337 | /* The number of individual handlers. */ |
338 | size_t num_handlers; | |
339 | ||
340 | /* The handlers themselves. */ | |
341 | struct cl_option_handler_func handlers[3]; | |
342 | }; | |
343 | ||
ecf835e9 KN |
344 | /* Hold command-line options associated with stack limitation. */ |
345 | extern const char *opt_fstack_limit_symbol_arg; | |
346 | extern int opt_fstack_limit_register_no; | |
347 | ||
59e4e217 | 348 | /* Input file names. */ |
40e941af PB |
349 | |
350 | extern const char **in_fnames; | |
351 | ||
59e4e217 | 352 | /* The count of input filenames. */ |
40e941af PB |
353 | |
354 | extern unsigned num_in_fnames; | |
355 | ||
dc357798 JJ |
356 | extern char *opts_concat (const char *first, ...); |
357 | ||
358 | /* Obstack for option strings. */ | |
359 | ||
360 | extern struct obstack opts_obstack; | |
361 | ||
eb50f63a | 362 | size_t find_opt (const char *input, unsigned int lang_mask); |
00abf86c | 363 | extern HOST_WIDE_INT integral_argument (const char *arg, int * = NULL, bool = false); |
e6d4b984 JM |
364 | extern bool enum_value_to_arg (const struct cl_enum_arg *enum_args, |
365 | const char **argp, int value, | |
366 | unsigned int lang_mask); | |
6e2f1956 JM |
367 | extern void decode_cmdline_options_to_array (unsigned int argc, |
368 | const char **argv, | |
369 | unsigned int lang_mask, | |
370 | struct cl_decoded_option **decoded_options, | |
371 | unsigned int *decoded_options_count); | |
a75bfaa6 JM |
372 | extern void init_options_once (void); |
373 | extern void init_options_struct (struct gcc_options *opts, | |
374 | struct gcc_options *opts_set); | |
de5672fc | 375 | extern void init_opts_obstack (void); |
a75bfaa6 JM |
376 | extern void decode_cmdline_options_to_array_default_mask (unsigned int argc, |
377 | const char **argv, | |
378 | struct cl_decoded_option **decoded_options, | |
379 | unsigned int *decoded_options_count); | |
130fcab0 ML |
380 | extern void set_default_handlers (struct cl_option_handlers *handlers, |
381 | void (*target_option_override_hook) (void)); | |
a75bfaa6 JM |
382 | extern void decode_options (struct gcc_options *opts, |
383 | struct gcc_options *opts_set, | |
384 | struct cl_decoded_option *decoded_options, | |
d5478783 | 385 | unsigned int decoded_options_count, |
a4d8c676 | 386 | location_t loc, |
130fcab0 ML |
387 | diagnostic_context *dc, |
388 | void (*target_option_override_hook) (void)); | |
fa5baeed MS |
389 | extern int option_enabled (int opt_idx, unsigned lang_mask, void *opts); |
390 | ||
46625112 JM |
391 | extern bool get_option_state (struct gcc_options *, int, |
392 | struct cl_option_state *); | |
d4d24ba4 JM |
393 | extern void set_option (struct gcc_options *opts, |
394 | struct gcc_options *opts_set, | |
00abf86c | 395 | int opt_index, HOST_WIDE_INT value, const char *arg, |
385196ad JJ |
396 | int kind, location_t loc, diagnostic_context *dc, |
397 | HOST_WIDE_INT = 0); | |
46625112 | 398 | extern void *option_flag_var (int opt_index, struct gcc_options *opts); |
46625112 | 399 | bool handle_generated_option (struct gcc_options *opts, |
d4d24ba4 | 400 | struct gcc_options *opts_set, |
00abf86c MS |
401 | size_t opt_index, const char *arg, |
402 | HOST_WIDE_INT value, | |
a4d8c676 | 403 | unsigned int lang_mask, int kind, location_t loc, |
1ebe4b4f | 404 | const struct cl_option_handlers *handlers, |
b9822443 | 405 | bool generated_p, diagnostic_context *dc); |
00abf86c | 406 | void generate_option (size_t opt_index, const char *arg, HOST_WIDE_INT value, |
d9d16a19 JM |
407 | unsigned int lang_mask, |
408 | struct cl_decoded_option *decoded); | |
409 | void generate_option_input_file (const char *file, | |
410 | struct cl_decoded_option *decoded); | |
46625112 | 411 | extern void read_cmdline_option (struct gcc_options *opts, |
d4d24ba4 | 412 | struct gcc_options *opts_set, |
46625112 | 413 | struct cl_decoded_option *decoded, |
a4d8c676 | 414 | location_t loc, |
5f20c657 | 415 | unsigned int lang_mask, |
1ebe4b4f JM |
416 | const struct cl_option_handlers *handlers, |
417 | diagnostic_context *dc); | |
c5fa0890 | 418 | extern void control_warning_option (unsigned int opt_index, int kind, |
63bbf46d | 419 | const char *arg, bool imply, location_t loc, |
c5fa0890 JM |
420 | unsigned int lang_mask, |
421 | const struct cl_option_handlers *handlers, | |
422 | struct gcc_options *opts, | |
423 | struct gcc_options *opts_set, | |
424 | diagnostic_context *dc); | |
c1822f9c | 425 | extern char *write_langs (unsigned int mask); |
369dcbd9 | 426 | extern void print_ignored_options (void); |
21bf1558 | 427 | extern void handle_common_deferred_options (void); |
b1b46af0 JJ |
428 | unsigned int parse_sanitizer_options (const char *, location_t, int, |
429 | unsigned int, int, bool); | |
45b2222a | 430 | |
3a266bcd | 431 | unsigned int parse_no_sanitize_attribute (char *value); |
c98cd5bf JM |
432 | extern bool common_handle_option (struct gcc_options *opts, |
433 | struct gcc_options *opts_set, | |
434 | const struct cl_decoded_option *decoded, | |
435 | unsigned int lang_mask, int kind, | |
436 | location_t loc, | |
437 | const struct cl_option_handlers *handlers, | |
130fcab0 ML |
438 | diagnostic_context *dc, |
439 | void (*target_option_override_hook) (void)); | |
c98cd5bf JM |
440 | extern bool target_handle_option (struct gcc_options *opts, |
441 | struct gcc_options *opts_set, | |
442 | const struct cl_decoded_option *decoded, | |
443 | unsigned int lang_mask, int kind, | |
444 | location_t loc, | |
445 | const struct cl_option_handlers *handlers, | |
130fcab0 ML |
446 | diagnostic_context *dc, |
447 | void (*target_option_override_hook) (void)); | |
c98cd5bf | 448 | extern void finish_options (struct gcc_options *opts, |
299404a1 | 449 | struct gcc_options *opts_set, |
f66409e0 | 450 | location_t loc); |
a187edd2 ML |
451 | extern void diagnose_options (gcc_options *opts, gcc_options *opts_set, |
452 | location_t loc); | |
bc405869 ML |
453 | extern void print_help (struct gcc_options *opts, unsigned int lang_mask, const |
454 | char *help_option_argument); | |
c98cd5bf JM |
455 | extern void default_options_optimization (struct gcc_options *opts, |
456 | struct gcc_options *opts_set, | |
457 | struct cl_decoded_option *decoded_options, | |
458 | unsigned int decoded_options_count, | |
459 | location_t loc, | |
460 | unsigned int lang_mask, | |
461 | const struct cl_option_handlers *handlers, | |
462 | diagnostic_context *dc); | |
299404a1 JM |
463 | extern void set_struct_debug_option (struct gcc_options *opts, |
464 | location_t loc, | |
465 | const char *value); | |
8023568e | 466 | extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg, |
00abf86c MS |
467 | int *value, |
468 | unsigned int lang_mask); | |
61789eed DM |
469 | |
470 | extern const struct sanitizer_opts_s | |
471 | { | |
472 | const char *const name; | |
473 | unsigned int flag; | |
474 | size_t len; | |
5cc6c41c | 475 | bool can_recover; |
2c7cfc7b | 476 | bool can_trap; |
61789eed DM |
477 | } sanitizer_opts[]; |
478 | ||
d10f3e90 | 479 | extern const struct zero_call_used_regs_opts_s |
480 | { | |
481 | const char *const name; | |
482 | unsigned int flag; | |
483 | } zero_call_used_regs_opts[]; | |
484 | ||
bc405869 | 485 | extern vec<const char *> help_option_arguments; |
f66409e0 | 486 | |
61789eed | 487 | extern void add_misspelling_candidates (auto_vec<char *> *candidates, |
603107fb | 488 | const struct cl_option *option, |
61789eed | 489 | const char *base_option); |
14bce257 JJ |
490 | extern const char *candidates_list_and_hint (const char *arg, char *&str, |
491 | const auto_vec <const char *> & | |
492 | candidates); | |
61789eed | 493 | |
c518c102 ML |
494 | |
495 | extern bool parse_and_check_align_values (const char *flag, | |
496 | const char *name, | |
497 | auto_vec<unsigned> &result_values, | |
498 | bool report_error, | |
499 | location_t loc); | |
500 | ||
0d701e3e ML |
501 | extern void parse_and_check_patch_area (const char *arg, bool report_error, |
502 | HOST_WIDE_INT *patch_area_size, | |
503 | HOST_WIDE_INT *patch_area_start); | |
504 | ||
f1a681a1 PK |
505 | extern void parse_options_from_collect_gcc_options (const char *, obstack *, |
506 | int *); | |
507 | ||
508 | extern void prepend_xassembler_to_collect_as_options (const char *, obstack *); | |
509 | ||
7caa4970 ML |
510 | extern char *gen_command_line_string (cl_decoded_option *options, |
511 | unsigned int options_count); | |
512 | extern char *gen_producer_string (const char *language_string, | |
513 | cl_decoded_option *options, | |
514 | unsigned int options_count); | |
515 | ||
76c26af9 ML |
516 | /* Set OPTION in OPTS to VALUE if the option is not set in OPTS_SET. */ |
517 | ||
518 | #define SET_OPTION_IF_UNSET(OPTS, OPTS_SET, OPTION, VALUE) \ | |
519 | do \ | |
520 | { \ | |
521 | if (!(OPTS_SET)->x_ ## OPTION) \ | |
522 | (OPTS)->x_ ## OPTION = VALUE; \ | |
523 | } \ | |
524 | while (false) | |
525 | ||
00f34291 ML |
526 | /* Return true if OPTION is set by user in global options. */ |
527 | ||
528 | #define OPTION_SET_P(OPTION) global_options_set.x_ ## OPTION | |
529 | ||
5ca9980f KC |
530 | /* Find all the switches given to us |
531 | and make a vector describing them. | |
532 | The elements of the vector are strings, one per switch given. | |
533 | If a switch uses following arguments, then the `part1' field | |
534 | is the switch itself and the `args' field | |
535 | is a null-terminated vector containing the following arguments. | |
536 | Bits in the `live_cond' field are: | |
537 | SWITCH_LIVE to indicate this switch is true in a conditional spec. | |
538 | SWITCH_FALSE to indicate this switch is overridden by a later switch. | |
539 | SWITCH_IGNORE to indicate this switch should be ignored (used in %<S). | |
540 | SWITCH_IGNORE_PERMANENTLY to indicate this switch should be ignored. | |
541 | SWITCH_KEEP_FOR_GCC to indicate that this switch, otherwise ignored, | |
542 | should be included in COLLECT_GCC_OPTIONS. | |
543 | in all do_spec calls afterwards. Used for %<S from self specs. | |
544 | The `known' field describes whether this is an internal switch. | |
545 | The `validated' field describes whether any spec has looked at this switch; | |
546 | if it remains false at the end of the run, the switch must be meaningless. | |
547 | The `ordering' field is used to temporarily mark switches that have to be | |
548 | kept in a specific order. */ | |
549 | ||
550 | #define SWITCH_LIVE (1 << 0) | |
551 | #define SWITCH_FALSE (1 << 1) | |
552 | #define SWITCH_IGNORE (1 << 2) | |
553 | #define SWITCH_IGNORE_PERMANENTLY (1 << 3) | |
554 | #define SWITCH_KEEP_FOR_GCC (1 << 4) | |
555 | ||
556 | struct switchstr | |
557 | { | |
558 | const char *part1; | |
559 | const char **args; | |
560 | unsigned int live_cond; | |
561 | bool known; | |
562 | bool validated; | |
563 | bool ordering; | |
564 | }; | |
565 | ||
2772ef3e | 566 | #endif |