1 /* Command line option handling.
2 Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Neil Booth.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #include "coretypes.h"
30 #include "langhooks.h"
36 #include "diagnostic.h"
38 /* Value of the -G xx switch, and whether it was passed or not. */
39 unsigned HOST_WIDE_INT g_switch_value;
42 /* True if we should exit after parsing options. */
43 bool exit_after_options;
48 /* Print various extra warnings. -W/-Wextra. */
51 /* Don't print warning messages. -w. */
52 bool inhibit_warnings;
54 /* Treat warnings as errors. -Werror. */
55 bool warnings_are_errors;
57 /* Warn if a function returns an aggregate, since there are often
58 incompatible calling conventions for doing this. */
59 bool warn_aggregate_return;
61 /* Nonzero means warn about pointer casts that increase the required
62 alignment of the target type (and might therefore lead to a crash
63 due to a misaligned access). */
66 /* Nonzero means warn about uses of __attribute__((deprecated))
68 bool warn_deprecated_decl = true;
70 /* Warn when an optimization pass is disabled. */
71 bool warn_disabled_optimization;
73 /* Nonzero means warn if inline function is too large. */
76 /* True to warn about any objects definitions whose size is larger
77 than N bytes. Also want about function definitions whose returned
78 values are larger than N bytes, where N is `larger_than_size'. */
79 bool warn_larger_than;
80 HOST_WIDE_INT larger_than_size;
82 /* Warn about functions which might be candidates for attribute noreturn. */
83 bool warn_missing_noreturn;
85 /* True to warn about code which is never reached. */
88 /* Warn if packed attribute on struct is unnecessary and inefficient. */
91 /* Warn when gcc pads a structure to an alignment boundary. */
94 /* True means warn about all declarations which shadow others. */
97 /* Nonzero means warn about constructs which might not be
98 strict-aliasing safe. */
99 bool warn_strict_aliasing;
101 /* True to warn if a switch on an enum, that does not have a default
102 case, fails to have a case for every enum value. */
105 /* Warn if a switch does not have a default case. */
106 bool warn_switch_default;
108 /* Warn if a switch on an enum fails to have a case for every enum
109 value (regardless of the presence or otherwise of a default case). */
110 bool warn_switch_enum;
112 /* Don't suppress warnings from system headers. -Wsystem-headers. */
113 bool warn_system_headers;
115 /* True to warn about variables used before they are initialized. */
116 int warn_uninitialized;
118 /* True to warn about unused variables, functions et.al. */
119 bool warn_unused_function;
120 bool warn_unused_label;
121 bool warn_unused_parameter;
122 bool warn_unused_variable;
123 bool warn_unused_value;
125 /* Hack for cooperation between set_Wunused and set_Wextra. */
126 static bool maybe_warn_unused_parameter;
128 static size_t find_opt (const char *, int);
129 static int common_handle_option (size_t scode, const char *arg, int value);
130 static void handle_param (const char *);
131 static void set_Wextra (int);
132 static unsigned int handle_option (char **argv, unsigned int lang_mask);
133 static char *write_langs (unsigned int lang_mask);
134 static void complain_wrong_lang (const char *, const struct cl_option *,
135 unsigned int lang_mask);
137 /* Perform a binary search to find which option the command-line INPUT
138 matches. Returns its index in the option array, and N_OPTS
139 (cl_options_count) on failure.
141 This routine is quite subtle. A normal binary search is not good
142 enough because some options can be suffixed with an argument, and
143 multiple sub-matches can occur, e.g. input of "-pedantic" matching
144 the initial substring of "-pedantic-errors".
146 A more complicated example is -gstabs. It should match "-g" with
147 an argument of "stabs". Suppose, however, that the number and list
148 of switches are such that the binary search tests "-gen-decls"
149 before having tested "-g". This doesn't match, and as "-gen-decls"
150 is less than "-gstabs", it will become the lower bound of the
151 binary search range, and "-g" will never be seen. To resolve this
152 issue, opts.sh makes "-gen-decls" point, via the back_chain member,
153 to "-g" so that failed searches that end between "-gen-decls" and
154 the lexicographically subsequent switch know to go back and see if
155 "-g" causes a match (which it does in this example).
157 This search is done in such a way that the longest match for the
158 front end in question wins. If there is no match for the current
159 front end, the longest match for a different front end is returned
160 (or N_OPTS if none) and the caller emits an error message. */
162 find_opt (const char *input, int lang_mask)
164 size_t mn, mx, md, opt_len;
165 size_t match_wrong_lang;
169 mx = cl_options_count;
171 /* Find mn such this lexicographical inequality holds:
172 cl_options[mn] <= input < cl_options[mn + 1]. */
176 opt_len = cl_options[md].opt_len;
177 comp = strncmp (input, cl_options[md].opt_text, opt_len);
185 /* This is the switch that is the best match but for a different
186 front end, or cl_options_count if there is no match at all. */
187 match_wrong_lang = cl_options_count;
189 /* Backtrace the chain of possible matches, returning the longest
190 one, if any, that fits best. With current GCC switches, this
191 loop executes at most twice. */
194 const struct cl_option *opt = &cl_options[mn];
196 /* Is this switch a prefix of the input? */
197 if (!strncmp (input, opt->opt_text, opt->opt_len))
199 /* If language is OK, and the match is exact or the switch
200 takes a joined argument, return it. */
201 if ((opt->flags & lang_mask)
202 && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
205 /* If we haven't remembered a prior match, remember this
206 one. Any prior match is necessarily better. */
207 if (match_wrong_lang == cl_options_count)
208 match_wrong_lang = mn;
211 /* Try the next possibility. This is cl_options_count if there
213 mn = opt->back_chain;
215 while (mn != cl_options_count);
217 /* Return the best wrong match, or cl_options_count if none. */
218 return match_wrong_lang;
221 /* If ARG is a non-negative integer made up solely of digits, return its
222 value, otherwise return -1. */
224 integral_argument (const char *arg)
228 while (*p && ISDIGIT (*p))
237 /* Return a malloced slash-separated list of languages in MASK. */
239 write_langs (unsigned int mask)
241 unsigned int n = 0, len = 0;
242 const char *lang_name;
245 for (n = 0; (lang_name = lang_names[n]) != 0; n++)
246 if (mask & (1U << n))
247 len += strlen (lang_name) + 1;
249 result = xmalloc (len);
251 for (n = 0; (lang_name = lang_names[n]) != 0; n++)
252 if (mask & (1U << n))
256 strcpy (result + len, lang_name);
257 len += strlen (lang_name);
265 /* Complain that switch OPT_INDEX does not apply to this front end. */
267 complain_wrong_lang (const char *text, const struct cl_option *option,
268 unsigned int lang_mask)
270 char *ok_langs, *bad_lang;
272 ok_langs = write_langs (option->flags);
273 bad_lang = write_langs (lang_mask);
275 /* Eventually this should become a hard error IMO. */
276 warning ("command line option \"%s\" is valid for %s but not for %s",
277 text, ok_langs, bad_lang);
283 /* Handle the switch beginning at ARGV for the language indicated by
284 LANG_MASK. Returns the number of switches consumed. */
286 handle_option (char **argv, unsigned int lang_mask)
289 const char *opt, *arg = 0;
292 unsigned int result = 0;
293 const struct cl_option *option;
297 /* Interpret "-" or a non-switch as a file name. */
298 if (opt[0] != '-' || opt[1] == '\0')
300 opt_index = cl_options_count;
302 main_input_filename = opt;
303 result = (*lang_hooks.handle_option) (opt_index, arg, value);
307 /* Drop the "no-" from negative switches. */
308 if ((opt[1] == 'W' || opt[1] == 'f')
309 && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
311 size_t len = strlen (opt) - 3;
313 dup = xmalloc (len + 1);
316 memcpy (dup + 2, opt + 5, len - 2 + 1);
321 opt_index = find_opt (opt + 1, lang_mask | CL_COMMON);
322 if (opt_index == cl_options_count)
325 option = &cl_options[opt_index];
327 /* Reject negative form of switches that don't take negatives as
329 if (!value && (option->flags & CL_REJECT_NEGATIVE))
332 /* We've recognized this switch. */
335 /* Sort out any argument the switch takes. */
336 if (option->flags & CL_JOINED)
338 /* Have arg point to the original switch. This is because
339 some code, such as disable_builtin_function, expects its
340 argument to be persistent until the program exits. */
341 arg = argv[0] + cl_options[opt_index].opt_len + 1;
343 arg += strlen ("no-");
345 if (*arg == '\0' && !(option->flags & CL_MISSING_OK))
347 if (option->flags & CL_SEPARATE)
353 /* Missing argument. */
357 else if (option->flags & CL_SEPARATE)
363 /* Now we've swallowed any potential argument, complain if this
364 is a switch for a different front end. */
365 if (!(option->flags & (lang_mask | CL_COMMON)))
367 complain_wrong_lang (argv[0], option, lang_mask);
371 if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
373 error ("missing argument to \"-%s\"", argv[0]);
377 /* If the switch takes an integer, convert it. */
378 if (arg && (option->flags & CL_UINTEGER))
380 value = integral_argument (arg);
383 error ("argument to \"-%s\" should be a non-negative integer",
389 if (option->flags & lang_mask)
390 if ((*lang_hooks.handle_option) (opt_index, arg, value) == 0)
393 if (result && (option->flags & CL_COMMON))
394 if (common_handle_option (opt_index, arg, value) == 0)
404 /* Decode and handle the vector of command line options. LANG_MASK
405 contains has a single bit set representing the current
408 handle_options (unsigned int argc, char **argv, unsigned int lang_mask)
412 for (i = 1; i < argc; i += n)
414 n = handle_option (argv + i, lang_mask);
419 error ("unrecognized command line option \"%s\"", argv[i]);
424 /* Handle target- and language-independent options. Return zero to
425 generate an "unknown option" message. */
427 common_handle_option (size_t scode, const char *arg,
428 int value ATTRIBUTE_UNUSED)
430 const struct cl_option *option = &cl_options[scode];
431 enum opt_code code = (enum opt_code) scode;
433 if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
435 error ("missing argument to \"-%s\"", option->opt_text);
446 exit_after_options = true;
453 case OPT__target_help:
454 display_target_options ();
455 exit_after_options = true;
459 print_version (stderr, "");
460 exit_after_options = true;
464 g_switch_value = value;
470 /* Currently handled in a prescan. */
474 /* For backward compatibility, -W is the same as -Wextra. */
478 case OPT_Waggregate_return:
479 warn_aggregate_return = value;
482 case OPT_Wcast_align:
483 warn_cast_align = value;
486 case OPT_Wdeprecated_declarations:
487 warn_deprecated_decl = value;
490 case OPT_Wdisabled_optimization:
491 warn_disabled_optimization = value;
495 warnings_are_errors = value;
506 case OPT_Wlarger_than_:
507 larger_than_size = value;
508 warn_larger_than = value != -1;
511 case OPT_Wmissing_noreturn:
512 warn_missing_noreturn = value;
527 case OPT_Wstrict_aliasing:
528 warn_strict_aliasing = value;
535 case OPT_Wswitch_default:
536 warn_switch_default = value;
539 case OPT_Wswitch_enum:
540 warn_switch_enum = value;
543 case OPT_Wsystem_headers:
544 warn_system_headers = value;
547 case OPT_Wuninitialized:
548 warn_uninitialized = value;
551 case OPT_Wunreachable_code:
552 warn_notreached = value;
559 case OPT_Wunused_function:
560 warn_unused_function = value;
563 case OPT_Wunused_label:
564 warn_unused_label = value;
567 case OPT_Wunused_parameter:
568 warn_unused_parameter = value;
571 case OPT_Wunused_value:
572 warn_unused_value = value;
575 case OPT_Wunused_variable:
576 warn_unused_variable = value;
581 aux_info_file_name = arg;
582 flag_gen_aux_info = 1;
589 case OPT_auxbase_strip:
591 char *tmp = xstrdup (arg);
592 strip_off_ending (tmp, strlen (tmp));
599 decode_d_option (arg);
603 dump_base_name = arg;
607 flag_pic = value + value;
611 flag_pie = value + value;
614 case OPT_falign_functions:
615 case OPT_falign_functions_:
616 align_functions = value;
619 case OPT_falign_jumps:
620 case OPT_falign_jumps_:
624 case OPT_falign_labels:
625 case OPT_falign_labels_:
626 align_labels = value;
629 case OPT_falign_loops:
630 case OPT_falign_loops_:
634 case OPT_fargument_alias:
635 flag_argument_noalias = !value;
638 case OPT_fargument_noalias:
639 flag_argument_noalias = value;
642 case OPT_fargument_noalias_global:
643 flag_argument_noalias = value + value;
646 case OPT_fasynchronous_unwind_tables:
647 flag_asynchronous_unwind_tables = value;
650 case OPT_fbounds_check:
651 flag_bounds_check = value;
654 case OPT_fbranch_count_reg:
655 flag_branch_on_count_reg = value;
658 case OPT_fbranch_probabilities:
659 flag_branch_probabilities = value;
662 case OPT_fbranch_target_load_optimize:
663 flag_branch_target_load_optimize = value;
666 case OPT_fbranch_target_load_optimize2:
667 flag_branch_target_load_optimize2 = value;
670 case OPT_fcall_used_:
671 fix_register (arg, 0, 1);
674 case OPT_fcall_saved_:
675 fix_register (arg, 0, 0);
678 case OPT_fcaller_saves:
679 flag_caller_saves = value;
683 flag_no_common = !value;
686 case OPT_fcprop_registers:
687 flag_cprop_registers = value;
690 case OPT_fcrossjumping:
691 flag_crossjumping = value;
694 case OPT_fcse_follow_jumps:
695 flag_cse_follow_jumps = value;
698 case OPT_fcse_skip_blocks:
699 flag_cse_skip_blocks = value;
702 case OPT_fdata_sections:
703 flag_data_sections = value;
707 flag_defer_pop = value;
710 case OPT_fdelayed_branch:
711 flag_delayed_branch = value;
714 case OPT_fdelete_null_pointer_checks:
715 flag_delete_null_pointer_checks = value;
718 case OPT_fdiagnostics_show_location_:
719 if (!strcmp (arg, "once"))
720 diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
721 else if (!strcmp (arg, "every-line"))
722 diagnostic_prefixing_rule (global_dc)
723 = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
728 case OPT_fdump_unnumbered:
729 flag_dump_unnumbered = value;
732 case OPT_feliminate_dwarf2_dups:
733 flag_eliminate_dwarf2_dups = value;
736 case OPT_feliminate_unused_debug_types:
737 flag_eliminate_unused_debug_types = value;
740 case OPT_feliminate_unused_debug_symbols:
741 flag_debug_only_used_symbols = value;
744 case OPT_fexceptions:
745 flag_exceptions = value;
748 case OPT_fexpensive_optimizations:
749 flag_expensive_optimizations = value;
753 set_fast_math_flags (value);
756 case OPT_ffinite_math_only:
757 flag_finite_math_only = value;
761 fix_register (arg, 1, 1);
764 case OPT_ffunction_cse:
765 flag_no_function_cse = !value;
768 case OPT_ffloat_store:
769 flag_float_store = value;
772 case OPT_fforce_addr:
773 flag_force_addr = value;
777 flag_force_mem = value;
780 case OPT_ffunction_sections:
781 flag_function_sections = value;
789 flag_gcse_lm = value;
793 flag_gcse_sm = value;
796 case OPT_fgnu_linker:
797 flag_gnu_linker = value;
800 case OPT_fguess_branch_probability:
801 flag_guess_branch_prob = value;
805 flag_no_ident = !value;
808 case OPT_fif_conversion:
809 flag_if_conversion = value;
812 case OPT_fif_conversion2:
813 flag_if_conversion2 = value;
816 case OPT_finhibit_size_directive:
817 flag_inhibit_size_directive = value;
821 flag_no_inline = !value;
824 case OPT_finline_functions:
825 flag_inline_functions = value;
828 case OPT_finline_limit_:
829 case OPT_finline_limit_eq:
830 set_param_value ("max-inline-insns", value);
831 set_param_value ("max-inline-insns-single", value / 2);
832 set_param_value ("max-inline-insns-auto", value / 2);
833 set_param_value ("max-inline-insns-rtl", value);
834 if (value / 4 < MIN_INLINE_INSNS)
837 set_param_value ("min-inline-insns", value / 4);
839 set_param_value ("min-inline-insns", 10);
843 case OPT_finstrument_functions:
844 flag_instrument_function_entry_exit = value;
847 case OPT_fkeep_inline_functions:
848 flag_keep_inline_functions =value;
851 case OPT_fkeep_static_consts:
852 flag_keep_static_consts = value;
855 case OPT_fleading_underscore:
856 flag_leading_underscore = value;
859 case OPT_floop_optimize:
860 flag_loop_optimize = value;
863 case OPT_fmath_errno:
864 flag_errno_math = value;
867 case OPT_fmem_report:
871 case OPT_fmerge_all_constants:
872 flag_merge_constants = value + value;
875 case OPT_fmerge_constants:
876 flag_merge_constants = value;
879 case OPT_fmessage_length_:
880 output_set_maximum_length (&global_dc->buffer, value);
883 case OPT_fmove_all_movables:
884 flag_move_all_movables = value;
888 flag_new_regalloc = value;
891 case OPT_fnon_call_exceptions:
892 flag_non_call_exceptions = value;
895 case OPT_fold_unroll_all_loops:
896 flag_old_unroll_all_loops = value;
899 case OPT_fold_unroll_loops:
900 flag_old_unroll_loops = value;
903 case OPT_fomit_frame_pointer:
904 flag_omit_frame_pointer = value;
907 case OPT_foptimize_register_move:
908 flag_regmove = value;
911 case OPT_foptimize_sibling_calls:
912 flag_optimize_sibling_calls = value;
915 case OPT_fpack_struct:
916 flag_pack_struct = value;
919 case OPT_fpeel_loops:
920 flag_peel_loops = value;
923 case OPT_fpcc_struct_return:
924 flag_pcc_struct_return = value;
928 flag_no_peephole = !value;
932 flag_peephole2 = value;
943 case OPT_fprefetch_loop_arrays:
944 flag_prefetch_loop_arrays = value;
948 profile_flag = value;
951 case OPT_fprofile_arcs:
952 profile_arc_flag = value;
955 case OPT_frandom_seed:
956 /* The real switch is -fno-random-seed. */
959 flag_random_seed = NULL;
962 case OPT_frandom_seed_:
963 flag_random_seed = arg;
966 case OPT_freduce_all_givs:
967 flag_reduce_all_givs = value;
970 case OPT_freg_struct_return:
971 flag_pcc_struct_return = !value;
975 flag_regmove = value;
978 case OPT_frename_registers:
979 flag_rename_registers = value;
982 case OPT_freorder_blocks:
983 flag_reorder_blocks = value;
986 case OPT_freorder_functions:
987 flag_reorder_functions = value;
990 case OPT_frerun_cse_after_loop:
991 flag_rerun_cse_after_loop = value;
994 case OPT_frerun_loop_opt:
995 flag_rerun_loop_opt = value;
998 case OPT_fsched_interblock:
999 flag_schedule_interblock= value;
1002 case OPT_fsched_spec:
1003 flag_schedule_speculative = value;
1006 case OPT_fsched_spec_load:
1007 flag_schedule_speculative_load = value;
1010 case OPT_fsched_spec_load_dangerous:
1011 flag_schedule_speculative_load_dangerous = value;
1014 case OPT_fsched_verbose_:
1015 #ifdef INSN_SCHEDULING
1016 fix_sched_param ("verbose", arg);
1022 case OPT_fsched2_use_superblocks:
1023 flag_sched2_use_superblocks = value;
1026 case OPT_fsched2_use_traces:
1027 flag_sched2_use_traces = value;
1030 case OPT_fschedule_insns:
1031 flag_schedule_insns = value;
1034 case OPT_fschedule_insns2:
1035 flag_schedule_insns_after_reload = value;
1038 case OPT_fshared_data:
1039 flag_shared_data = value;
1042 case OPT_fsignaling_nans:
1043 flag_signaling_nans = value;
1046 case OPT_fsingle_precision_constant:
1047 flag_single_precision_constant = value;
1055 flag_ssa_ccp = value;
1059 flag_ssa_dce = value;
1062 case OPT_fstack_check:
1063 flag_stack_check = value;
1066 case OPT_fstack_limit:
1067 /* The real switch is -fno-stack-limit. */
1070 stack_limit_rtx = NULL_RTX;
1073 case OPT_fstack_limit_register_:
1075 int reg = decode_reg_name (arg);
1077 error ("unrecognized register name \"%s\"", arg);
1079 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
1083 case OPT_fstack_limit_symbol_:
1084 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (arg));
1087 case OPT_fstrength_reduce:
1088 flag_strength_reduce = value;
1091 case OPT_fstrict_aliasing:
1092 flag_strict_aliasing = value;
1095 case OPT_fsyntax_only:
1096 flag_syntax_only = value;
1099 case OPT_ftest_coverage:
1100 flag_test_coverage = value;
1103 case OPT_fthread_jumps:
1104 flag_thread_jumps = value;
1107 case OPT_ftime_report:
1108 time_report = value;
1111 case OPT_ftls_model_:
1112 if (!strcmp (arg, "global-dynamic"))
1113 flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
1114 else if (!strcmp (arg, "local-dynamic"))
1115 flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
1116 else if (!strcmp (arg, "initial-exec"))
1117 flag_tls_default = TLS_MODEL_INITIAL_EXEC;
1118 else if (!strcmp (arg, "local-exec"))
1119 flag_tls_default = TLS_MODEL_LOCAL_EXEC;
1121 warning ("unknown tls-model \"%s\"", arg);
1125 flag_tracer = value;
1128 case OPT_ftrapping_math:
1129 flag_trapping_math = value;
1136 case OPT_funit_at_a_time:
1137 flag_unit_at_a_time = value;
1140 case OPT_funroll_all_loops:
1141 flag_unroll_all_loops = value;
1144 case OPT_funroll_loops:
1145 flag_unroll_loops = value;
1148 case OPT_funsafe_math_optimizations:
1149 flag_unsafe_math_optimizations = value;
1152 case OPT_funswitch_loops:
1153 flag_unswitch_loops = value;
1156 case OPT_funwind_tables:
1157 flag_unwind_tables = value;
1160 case OPT_fverbose_asm:
1161 flag_verbose_asm = value;
1168 case OPT_fwritable_strings:
1169 flag_writable_strings = value;
1172 case OPT_fzero_initialized_in_bss:
1173 flag_zero_initialized_in_bss = value;
1177 decode_g_option (arg);
1181 set_target_switch (arg);
1185 asm_file_name = arg;
1196 case OPT_pedantic_errors:
1197 flag_pedantic_errors = pedantic = 1;
1209 inhibit_warnings = true;
1216 /* Handle --param NAME=VALUE. */
1218 handle_param (const char *carg)
1223 arg = xstrdup (carg);
1224 equal = strchr (arg, '=');
1226 error ("%s: --param arguments should be of the form NAME=VALUE", arg);
1229 value = integral_argument (equal + 1);
1231 error ("invalid --param value `%s'", equal + 1);
1235 set_param_value (arg, value);
1242 /* Handle -W and -Wextra. */
1244 set_Wextra (int setting)
1246 extra_warnings = setting;
1247 warn_unused_value = setting;
1248 warn_unused_parameter = (setting && maybe_warn_unused_parameter);
1250 /* We save the value of warn_uninitialized, since if they put
1251 -Wuninitialized on the command line, we need to generate a
1252 warning about not using it without also specifying -O. */
1254 warn_uninitialized = 0;
1255 else if (warn_uninitialized != 1)
1256 warn_uninitialized = 2;
1259 /* Initialize unused warning flags. */
1261 set_Wunused (int setting)
1263 warn_unused_function = setting;
1264 warn_unused_label = setting;
1265 /* Unused function parameter warnings are reported when either
1266 ``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified.
1267 Thus, if -Wextra has already been seen, set warn_unused_parameter;
1268 otherwise set maybe_warn_extra_parameter, which will be picked up
1270 maybe_warn_unused_parameter = setting;
1271 warn_unused_parameter = (setting && extra_warnings);
1272 warn_unused_variable = setting;
1273 warn_unused_value = setting;
1276 /* The following routines are useful in setting all the flags that
1277 -ffast-math and -fno-fast-math imply. */
1279 set_fast_math_flags (int set)
1281 flag_trapping_math = !set;
1282 flag_unsafe_math_optimizations = set;
1283 flag_finite_math_only = set;
1284 flag_errno_math = !set;
1286 flag_signaling_nans = 0;
1289 /* Return true iff flags are set as if -ffast-math. */
1291 fast_math_flags_set_p (void)
1293 return (!flag_trapping_math
1294 && flag_unsafe_math_optimizations
1295 && flag_finite_math_only
1296 && !flag_errno_math);