xref: /dragonfly/contrib/gcc-8.0/gcc/opts.h (revision 38fd1498)
1*38fd1498Szrj /* Command line option handling.
2*38fd1498Szrj    Copyright (C) 2002-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
7*38fd1498Szrj the terms of the GNU General Public License as published by the Free
8*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
9*38fd1498Szrj version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
13*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*38fd1498Szrj for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_OPTS_H
21*38fd1498Szrj #define GCC_OPTS_H
22*38fd1498Szrj 
23*38fd1498Szrj #include "obstack.h"
24*38fd1498Szrj 
25*38fd1498Szrj /* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR.  */
26*38fd1498Szrj enum cl_var_type {
27*38fd1498Szrj   /* The switch is enabled when FLAG_VAR is nonzero.  */
28*38fd1498Szrj   CLVC_BOOLEAN,
29*38fd1498Szrj 
30*38fd1498Szrj   /* The switch is enabled when FLAG_VAR == VAR_VALUE.  */
31*38fd1498Szrj   CLVC_EQUAL,
32*38fd1498Szrj 
33*38fd1498Szrj   /* The switch is enabled when VAR_VALUE is not set in FLAG_VAR.  */
34*38fd1498Szrj   CLVC_BIT_CLEAR,
35*38fd1498Szrj 
36*38fd1498Szrj   /* The switch is enabled when VAR_VALUE is set in FLAG_VAR.  */
37*38fd1498Szrj   CLVC_BIT_SET,
38*38fd1498Szrj 
39*38fd1498Szrj   /* The switch takes a string argument and FLAG_VAR points to that
40*38fd1498Szrj      argument.  */
41*38fd1498Szrj   CLVC_STRING,
42*38fd1498Szrj 
43*38fd1498Szrj   /* The switch takes an enumerated argument (VAR_ENUM says what
44*38fd1498Szrj      enumeration) and FLAG_VAR points to that argument.  */
45*38fd1498Szrj   CLVC_ENUM,
46*38fd1498Szrj 
47*38fd1498Szrj   /* The switch should be stored in the VEC pointed to by FLAG_VAR for
48*38fd1498Szrj      later processing.  */
49*38fd1498Szrj   CLVC_DEFER
50*38fd1498Szrj };
51*38fd1498Szrj 
52*38fd1498Szrj struct cl_option
53*38fd1498Szrj {
54*38fd1498Szrj   /* Text of the option, including initial '-'.  */
55*38fd1498Szrj   const char *opt_text;
56*38fd1498Szrj   /* Help text for --help, or NULL.  */
57*38fd1498Szrj   const char *help;
58*38fd1498Szrj   /* Error message for missing argument, or NULL.  */
59*38fd1498Szrj   const char *missing_argument_error;
60*38fd1498Szrj   /* Warning to give when this option is used, or NULL.  */
61*38fd1498Szrj   const char *warn_message;
62*38fd1498Szrj   /* Argument of alias target when positive option given, or NULL.  */
63*38fd1498Szrj   const char *alias_arg;
64*38fd1498Szrj   /* Argument of alias target when negative option given, or NULL.  */
65*38fd1498Szrj   const char *neg_alias_arg;
66*38fd1498Szrj   /* Alias target, or N_OPTS if not an alias.  */
67*38fd1498Szrj   unsigned short alias_target;
68*38fd1498Szrj   /* Previous option that is an initial substring of this one, or
69*38fd1498Szrj      N_OPTS if none.  */
70*38fd1498Szrj   unsigned short back_chain;
71*38fd1498Szrj   /* Option length, not including initial '-'.  */
72*38fd1498Szrj   unsigned char opt_len;
73*38fd1498Szrj   /* Next option in a sequence marked with Negative, or -1 if none.  */
74*38fd1498Szrj   int neg_index;
75*38fd1498Szrj   /* CL_* flags for this option.  */
76*38fd1498Szrj   unsigned int flags;
77*38fd1498Szrj   /* Disabled in this configuration.  */
78*38fd1498Szrj   BOOL_BITFIELD cl_disabled : 1;
79*38fd1498Szrj   /* Options marked with CL_SEPARATE take a number of separate
80*38fd1498Szrj      arguments (1 to 4) that is one more than the number in this
81*38fd1498Szrj      bit-field.  */
82*38fd1498Szrj   unsigned int cl_separate_nargs : 2;
83*38fd1498Szrj   /* Option is an alias when used with separate argument.  */
84*38fd1498Szrj   BOOL_BITFIELD cl_separate_alias : 1;
85*38fd1498Szrj   /* Alias to negative form of option.  */
86*38fd1498Szrj   BOOL_BITFIELD cl_negative_alias : 1;
87*38fd1498Szrj   /* Option takes no argument in the driver.  */
88*38fd1498Szrj   BOOL_BITFIELD cl_no_driver_arg : 1;
89*38fd1498Szrj   /* Reject this option in the driver.  */
90*38fd1498Szrj   BOOL_BITFIELD cl_reject_driver : 1;
91*38fd1498Szrj   /* Reject no- form.  */
92*38fd1498Szrj   BOOL_BITFIELD cl_reject_negative : 1;
93*38fd1498Szrj   /* Missing argument OK (joined).  */
94*38fd1498Szrj   BOOL_BITFIELD cl_missing_ok : 1;
95*38fd1498Szrj   /* Argument is an integer >=0.  */
96*38fd1498Szrj   BOOL_BITFIELD cl_uinteger : 1;
97*38fd1498Szrj   /* Argument is a HOST_WIDE_INT.  */
98*38fd1498Szrj   BOOL_BITFIELD cl_host_wide_int : 1;
99*38fd1498Szrj   /* Argument should be converted to lowercase.  */
100*38fd1498Szrj   BOOL_BITFIELD cl_tolower : 1;
101*38fd1498Szrj   /* Report argument with -fverbose-asm  */
102*38fd1498Szrj   BOOL_BITFIELD cl_report : 1;
103*38fd1498Szrj   /* Offset of field for this option in struct gcc_options, or
104*38fd1498Szrj      (unsigned short) -1 if none.  */
105*38fd1498Szrj   unsigned short flag_var_offset;
106*38fd1498Szrj   /* Index in cl_enums of enum used for this option's arguments, for
107*38fd1498Szrj      CLVC_ENUM options.  */
108*38fd1498Szrj   unsigned short var_enum;
109*38fd1498Szrj   /* How this option's value is determined and sets a field.  */
110*38fd1498Szrj   enum cl_var_type var_type;
111*38fd1498Szrj   /* Value or bit-mask with which to set a field.  */
112*38fd1498Szrj   HOST_WIDE_INT var_value;
113*38fd1498Szrj   /* Range info minimum, or -1.  */
114*38fd1498Szrj   int range_min;
115*38fd1498Szrj   /* Range info maximum, or -1.  */
116*38fd1498Szrj   int range_max;
117*38fd1498Szrj };
118*38fd1498Szrj 
119*38fd1498Szrj /* Records that the state of an option consists of SIZE bytes starting
120*38fd1498Szrj    at DATA.  DATA might point to CH in some cases.  */
121*38fd1498Szrj struct cl_option_state {
122*38fd1498Szrj   const void *data;
123*38fd1498Szrj   size_t size;
124*38fd1498Szrj   char ch;
125*38fd1498Szrj };
126*38fd1498Szrj 
127*38fd1498Szrj extern const struct cl_option cl_options[];
128*38fd1498Szrj extern const unsigned int cl_options_count;
129*38fd1498Szrj extern const char *const lang_names[];
130*38fd1498Szrj extern const unsigned int cl_lang_count;
131*38fd1498Szrj 
132*38fd1498Szrj #define CL_PARAMS               (1U << 16) /* Fake entry.  Used to display --param info with --help.  */
133*38fd1498Szrj #define CL_WARNING		(1U << 17) /* Enables an (optional) warning message.  */
134*38fd1498Szrj #define CL_OPTIMIZATION		(1U << 18) /* Enables an (optional) optimization.  */
135*38fd1498Szrj #define CL_DRIVER		(1U << 19) /* Driver option.  */
136*38fd1498Szrj #define CL_TARGET		(1U << 20) /* Target-specific option.  */
137*38fd1498Szrj #define CL_COMMON		(1U << 21) /* Language-independent.  */
138*38fd1498Szrj 
139*38fd1498Szrj #define CL_MIN_OPTION_CLASS	CL_PARAMS
140*38fd1498Szrj #define CL_MAX_OPTION_CLASS	CL_COMMON
141*38fd1498Szrj 
142*38fd1498Szrj /* From here on the bits describe attributes of the options.
143*38fd1498Szrj    Before this point the bits have described the class of the option.
144*38fd1498Szrj    This distinction is important because --help will not list options
145*38fd1498Szrj    which only have these higher bits set.  */
146*38fd1498Szrj 
147*38fd1498Szrj #define CL_JOINED		(1U << 22) /* If takes joined argument.  */
148*38fd1498Szrj #define CL_SEPARATE		(1U << 23) /* If takes a separate argument.  */
149*38fd1498Szrj #define CL_UNDOCUMENTED		(1U << 24) /* Do not output with --help.  */
150*38fd1498Szrj #define CL_NO_DWARF_RECORD	(1U << 25) /* Do not add to producer string.  */
151*38fd1498Szrj #define CL_PCH_IGNORE		(1U << 26) /* Do compare state for pch.  */
152*38fd1498Szrj 
153*38fd1498Szrj /* Flags for an enumerated option argument.  */
154*38fd1498Szrj #define CL_ENUM_CANONICAL	(1 << 0) /* Canonical for this value.  */
155*38fd1498Szrj #define CL_ENUM_DRIVER_ONLY	(1 << 1) /* Only accepted in the driver.  */
156*38fd1498Szrj 
157*38fd1498Szrj /* Structure describing an enumerated option argument.  */
158*38fd1498Szrj 
159*38fd1498Szrj struct cl_enum_arg
160*38fd1498Szrj {
161*38fd1498Szrj   /* The argument text, or NULL at the end of the array.  */
162*38fd1498Szrj   const char *arg;
163*38fd1498Szrj 
164*38fd1498Szrj   /* The corresponding integer value.  */
165*38fd1498Szrj   int value;
166*38fd1498Szrj 
167*38fd1498Szrj   /* Flags associated with this argument.  */
168*38fd1498Szrj   unsigned int flags;
169*38fd1498Szrj };
170*38fd1498Szrj 
171*38fd1498Szrj /* Structure describing an enumerated set of option arguments.  */
172*38fd1498Szrj 
173*38fd1498Szrj struct cl_enum
174*38fd1498Szrj {
175*38fd1498Szrj   /* Help text, or NULL if the values should not be listed in --help
176*38fd1498Szrj      output.  */
177*38fd1498Szrj   const char *help;
178*38fd1498Szrj 
179*38fd1498Szrj   /* Error message for unknown arguments, or NULL to use a generic
180*38fd1498Szrj      error.  */
181*38fd1498Szrj   const char *unknown_error;
182*38fd1498Szrj 
183*38fd1498Szrj   /* Array of possible values.  */
184*38fd1498Szrj   const struct cl_enum_arg *values;
185*38fd1498Szrj 
186*38fd1498Szrj   /* The size of the type used to store a value.  */
187*38fd1498Szrj   size_t var_size;
188*38fd1498Szrj 
189*38fd1498Szrj   /* Function to set a variable of this type.  */
190*38fd1498Szrj   void (*set) (void *var, int value);
191*38fd1498Szrj 
192*38fd1498Szrj   /* Function to get the value of a variable of this type.  */
193*38fd1498Szrj   int (*get) (const void *var);
194*38fd1498Szrj };
195*38fd1498Szrj 
196*38fd1498Szrj extern const struct cl_enum cl_enums[];
197*38fd1498Szrj extern const unsigned int cl_enums_count;
198*38fd1498Szrj 
199*38fd1498Szrj /* Possible ways in which a command-line option may be erroneous.
200*38fd1498Szrj    These do not include not being known at all; an option index of
201*38fd1498Szrj    OPT_SPECIAL_unknown is used for that.  */
202*38fd1498Szrj 
203*38fd1498Szrj #define CL_ERR_DISABLED		(1 << 0) /* Disabled in this configuration.  */
204*38fd1498Szrj #define CL_ERR_MISSING_ARG	(1 << 1) /* Argument required but missing.  */
205*38fd1498Szrj #define CL_ERR_WRONG_LANG	(1 << 2) /* Option for wrong language.  */
206*38fd1498Szrj #define CL_ERR_UINT_ARG		(1 << 3) /* Bad unsigned integer argument.  */
207*38fd1498Szrj #define CL_ERR_INT_RANGE_ARG	(1 << 4) /* Bad unsigned integer argument.  */
208*38fd1498Szrj #define CL_ERR_ENUM_ARG		(1 << 5) /* Bad enumerated argument.  */
209*38fd1498Szrj #define CL_ERR_NEGATIVE		(1 << 6) /* Negative form of option
210*38fd1498Szrj 					    not permitted (together
211*38fd1498Szrj 					    with OPT_SPECIAL_unknown).  */
212*38fd1498Szrj 
213*38fd1498Szrj /* Structure describing the result of decoding an option.  */
214*38fd1498Szrj 
215*38fd1498Szrj struct cl_decoded_option
216*38fd1498Szrj {
217*38fd1498Szrj   /* The index of this option, or an OPT_SPECIAL_* value for
218*38fd1498Szrj      non-options and unknown options.  */
219*38fd1498Szrj   size_t opt_index;
220*38fd1498Szrj 
221*38fd1498Szrj   /* Any warning to give for use of this option, or NULL if none.  */
222*38fd1498Szrj   const char *warn_message;
223*38fd1498Szrj 
224*38fd1498Szrj   /* The string argument, or NULL if none.  For OPT_SPECIAL_* cases,
225*38fd1498Szrj      the option or non-option command-line argument.  */
226*38fd1498Szrj   const char *arg;
227*38fd1498Szrj 
228*38fd1498Szrj   /* The original text of option plus arguments, with separate argv
229*38fd1498Szrj      elements concatenated into one string with spaces separating
230*38fd1498Szrj      them.  This is for such uses as diagnostics and
231*38fd1498Szrj      -frecord-gcc-switches.  */
232*38fd1498Szrj   const char *orig_option_with_args_text;
233*38fd1498Szrj 
234*38fd1498Szrj   /* The canonical form of the option and its argument, for when it is
235*38fd1498Szrj      necessary to reconstruct argv elements (in particular, for
236*38fd1498Szrj      processing specs and passing options to subprocesses from the
237*38fd1498Szrj      driver).  */
238*38fd1498Szrj   const char *canonical_option[4];
239*38fd1498Szrj 
240*38fd1498Szrj   /* The number of elements in the canonical form of the option and
241*38fd1498Szrj      arguments; always at least 1.  */
242*38fd1498Szrj   size_t canonical_option_num_elements;
243*38fd1498Szrj 
244*38fd1498Szrj   /* For a boolean option, 1 for the true case and 0 for the "no-"
245*38fd1498Szrj      case.  For an unsigned integer option, the value of the
246*38fd1498Szrj      argument.  1 in all other cases.  */
247*38fd1498Szrj   int value;
248*38fd1498Szrj 
249*38fd1498Szrj   /* Any flags describing errors detected in this option.  */
250*38fd1498Szrj   int errors;
251*38fd1498Szrj };
252*38fd1498Szrj 
253*38fd1498Szrj /* Structure describing an option deferred for handling after the main
254*38fd1498Szrj    option handlers.  */
255*38fd1498Szrj 
256*38fd1498Szrj struct cl_deferred_option
257*38fd1498Szrj {
258*38fd1498Szrj   /* Elements from struct cl_decoded_option used for deferred
259*38fd1498Szrj      options.  */
260*38fd1498Szrj   size_t opt_index;
261*38fd1498Szrj   const char *arg;
262*38fd1498Szrj   int value;
263*38fd1498Szrj };
264*38fd1498Szrj 
265*38fd1498Szrj /* Structure describing a single option-handling callback.  */
266*38fd1498Szrj 
267*38fd1498Szrj struct cl_option_handler_func
268*38fd1498Szrj {
269*38fd1498Szrj   /* The function called to handle the option.  */
270*38fd1498Szrj   bool (*handler) (struct gcc_options *opts,
271*38fd1498Szrj 		   struct gcc_options *opts_set,
272*38fd1498Szrj 		   const struct cl_decoded_option *decoded,
273*38fd1498Szrj 		   unsigned int lang_mask, int kind, location_t loc,
274*38fd1498Szrj 		   const struct cl_option_handlers *handlers,
275*38fd1498Szrj 		   diagnostic_context *dc,
276*38fd1498Szrj 		   void (*target_option_override_hook) (void));
277*38fd1498Szrj 
278*38fd1498Szrj   /* The mask that must have some bit in common with the flags for the
279*38fd1498Szrj      option for this particular handler to be used.  */
280*38fd1498Szrj   unsigned int mask;
281*38fd1498Szrj };
282*38fd1498Szrj 
283*38fd1498Szrj /* Structure describing the callbacks used in handling options.  */
284*38fd1498Szrj 
285*38fd1498Szrj struct cl_option_handlers
286*38fd1498Szrj {
287*38fd1498Szrj   /* Callback for an unknown option to determine whether to give an
288*38fd1498Szrj      error for it, and possibly store information to diagnose the
289*38fd1498Szrj      option at a later point.  Return true if an error should be
290*38fd1498Szrj      given, false otherwise.  */
291*38fd1498Szrj   bool (*unknown_option_callback) (const struct cl_decoded_option *decoded);
292*38fd1498Szrj 
293*38fd1498Szrj   /* Callback to handle, and possibly diagnose, an option for another
294*38fd1498Szrj      language.  */
295*38fd1498Szrj   void (*wrong_lang_callback) (const struct cl_decoded_option *decoded,
296*38fd1498Szrj 			       unsigned int lang_mask);
297*38fd1498Szrj 
298*38fd1498Szrj   /* Target option override hook.  */
299*38fd1498Szrj   void (*target_option_override_hook) (void);
300*38fd1498Szrj 
301*38fd1498Szrj   /* The number of individual handlers.  */
302*38fd1498Szrj   size_t num_handlers;
303*38fd1498Szrj 
304*38fd1498Szrj   /* The handlers themselves.  */
305*38fd1498Szrj   struct cl_option_handler_func handlers[3];
306*38fd1498Szrj };
307*38fd1498Szrj 
308*38fd1498Szrj /* Hold command-line options associated with stack limitation.  */
309*38fd1498Szrj extern const char *opt_fstack_limit_symbol_arg;
310*38fd1498Szrj extern int opt_fstack_limit_register_no;
311*38fd1498Szrj 
312*38fd1498Szrj /* Input file names.  */
313*38fd1498Szrj 
314*38fd1498Szrj extern const char **in_fnames;
315*38fd1498Szrj 
316*38fd1498Szrj /* The count of input filenames.  */
317*38fd1498Szrj 
318*38fd1498Szrj extern unsigned num_in_fnames;
319*38fd1498Szrj 
320*38fd1498Szrj extern char *opts_concat (const char *first, ...);
321*38fd1498Szrj 
322*38fd1498Szrj /* Obstack for option strings.  */
323*38fd1498Szrj 
324*38fd1498Szrj extern struct obstack opts_obstack;
325*38fd1498Szrj 
326*38fd1498Szrj size_t find_opt (const char *input, unsigned int lang_mask);
327*38fd1498Szrj extern int integral_argument (const char *arg);
328*38fd1498Szrj extern bool enum_value_to_arg (const struct cl_enum_arg *enum_args,
329*38fd1498Szrj 			       const char **argp, int value,
330*38fd1498Szrj 			       unsigned int lang_mask);
331*38fd1498Szrj extern void decode_cmdline_options_to_array (unsigned int argc,
332*38fd1498Szrj 					     const char **argv,
333*38fd1498Szrj 					     unsigned int lang_mask,
334*38fd1498Szrj 					     struct cl_decoded_option **decoded_options,
335*38fd1498Szrj 					     unsigned int *decoded_options_count);
336*38fd1498Szrj extern void init_options_once (void);
337*38fd1498Szrj extern void init_options_struct (struct gcc_options *opts,
338*38fd1498Szrj 				 struct gcc_options *opts_set);
339*38fd1498Szrj extern void init_opts_obstack (void);
340*38fd1498Szrj extern void finalize_options_struct (struct gcc_options *opts);
341*38fd1498Szrj extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
342*38fd1498Szrj 							  const char **argv,
343*38fd1498Szrj 							  struct cl_decoded_option **decoded_options,
344*38fd1498Szrj 							  unsigned int *decoded_options_count);
345*38fd1498Szrj extern void set_default_handlers (struct cl_option_handlers *handlers,
346*38fd1498Szrj 				  void (*target_option_override_hook) (void));
347*38fd1498Szrj extern void decode_options (struct gcc_options *opts,
348*38fd1498Szrj 			    struct gcc_options *opts_set,
349*38fd1498Szrj 			    struct cl_decoded_option *decoded_options,
350*38fd1498Szrj 			    unsigned int decoded_options_count,
351*38fd1498Szrj 			    location_t loc,
352*38fd1498Szrj 			    diagnostic_context *dc,
353*38fd1498Szrj 			    void (*target_option_override_hook) (void));
354*38fd1498Szrj extern int option_enabled (int opt_idx, void *opts);
355*38fd1498Szrj extern bool get_option_state (struct gcc_options *, int,
356*38fd1498Szrj 			      struct cl_option_state *);
357*38fd1498Szrj extern void set_option (struct gcc_options *opts,
358*38fd1498Szrj 			struct gcc_options *opts_set,
359*38fd1498Szrj 			int opt_index, int value, const char *arg, int kind,
360*38fd1498Szrj 			location_t loc, diagnostic_context *dc);
361*38fd1498Szrj extern void *option_flag_var (int opt_index, struct gcc_options *opts);
362*38fd1498Szrj bool handle_generated_option (struct gcc_options *opts,
363*38fd1498Szrj 			      struct gcc_options *opts_set,
364*38fd1498Szrj 			      size_t opt_index, const char *arg, int value,
365*38fd1498Szrj 			      unsigned int lang_mask, int kind, location_t loc,
366*38fd1498Szrj 			      const struct cl_option_handlers *handlers,
367*38fd1498Szrj 			      bool generated_p, diagnostic_context *dc);
368*38fd1498Szrj void generate_option (size_t opt_index, const char *arg, int value,
369*38fd1498Szrj 		      unsigned int lang_mask,
370*38fd1498Szrj 		      struct cl_decoded_option *decoded);
371*38fd1498Szrj void generate_option_input_file (const char *file,
372*38fd1498Szrj 				 struct cl_decoded_option *decoded);
373*38fd1498Szrj extern void read_cmdline_option (struct gcc_options *opts,
374*38fd1498Szrj 				 struct gcc_options *opts_set,
375*38fd1498Szrj 				 struct cl_decoded_option *decoded,
376*38fd1498Szrj 				 location_t loc,
377*38fd1498Szrj 				 unsigned int lang_mask,
378*38fd1498Szrj 				 const struct cl_option_handlers *handlers,
379*38fd1498Szrj 				 diagnostic_context *dc);
380*38fd1498Szrj extern void control_warning_option (unsigned int opt_index, int kind,
381*38fd1498Szrj 				    const char *arg, bool imply, location_t loc,
382*38fd1498Szrj 				    unsigned int lang_mask,
383*38fd1498Szrj 				    const struct cl_option_handlers *handlers,
384*38fd1498Szrj 				    struct gcc_options *opts,
385*38fd1498Szrj 				    struct gcc_options *opts_set,
386*38fd1498Szrj 				    diagnostic_context *dc);
387*38fd1498Szrj extern char *write_langs (unsigned int mask);
388*38fd1498Szrj extern void print_ignored_options (void);
389*38fd1498Szrj extern void handle_common_deferred_options (void);
390*38fd1498Szrj unsigned int parse_sanitizer_options (const char *, location_t, int,
391*38fd1498Szrj 				      unsigned int, int, bool);
392*38fd1498Szrj 
393*38fd1498Szrj unsigned int parse_no_sanitize_attribute (char *value);
394*38fd1498Szrj extern bool common_handle_option (struct gcc_options *opts,
395*38fd1498Szrj 				  struct gcc_options *opts_set,
396*38fd1498Szrj 				  const struct cl_decoded_option *decoded,
397*38fd1498Szrj 				  unsigned int lang_mask, int kind,
398*38fd1498Szrj 				  location_t loc,
399*38fd1498Szrj 				  const struct cl_option_handlers *handlers,
400*38fd1498Szrj 				  diagnostic_context *dc,
401*38fd1498Szrj 				  void (*target_option_override_hook) (void));
402*38fd1498Szrj extern bool target_handle_option (struct gcc_options *opts,
403*38fd1498Szrj 				  struct gcc_options *opts_set,
404*38fd1498Szrj 				  const struct cl_decoded_option *decoded,
405*38fd1498Szrj 				  unsigned int lang_mask, int kind,
406*38fd1498Szrj 				  location_t loc,
407*38fd1498Szrj 				  const struct cl_option_handlers *handlers,
408*38fd1498Szrj 				  diagnostic_context *dc,
409*38fd1498Szrj 				  void (*target_option_override_hook) (void));
410*38fd1498Szrj extern void finish_options (struct gcc_options *opts,
411*38fd1498Szrj 			    struct gcc_options *opts_set,
412*38fd1498Szrj 			    location_t loc);
413*38fd1498Szrj extern void default_options_optimization (struct gcc_options *opts,
414*38fd1498Szrj 					  struct gcc_options *opts_set,
415*38fd1498Szrj 					  struct cl_decoded_option *decoded_options,
416*38fd1498Szrj 					  unsigned int decoded_options_count,
417*38fd1498Szrj 					  location_t loc,
418*38fd1498Szrj 					  unsigned int lang_mask,
419*38fd1498Szrj 					  const struct cl_option_handlers *handlers,
420*38fd1498Szrj 					  diagnostic_context *dc);
421*38fd1498Szrj extern void set_struct_debug_option (struct gcc_options *opts,
422*38fd1498Szrj 				     location_t loc,
423*38fd1498Szrj 				     const char *value);
424*38fd1498Szrj extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
425*38fd1498Szrj 				   int *value, unsigned int lang_mask);
426*38fd1498Szrj 
427*38fd1498Szrj extern const struct sanitizer_opts_s
428*38fd1498Szrj {
429*38fd1498Szrj   const char *const name;
430*38fd1498Szrj   unsigned int flag;
431*38fd1498Szrj   size_t len;
432*38fd1498Szrj   bool can_recover;
433*38fd1498Szrj } sanitizer_opts[];
434*38fd1498Szrj 
435*38fd1498Szrj extern void add_misspelling_candidates (auto_vec<char *> *candidates,
436*38fd1498Szrj 					const struct cl_option *option,
437*38fd1498Szrj 					const char *base_option);
438*38fd1498Szrj extern const char *candidates_list_and_hint (const char *arg, char *&str,
439*38fd1498Szrj 					     const auto_vec <const char *> &
440*38fd1498Szrj 					     candidates);
441*38fd1498Szrj 
442*38fd1498Szrj #endif
443