summaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
AgeCommit message (Collapse)Author
2020-02-24PR47785: Add support for handling Xassembler/Wa options with LTO.Prathamesh Kulkarni
2020-02-24 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> Kugan Vivekandarajah <kugan.vivekanandarajah@linaro.org> PR driver/47785 * gcc.c (putenv_COLLECT_AS_OPTIONS): New function. (driver::main): Call putenv_COLLECT_AS_OPTIONS. * opts-common.c (parse_options_from_collect_gcc_options): New function. (prepend_xassembler_to_collect_as_options): Likewise. * opts.h (parse_options_from_collect_gcc_options): Declare prototype. (prepend_xassembler_to_collect_as_options): Likewise. * lto-opts.c (lto_write_options): Stream assembler options in COLLECT_AS_OPTIONS. * lto-wrapper.c (xassembler_options_error): New static variable. (get_options_from_collect_gcc_options): Move parsing options code to parse_options_from_collect_gcc_options and call it. (merge_and_complain): Validate -Xassembler options. (append_compiler_options): Handle OPT_Xassembler. (run_gcc): Append command line -Xassembler options to collect_gcc_options. * doc/invoke.texi: Add documentation about using Xassembler options with LTO. testsuite/ * gcc.target/arm/pr78353-1.c: New test. * gcc.target/arm/pr78353-2.c: Likewise.
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-11-12Remove last leftover usage of params* files.Martin Liska
2019-11-12 Martin Liska <mliska@suse.cz> * common.opt: Remove param_values. * config/i386/i386-options.c (ix86_valid_target_attribute_p): Remove finalize_options_struct. * gcc.c (driver::decode_argv): Do not call global_init_params and finish_params. (driver::finalize): Do not call params_c_finalize and finalize_options_struct. * opt-suggestions.c (option_proposer::get_completions): Remove special casing of params. (option_proposer::find_param_completions): Remove. (test_completion_partial_match): Update expected output. * opt-suggestions.h: Remove find_param_completions. * opts-common.c (add_misspelling_candidates): Add --param with a space. * opts.c (handle_param): Remove. (init_options_struct):. Remove init_options_struct and similar calls. (finalize_options_struct): Remove. (common_handle_option): Use SET_OPTION_IF_UNSET. * opts.h (finalize_options_struct): Remove. * toplev.c (general_init): Do not call global_init_params. (toplev::finalize): Do not call params_c_finalize and finalize_options_struct. From-SVN: r278087
2019-11-12Param to options conversion.Martin Liska
2019-11-12 Martin Liska <mliska@suse.cz> * common.opt: Remove --param and --param= options. * opt-functions.awk: Mark CL_PARAMS for options that have Param keyword. * opts-common.c (decode_cmdline_options_to_array): Replace --param key=value with --param=key=value. * opts.c (print_filtered_help): Remove special printing of params. (print_specific_help): Update title for params. (common_handle_option): Do not handle OPT__param. opts.h (SET_OPTION_IF_UNSET): New macro. * doc/options.texi: Document Param keyword. From-SVN: r278083
2019-09-10Rename Deprecated to WarnRemoved in *.opt files.Martin Liska
2019-09-10 Martin Liska <mliska@suse.cz> * common.opt: Use newly added WarnRemoved. * config/aarch64/aarch64.opt: Likewise. * config/arm/arm.opt: Likewise. * config/i386/i386.opt: Likewise. * config/ia64/ia64.opt: Likewise. * config/rs6000/rs6000.opt: Likewise. * doc/options.texi: Document WarnRemoved properly. * dwarf2out.c (gen_producer_string): Handle renamed OPT_SPECIAL_warn_removed. * lto-opts.c (lto_write_options): Likewise. * lto-wrapper.c (merge_and_complain): Likewise. * opts-common.c (decode_cmdline_option): Likewise. (prune_options): Likewise. (read_cmdline_option): Likewise. (control_warning_option): Likewise. * opts.c (print_filtered_help): Likewise. * optc-gen.awk: Parse for WarnRemoved and make usage of Deprecated an error. * opth-gen.awk: Generate new OPT_SPECIAL_warn_removed. 2019-09-10 Martin Liska <mliska@suse.cz> * c.opt: Use newly added WarnRemoved. From-SVN: r275592
2019-08-28PR driver/80545 - option -Wstringop-overflow not recognized by FortranMartin Sebor
gcc/ChangeLog: PR driver/80545 * opts-common.c (option_enabled): Correct checking for language options. From-SVN: r274996
2019-07-24PR driver/80545 - option -Wstringop-overflow not recognized by FortranMartin Sebor
gcc/cp/ChangeLog: PR driver/80545 * decl.c (finish_function): Use lang_mask. gcc/testsuite/ChangeLog: PR driver/80545 * gcc.misc-tests/help.exp: Add tests. * lib/options.exp: Handle C++. gcc/ChangeLog: PR driver/80545 * diagnostic.c (diagnostic_classify_diagnostic): Use lang_mask. (diagnostic_report_diagnostic): Same. * diagnostic.h (diagnostic_context::option_enabled): Add an argument. (diagnostic_context::lang_mask): New data member. * ipa-pure-const.c (suggest_attribute): Use lang_hooks.option_lang_mask (). * opts-common.c (option_enabled): Handle new argument. (get_option_state): Pass an additional argument. * opts.c (print_filtered_help): Print supported languages for unsupported options. Adjust printing of current state. * opts.h (option_enabled): Add argument. * toplev.c (print_switch_values): Use lang_mask. (general_init): Set global_dc->lang_mask. From-SVN: r273771
2019-07-22Make a warning for -Werror=wrong-language (PR driver/91172).Martin Liska
2019-07-22 Martin Liska <mliska@suse.cz> PR driver/91172 * opts-common.c (decode_cmdline_option): Decode argument of -Werror and check it for a wrong language. * opts-global.c (complain_wrong_lang): Remove such case. 2019-07-22 Martin Liska <mliska@suse.cz> PR driver/91172 * gcc.dg/pr91172.c: New test. From-SVN: r273660
2019-06-05c-decl.c (start_decl): Adjust quoting and hyphenation in diagnostics.Martin Sebor
gcc/c/ChangeLog: * c-decl.c (start_decl): Adjust quoting and hyphenation in diagnostics. (finish_decl): Same. (finish_enum): Same. (start_function): Same. (declspecs_add_type): Same. * c-parser.c (warn_for_abs): Same. * c-typeck.c (build_binary_op): Same. gcc/c-family/ChangeLog: * c-attribs.c (handle_mode_attribute): Adjust quoting and hyphenation. (handle_alias_ifunc_attribute): Same. (handle_copy_attribute): Same. (handle_weakref_attribute): Same. (handle_nonnull_attribute): Same. * c-warn.c (warn_for_sign_compare): Same. (warn_for_restrict): Same. * c.opt: Same. gcc/cp/ChangeLog: * call.c (build_conditional_expr_1): Adjust quoting and hyphenation. (convert_like_real): Same. (convert_arg_to_ellipsis): Same. * constexpr.c (diag_array_subscript): Same. * constraint.cc (diagnose_trait_expression): Same. * cvt.c (ocp_convert): Same. * decl.c (start_decl): Same. (check_for_uninitialized_const_var): Same. (grokfndecl): Same. (check_special_function_return_type): Same. (finish_enum_value_list): Same. (start_preparsed_function): Same. * parser.c (cp_parser_decl_specifier_seq): Same. * typeck.c (cp_build_binary_op): Same. (build_static_cast_1): Same. gcc/lto/ChangeLog: * lto-common.c (lto_file_finalize): Adjust quoting and hyphenation. gcc/objc/ChangeLog: * objc-act.c (objc_build_setter_call): Adjust quoting and hyphenation. * objc-encoding.c (encode_gnu_bitfield): Same. gcc/ChangeLog: * config/i386/i386-features.c (ix86_get_function_versions_dispatcher): Adjust quoting and hyphenation. * convert.c (convert_to_real_1): Same. * gcc.c (driver_wrong_lang_callback): Same. (driver::handle_unrecognized_options): Same. * gimple-ssa-nonnull-compare.c (do_warn_nonnull_compare): Same. * opts-common.c (cmdline_handle_error): Same. (read_cmdline_option): Same. * opts-global.c (complain_wrong_lang): Same. (print_ignored_options): Same. (handle_common_deferred_options): Same. * pretty-print.h: Same. * print-rtl.c (debug_bb_n_slim): Same. * sched-rgn.c (make_pass_sched_fusion): Same. * tree-cfg.c (verify_gimple_assign_unary): Same. (verify_gimple_label): Same. * tree-ssa-operands.c (verify_ssa_operands): Same. * varasm.c (do_assemble_alias): Same. (assemble_alias): Same. From-SVN: r271971
2019-03-29opts-common.c (integral_argument): Set errno properly in one case.Roman Zhuykov
* opts-common.c (integral_argument): Set errno properly in one case. * gcc.dg/diag-sanity.c: New test. From-SVN: r270022
2019-02-23driver: Also prune joined switches with negationH.J. Lu
When -march=native is passed to host_detect_local_cpu to the backend, it overrides all command lines after it. That means $ gcc -march=native -march=skylake-avx512 is the treated as $ gcc -march=skylake-avx512 -march=native Prune joined switches with Negative and RejectNegative to allow -march=skylake-avx512 to override previous -march=native on command-line. gcc/ PR driver/69471 * opts-common.c (prune_options): Also prune joined switches with Negative and RejectNegative. * config/i386/i386.opt (march=): Add Negative(march=). (mtune=): Add Negative(mtune=). * doc/options.texi: Document Negative used together with Joined and RejectNegative. gcc/testsuite/ PR driver/69471 * gcc.dg/pr69471-1.c: New test. * gcc.dg/pr69471-2.c: Likewise. * gcc.target/i386/pr69471-3.c: Likewise. From-SVN: r269164
2019-01-01Update copyright years.Jakub Jelinek
From-SVN: r267494
2018-08-20Add support for grouping of related diagnostics (PR other/84889)David Malcolm
We often emit logically-related groups of diagnostics. A relatively simple case is this: if (warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); where the "note" diagnostic issued by the "inform" call is guarded by the -Wmultistatement_macros warning. More complicated examples can be seen in the C++ frontend, where e.g. print_z_candidates can lead to numerous "note" diagnostics being emitted. I'm looking at various ways to improve how we handle such related diagnostics, but, prior to this patch, there was no explicit relationship between these diagnostics: the diagnostics subsystem had no way of "knowing" that these were related. This patch introduces a simple way to group the diagnostics: an auto_diagnostic_group class: all diagnostics emitted within the lifetime of an auto_diagnostic_group instance are logically grouped. Hence in the above example, the two diagnostics can be grouped by simply adding an auto_diagnostic_group instance: auto_diagnostic_group d; if (warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); Some more awkard cases are of the form: if (some_condition && warning_at (...) && more_conditions) inform (...); which thus need restructuring to: if (some_condition) { auto_diagnostic_group d; warning_at (...); if (more_conditions) inform (...); } so that the lifetime of the auto_diagnostic_group groups the warning_at and the inform call. Nesting is handled by simply tracking a nesting depth within the diagnostic_context.: all diagnostics are treated as grouped until the final auto_diagnostic_group is popped. diagnostic.c uses this internally, so that all diagnostics are part of a group - those that are "by themselves" are treated as being part of a group with one element. The diagnostic_context gains optional callbacks for displaying the start of a group (when the first diagnostic is emitted within it), and the end of a group (for when the group was non-empty); these callbacks are unused by default, but a test plugin demonstrates them (and verifies that the machinery is working). As noted above, I'm looking at various ways to use the grouping to improve how we output the diagnostics. FWIW, I experimented with a more involved implementation, of the form: diagnostic_group d; if (d.warning_at (body_loc, OPT_Wmultistatement_macros, "macro expands to multiple statements")) d.inform (guard_loc, "some parts of macro expansion are not guarded by " "this %qs clause", guard_tinfo_to_string (keyword)); which had the advantage of allowing auto-detection of the places where groups were needed (by converting ::warning_at's return type to bool), but it was a much more invasive patch, especially when dealing with the places in the C++ frontend that can emit numerous notes after an error or warning (and thus having to pass the group around) Hence I went with this simpler approach. gcc/c-family/ChangeLog: PR other/84889 * c-attribs.c (common_handle_aligned_attribute): Add auto_diagnostic_group instance. * c-indentation.c (warn_for_misleading_indentation): Likewise. * c-opts.c (c_common_post_options): Likewise. * c-warn.c (warn_logical_not_parentheses): Likewise. (warn_duplicated_cond_add_or_warn): Likewise. (warn_for_multistatement_macros): Likewise. gcc/c/ChangeLog: PR other/84889 * c-decl.c (pushtag): Add auto_diagnostic_group instance. (diagnose_mismatched_decls): Likewise, in various places. (warn_if_shadowing): Likewise. (implicit_decl_warning): Likewise. (implicitly_declare): Likewise. (undeclared_variable): Likewise. (declare_label): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. * c-parser.c (c_parser_declaration_or_fndef): Likewise. (c_parser_parameter_declaration): Likewise. (c_parser_binary_expression): Likewise. * c-typeck.c (c_expr_sizeof_expr): Likewise. (parser_build_binary_op): Likewise. (build_unary_op): Likewise. (error_init): Likewise. (pedwarn_init): Likewise. (warning_init): Likewise. (convert_for_assignment): Likewise. gcc/cp/ChangeLog: PR other/84889 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group instance(s). (print_error_for_call_failure): Likewise. (build_op_call_1): Likewise. (build_conditional_expr_1): Likewise. (build_new_op_1): Likewise. (build_op_delete_call): Likewise. (convert_like_real): Likewise. (build_over_call): Likewise. (build_new_method_call_1): Likewise. (joust): Likewise. * class.c (check_tag): Likewise. (finish_struct_anon_r): Likewise. (one_inherited_ctor): Likewise. (finalize_literal_type_property): Likewise. (explain_non_literal_class): Likewise. (find_flexarrays): Likewise. (resolve_address_of_overloaded_function): Likewise. * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise. (is_valid_constexpr_fn): Likewise. (cx_check_missing_mem_inits): Likewise. * cp-gimplify.c (cp_genericize_r): Likewise. * cvt.c (maybe_warn_nodiscard): Likewise. * decl.c (warn_extern_redeclared_static): Likewise. (check_redeclaration_exception_specification): Likewise. (check_no_redeclaration_friend_default_args): Likewise. (duplicate_decls): Likewise. (redeclaration_error_message): Likewise. (warn_misplaced_attr_for_class_type): Likewise. * decl2.c (finish_static_data_member_decl): Likewise. (no_linkage_error): Likewise. (cp_warn_deprecated_use): Likewise. * error.c (qualified_name_lookup_error): Likewise. * friend.c (make_friend_class): Likewise. (do_friend): Likewise. * init.c (perform_member_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_delete): Likewise. * lex.c (unqualified_name_lookup_error): Likewise. * name-lookup.c (check_extern_c_conflict): Likewise. (inform_shadowed): New function. (check_local_shadow): Add auto_diagnostic_group instances, replacing goto "inform_shadowed" label with call to subroutine. (set_local_extern_decl_linkage): Add auto_diagnostic_group instance(s). * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_namespace_name): Likewise. * pt.c (check_specialization_namespace): Likewise. (check_template_variable): Likewise. (warn_spec_missing_attributes): Likewise. (check_explicit_specialization): Likewise. (process_partial_specialization): Likewise. (lookup_template_class_1): Likewise. (finish_template_variable): Likewise. (do_auto_deduction): Likewise. * search.c (check_final_overrider): Likewise. (look_for_overrides_r): Likewise. * tree.c (maybe_warn_parm_abi): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cp_build_function_call_vec): Likewise. (cp_build_binary_op): Likewise. (convert_for_assignment): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. * typeck2.c (abstract_virtuals_error_sfinae): Likewise. (check_narrowing): Likewise. gcc/ChangeLog: PR other/84889 * attribs.c (diag_attr_exclusions): Add auto_diagnostic_group instance. (decl_attributes): Likewise. * calls.c (maybe_warn_nonstring_arg): Add auto_diagnostic_group instance. * cgraphunit.c (maybe_diag_incompatible_alias): Likewise. * diagnostic-core.h (class auto_diagnostic_group): New class. * diagnostic.c (diagnostic_initialize): Initialize the new fields. (diagnostic_report_diagnostic): Handle the first diagnostics within a group. (emit_diagnostic): Add auto_diagnostic_group instance. (inform): Likewise. (inform_n): Likewise. (warning): Likewise. (warning_at): Likewise. (warning_n): Likewise. (pedwarn): Likewise. (permerror): Likewise. (error): Likewise. (error_n): Likewise. (error_at): Likewise. (sorry): Likewise. (fatal_error): Likewise. (internal_error): Likewise. (internal_error_no_backtrace): Likewise. (auto_diagnostic_group::auto_diagnostic_group): New ctor. (auto_diagnostic_group::~auto_diagnostic_group): New dtor. * diagnostic.h (struct diagnostic_context): Add fields "diagnostic_group_nesting_depth", "diagnostic_group_emission_count", "begin_group_cb", "end_group_cb". * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior): Add auto_diagnostic_group instance(s). (find_explicit_erroneous_behavior): Likewise. * gimple-ssa-warn-alloca.c (pass_walloca::execute): Likewise. * gimple-ssa-warn-restrict.c (maybe_diag_offset_bounds): Likewise. * gimplify.c (warn_implicit_fallthrough_r): Likewise. (gimplify_va_arg_expr): Likewise. * hsa-gen.c (HSA_SORRY_ATV): Likewise. (HSA_SORRY_AT): Likewise. * ipa-devirt.c (compare_virtual_tables): Likewise. (warn_odr): Likewise. * multiple_target.c (expand_target_clones): Likewise. * opts-common.c (cmdline_handle_error): Likewise. * reginfo.c (globalize_reg): Likewise. * substring-locations.c (format_warning_n_va): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise. * tree-ssa-loop-niter.c (do_warn_aggressive_loop_optimizations): Likewise. * tree-ssa-uninit.c (warn_uninit): Likewise. * tree.c (warn_deprecated_use): Likewise. gcc/testsuite/ChangeLog: PR other/84889 * gcc.dg/plugin/diagnostic-group-test-1.c: New test. * gcc.dg/plugin/diagnostic_group_plugin.c: New test. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests. From-SVN: r263675
2018-08-17Merge Ignore and Deprecated in .opt files.Martin Liska
2018-08-17 Martin Liska <mliska@suse.cz> * common.opt: Remove Warn, Init and Report for options with Ignore/Deprecated flag. Warning is done automatically for Deprecated flags. * config/i386/i386.opt: Likewise. * config/ia64/ia64.opt: Likewise. * config/rs6000/rs6000.opt: Likewise. * cppbuiltin.c (define_builtin_macros_for_compilation_flags): Remove usage of flag_check_pointer_bounds. * lto-wrapper.c (merge_and_complain): Do not handle OPT_fcheck_pointer_bounds. (append_compiler_options): Likewise. * opt-functions.awk: Do not handle Deprecated. * optc-gen.awk: Check that Var, Report and Init are not used for an option with Ignore/Deprecated flag. * opts-common.c (decode_cmdline_option): Do not report CL_ERR_DEPRECATED. (read_cmdline_option): Report warning for OPT_SPECIAL_deprecated options. * opts.h (struct cl_option): Remove cl_deprecated flag. (CL_ERR_DEPRECATED): Remove error enum value. 2018-08-17 Martin Liska <mliska@suse.cz> * g++.dg/opt/mpx.C: Fix scanned pattern. * gcc.target/i386/mpx.c: Likewise. * g++.dg/warn/Wunreachable-code-1.C: Remove. * g++.dg/warn/Wunreachable-code-2.C: Likewise. * gcc.dg/torture/pr52969.c: Likewise. * g++.dg/warn/pr31246-2.C: Likewise. * g++.dg/warn/pr31246.C: Likewise. * gcc.dg/pr33092.c: Likewise. * g++.dg/opt/eh1.C: Remove a deprecated option. * g++.dg/template/inline1.C: Likewise. * g++.dg/tree-ssa/pr81408.C: Likewise. * gcc.dg/pr41837.c: Likewise. * gcc.dg/pr41841.c: Likewise. * gcc.dg/pr42250.c: Likewise. * gcc.dg/pr43084.c: Likewise. * gcc.dg/pr43317.c: Likewise. * gcc.dg/pr51879-18.c: Likewise. * gcc.dg/torture/pr36066.c: Likewise. * gcc.dg/tree-ssa/ifc-8.c: Likewise. * gcc.dg/tree-ssa/ifc-cd.c: Likewise. * gcc.dg/tree-ssa/pr19210-1.c: Likewise. * gcc.dg/tree-ssa/pr45122.c: Likewise. * gcc.target/i386/pr45352-2.c: Likewise. * gcc.target/i386/zee.c: Likewise. * gfortran.dg/auto_char_len_2.f90: Likewise. * gfortran.dg/auto_char_len_4.f90: Likewise. * gfortran.dg/c_ptr_tests_15.f90: Likewise. * gfortran.dg/char_array_structure_constructor.f90: Likewise. * gfortran.dg/gomp/pr47331.f90: Likewise. * gfortran.dg/pr40999.f: Likewise. * gfortran.dg/pr41011.f: Likewise. * gfortran.dg/pr42051.f03: Likewise. * gfortran.dg/pr46804.f90: Likewise. * gfortran.dg/pr83149_1.f90: Likewise. * gfortran.dg/pr83149_b.f90: Likewise. * gfortran.dg/whole_file_1.f90: Likewise. * gfortran.dg/whole_file_10.f90: Likewise. * gfortran.dg/whole_file_11.f90: Likewise. * gfortran.dg/whole_file_12.f90: Likewise. * gfortran.dg/whole_file_13.f90: Likewise. * gfortran.dg/whole_file_14.f90: Likewise. * gfortran.dg/whole_file_15.f90: Likewise. * gfortran.dg/whole_file_16.f90: Likewise. * gfortran.dg/whole_file_17.f90: Likewise. * gfortran.dg/whole_file_18.f90: Likewise. * gfortran.dg/whole_file_19.f90: Likewise. * gfortran.dg/whole_file_2.f90: Likewise. * gfortran.dg/whole_file_20.f03: Likewise. * gfortran.dg/whole_file_3.f90: Likewise. * gfortran.dg/whole_file_4.f90: Likewise. * gfortran.dg/whole_file_5.f90: Likewise. * gfortran.dg/whole_file_6.f90: Likewise. * gfortran.dg/whole_file_7.f90: Likewise. * gfortran.dg/whole_file_8.f90: Likewise. * gfortran.dg/whole_file_9.f90: Likewise. * gcc.dg/vect/vect.exp: Likewise. 2018-08-17 Martin Liska <mliska@suse.cz> * c.opt: Remove Warn, Init and Report for options with Ignore/Deprecated flag. Warning is done automatically for Deprecated flags. From-SVN: r263614
2018-07-20PR middle-end/82063 - issues with arguments enabled by -WallMartin Sebor
gcc/ada/ChangeLog: PR middle-end/82063 * gcc-interface/misc.c (gnat_handle_option): Change function argument to HOST_WIDE_INT. gcc/brig/ChangeLog: PR middle-end/82063 * brig/brig-lang.c (brig_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/c-family/ChangeLog: PR middle-end/82063 * c-common.h (c_common_handle_option): Change function argument to HOST_WIDE_INT. * c-opts.c (c_common_init_options): Same. (c_common_handle_option): Same. Remove special handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * c.opt (-Walloc-size-larger-than, -Walloca-larger-than): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. (-Wvla-larger-than): Same. (-Wno-alloc-size-larger-than, -Wno-alloca-larger-than): New. (-Wno-vla-larger-than): Same. gcc/fortran/ChangeLog: PR middle-end/82063 * gfortran.h (gfc_handle_option): Change function argument to HOST_WIDE_INT. * options.c (gfc_handle_option): Same. gcc/go/ChangeLog: PR middle-end/82063 * go-lang.c (go_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/lto/ChangeLog: PR middle-end/82063 * lto-lang.c (lto_handle_option): Change function argument to HOST_WIDE_INT. gcc/testsuite/ChangeLog: PR middle-end/82063 * gcc/testsuite/c-c++-common/pr68657-1.c: Adjust. * gcc/testsuite/c-c++-common/pr68657-2.c: Same. * gcc/testsuite/c-c++-common/pr68657-3.c: Same. * gcc.dg/Walloc-size-larger-than-16.c: Same. * gcc.dg/Walloca-larger-than.c: New test. * gcc.dg/Walloca-larger-than-2.c: New test. * gcc.dg/Wframe-larger-than-2.c: New test. * gcc.dg/Wlarger-than3.c: New test. * gcc.dg/Wvla-larger-than-3.c: New test. * gcc.dg/pr42611.c: Adjust. * gnat.dg/frame_overflow.adb: Same. gcc/ChangeLog: PR middle-end/82063 * builtins.c (expand_builtin_alloca): Adjust. * calls.c (alloc_max_size): Simplify. * cgraphunit.c (cgraph_node::expand): Adjust. * common.opt (larger_than_size, warn_frame_larger_than): Remove variables. (frame_larger_than_size): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. * doc/invoke.texi (GCC Command Options): Document option arguments. Explain byte-size arguments and suffixes. (-Wvla-larger-than, -Wno-alloc-size-larger-than): Update. (-Wno-alloca-larger-than, -Wno-vla-larger-than): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Same. * doc/options.texi (UInteger): Expand. (Host_Wide_Int, ByteSize): Document new properties. * final.c (final_start_function_1): Include sizes in an error message. * function.c (frame_offset_overflow): Same. * gimple-ssa-warn-alloca.c (pass_walloca::gate): Adjust. (alloca_call_type_by_arg): Change function argument to HOST_WIDE_INT. Diagnose unbounded alloca calls only for limits of less than PTRDIFF_MAX. (alloca_call_type): Adjust. Diagnose possibly out-of-bounds alloca calls and VLA size only for limits of less than PTRDIFF_MAX. Same for alloca(0). (pass_walloca::execute): Adjust. Diagnose alloca calls in loops only for limits of less than PTRDIFF_MAX. * langhooks-def.h (lhd_handle_option): Change function argument to HOST_WIDE_INT. * langhooks.c (lhd_handle_option): Same. * langhooks.h (handle_option): Same. * opt-functions.awk (switch_bit_fields): Handle Host_Wide_Int and ByteSize flags. (var_type, var_type_struct): Same. (var_set): Handle ByteSize flag. * optc-gen.awk: Add comments to output to ease debugging. Make use of HOST_WIDE_INT where appropriate. * opts-gen-save.awk: Use %lx to format unsigned long. * opth-gen.awk: Change function argument to HOST_WIDE_INT. * opts-common.c (integral_argument): Return HOST_WIDE_INT and add arguments. Parse bytes-size suffixes. (enum_arg_to_value): Change function argument to HOST_WIDE_INT. (enum_value_to_arg): Same. (decode_cmdline_option): Handle cl_host_wide_int. Adjust. (handle_option): Adjust. (generate_option): Change function argument to HOST_WIDE_INT. (cmdline_handle_error): Adjust. (read_cmdline_option): Change function argument to HOST_WIDE_INT. (set_option): Change function argument to HOST_WIDE_INT. (option_enabled): Handle cl_host_wide_int. (get_option_state): Handle CLVC_SIZE. (control_warning_option): Same. * opts.c (common_handle_option): Change function argument to HOST_WIDE_INT. Remove handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * opts.h (enum cl_var_type): Add an enumerator. * stor-layout.c (layout_decl): Print a more meaningful warning. * toplev.c (output_stack_usage): Adjust. From-SVN: r262910
2018-06-12Come up with Deprecated option flag.Martin Liska
2018-06-12 Martin Liska <mliska@suse.cz> * doc/options.texi: Document Deprecated option flag. 2018-06-12 Martin Liska <mliska@suse.cz> * config/i386/i386.opt: Make MPX-related options as Deprecated. * opt-functions.awk: Handle Deprecated flag. * opts-common.c (decode_cmdline_option): Handle cl_deprecated and report error. (read_cmdline_option): Report warning for a deprecated option. * opts.h (struct cl_option): Add new field cl_deprecated. (CL_ERR_DEPRECATED): New. 2018-06-12 Martin Liska <mliska@suse.cz> * c.opt: Make MPX-related options as Deprecated. 2018-06-12 Martin Liska <mliska@suse.cz> * g++.dg/opt/mpx.C: New test. * gcc.target/i386/mpx.c: New test. From-SVN: r261497
2018-01-03Update copyright years.Jakub Jelinek
From-SVN: r256169
2017-09-21enable handling of -gno- command-line options as negated prefixesAlexandre Oliva
This patch that adds -g to the set of negatable prefixes along with -f, -m and -W. Besides the mapping from -gno- to negated -g in option_map and adding g to the [fmW] matches for negatable options, I had to introduce gno- as an remapping prefix, for the option searching machinery to backtrack to and recognize as a remapping prefix, instead of backtracking to -g and stopping at it as if no-* was its Joined argument. Adding such remapping prefixes to preempt further backtracking can be accomplished by introducing the prefix as an Undocumented option with a Joined argument and without Driver, Target, Common, or any language-specific option. Whenever we match such a fake options prefix, we abandon further backtracking (it matches, after all), but find_opt returns the same code it would if it hadn't found any match, so that we resort to option mapping. I've arranged for such remapping prefixes to not be considered when looking for and suggesting a correct spelling for misspelled options. While testing that, I found a few -W-started options that were not marked as RejectNegative but should (-Wno-a, is not something we'd like to suggest ;-) I've also marked as such -g-started options that it makes no sense to negate, and removed the explicit -gno- ones, allowing their opposites to be negated. for gcc/ChangeLog * common.opt (Wa, Wl, Wp, g, gz=): Add RejectNegative. (gno-column-info): Remove. (gcolumn-info): Drop RejectNegative. (gno-): New prefix. (gno-record-gcc-switches): Remove. (grecord-gcc-switches): Drop RejectNegative. (gno-split-dwarf): Remove. (gsplit-dwarf): Drop RejectNegative. (gno-strict-dwarf): Remove. (gstrict-dwarf): Drop RejectNegative. * config/darwin.opt (gfull, gused): Add RejectNegative. * dwarf2out.c (gen_producer_string): Drop gno-record-gcc-switches handler. * optc-gen.awk: Add g to prefixes with negative forms. * opts-common.c (remapping_prefix_p): New. (find_opt): Check it. (generate_canonical_option): Test g prefix. (option_map): Add -gno- mapping. (add_misspelling_candidates): Check remapping_prefix_p. for gcc/ada/ChangeLog * gcc-interface/lang.opt (gant, gnatO, gnat): Add RejectNegative. for gcc/c-family/ChangeLog * c.opt (gen-decls): Add RejectNegative. From-SVN: r253047
2017-08-29Fix --help=target (PR other/39851).Martin Liska
2017-08-29 Martin Liska <mliska@suse.cz> PR other/39851 * gcc.c (driver_handle_option): Add new argument. * opts-common.c (handle_option): Pass target_option_override_hook. * opts-global.c (lang_handle_option): Add new option. (set_default_handlers): Add new argument. (decode_options): Likewise. * opts.c (target_handle_option): Likewise. (common_handle_option): Call target_option_override_hook. * opts.h (struct cl_option_handler_func): Add hook for target option override. (struct cl_option_handlers): Likewise. (set_default_handlers): Add new argument. (decode_options): Likewise. (common_handle_option): Likewise. (target_handle_option): Likewise. * toplev.c (toplev::main): Pass targetm.target_option.override hook. 2017-08-29 Martin Liska <mliska@suse.cz> PR other/39851 * c-common.c (parse_optimize_options): Add argument to function call. * c-pragma.c (handle_pragma_diagnostic): Likewise. From-SVN: r251400
2017-06-28Introduce IntegerRange for options (PR driver/79659).Martin Liska
2017-06-28 Martin Liska <mliska@suse.cz> PR driver/79659 * common.opt: Add IntegerRange to various options. * opt-functions.awk (integer_range_info): New function. * optc-gen.awk: Add integer_range_info to cl_options struct. * opts-common.c (decode_cmdline_option): Handle CL_ERR_INT_RANGE_ARG. (cmdline_handle_error): Likewise. * opts.c (print_filtered_help): Show valid interval in when --help is provided. * opts.h (struct cl_option): Add range_min and range_max fields. * config/i386/i386.opt: Add IntegerRange for -mbranch-cost. 2017-06-28 Martin Liska <mliska@suse.cz> PR driver/79659 * c.opt: Add IntegerRange to various options. 2017-06-28 Martin Liska <mliska@suse.cz> PR driver/79659 * g++.dg/opt/pr79659.C: New test. From-SVN: r249734
2017-02-25re PR c/79677 (Weird handling of -Werror=)Jakub Jelinek
PR c/79677 * opts.h (handle_generated_option): Add GENERATED_P argument. * opts-common.c (handle_option): Adjust function comment. (handle_generated_option): Add GENERATED_P argument, pass it to handle_option. (control_warning_option): Pass false to handle_generated_option GENERATED_P. * opts.c (maybe_default_option): Pass true to handle_generated_option GENERATED_P. * optc-gen.awk: Likewise. ada/ * gcc-interface/misc.c (gnat_handle_option): Pass true to handle_generated_option GENERATED_P. testsuite/ * gcc.dg/pr79677.c: New test. From-SVN: r245728
2017-01-01Update copyright years.Jakub Jelinek
From-SVN: r243994
2016-09-13re PR middle-end/77475 (unnecessary or misleading context in reporting ↵Jakub Jelinek
command line problems) PR middle-end/77475 * opts.h (candidates_list_and_hint): Declare. * opts-common.c (candidates_list_and_hint): New function. (cmdline_handle_error): Use it. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r240107
2016-06-30Fix bogus option suggestions for RejectNegative options (PR driver/71651)David Malcolm
gcc/ChangeLog: PR driver/71651 * gcc.c (driver::build_option_suggestions): Pass "option" to add_misspelling_candidates. * opts-common.c (add_misspelling_candidates): Add "option" param; use it to avoid adding negated forms for options marked with RejectNegative. * opts.h (add_misspelling_candidates): Add "option" param. gcc/testsuite/ChangeLog: PR driver/71651 * gcc.dg/spellcheck-options-12.c: New test case. From-SVN: r237880
2016-05-19PR driver/69265: add hint for options with misspelled argumentsDavid Malcolm
opts-common.c's cmdline_handle_error handles invalid arguments for options with CL_ERR_ENUM_ARG by building a string listing the valid arguments. By also building a vec of valid arguments, we can use find_closest_string and provide a hint if we see a close misspelling. gcc/ChangeLog: PR driver/69265 * Makefile.in (GCC_OBJS): Move spellcheck.o to... (OBJS-libcommon-target): ...here. * opts-common.c: Include spellcheck.h. (cmdline_handle_error): Build a vec of valid options and use it to suggest provide hints for misspelled arguments. gcc/testsuite/ChangeLog: PR driver/69265 * gcc.dg/spellcheck-options-11.c: New test case. From-SVN: r236439
2016-02-12PR driver/69265 and 69453: improved suggestions for various misspelled optionsDavid Malcolm
gcc/ChangeLog: PR driver/69265 PR driver/69453 * gcc.c (driver::driver): Initialize m_option_suggestions. (driver::~driver): Clean up m_option_suggestions. (suggest_option): Convert to... (driver::suggest_option): ...this, and split out into driver::build_option_suggestions and find_closest_string. (driver::build_option_suggestions): New function, from first half of suggest_option. Special-case OPT_fsanitize_ and OPT_fsanitize_recover_, making use of the sanitizer_opts array. For options of enum types, add the various enum values to the candidate strings. (driver::handle_unrecognized_options): Remove "const". * gcc.h (driver::handle_unrecognized_options): Likewise. (driver::build_option_suggestions): New decl. (driver::suggest_option): New decl. (driver::m_option_suggestions): New field. * opts-common.c (add_misspelling_candidates): New function. * opts.c (sanitizer_opts): Remove decl of struct sanitizer_opts_s and make non-static. * opts.h (sanitizer_opts): New array decl. (add_misspelling_candidates): New function decl. * spellcheck.c (find_closest_string): New function. * spellcheck.h (find_closest_string): New function decl. gcc/testsuite/ChangeLog: PR driver/69265 PR driver/69453 * gcc.dg/spellcheck-options-3.c: New test case. * gcc.dg/spellcheck-options-4.c: New test case. * gcc.dg/spellcheck-options-5.c: New test case. * gcc.dg/spellcheck-options-6.c: New test case. * gcc.dg/spellcheck-options-7.c: New test case. * gcc.dg/spellcheck-options-8.c: New test case. * gcc.dg/spellcheck-options-9.c: New test case. * gcc.dg/spellcheck-options-10.c: New test case. From-SVN: r233382
2016-01-04Update copyright years.Jakub Jelinek
From-SVN: r232055
2015-12-14re PR c/68833 (-Werror=format issues an error now)Jakub Jelinek
PR c/68833 * common.opt (Wmissing-noreturn): Add Warning option. * opts-common.c (control_warning_option): If opt is alias_target with alias_arg, set arg to it. * c.opt (Wmissing-format-attribute, Wnormalized): Add Warning option. * c-c++-common/pr68833-1.c: New test. * c-c++-common/pr68833-2.c: New test. From-SVN: r231624
2015-12-08re PR c/48088 (-Werror=frame-larger-than=100 does not work as expected)Jakub Jelinek
PR c/48088 PR c/68657 * common.opt (Wframe-larger-than=): Add Warning. * opts.h (control_warning_option): Add ARG argument. * opts-common.c (cmdline_handle_error): New function. (read_cmdline_option): Use it. (control_warning_option): Likewise. Add ARG argument. If non-NULL, decode it if needed and pass through to handle_generated_option. Handle CLVC_ENUM like CLVC_BOOLEAN. * opts.c (common_handle_option): Adjust control_warning_option caller. (enable_warning_as_error): Likewise. c-family/ * c.opt (Wfloat-conversion, Wsign-conversion): Add Warning. * c-pragma.c (handle_pragma_diagnostic): Adjust control_warning_option caller. ada/ * gcc-interface/trans.c (Pragma_to_gnu): Adjust control_warning_option caller. testsuite/ * c-c++-common/pr68657-1.c: New test. * c-c++-common/pr68657-2.c: New test. * c-c++-common/pr68657-3.c: New test. * gcc.dg/cpp/warn-normalized-3.c: Use -Werror=normalized=nfc instead of -Werror=normalized= in dg-options. From-SVN: r231406
2015-12-02[PATCH] Fix PR68029Jiri Engelthaler
PR driver/68029 * opts-common.c (prune_options): Don't ignore -fdiagnostics-color if it is the first parameter. From-SVN: r231150
2015-09-24fdiagnostics-color=never does not disable color for some diagnosticsManuel López-Ibáñez
Actually, I was trying to reject non-warning options as argument to -Werror=. However, the new test fails because -fdiagnostics-color=never is always placed by the driver after the warning options when calling the compiler proper. This patch prunes all -fdiagnostics-color from the command-line but the last one, which is moved to the first position. gcc/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * opts-common.c (prune_options): Discard all -fdiagnostics-color but the last one, which is moved to the front to be processed first. * opts.c (enable_warning_as_error): Reject options that do not control warnings. gcc/testsuite/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * gcc.dg/Werror-13.c: New test. From-SVN: r228094
2015-07-28Honour DriverOnly for enum values in error messagesDominik Vogt
/gcc/ChangeLog * opts-common.c (read_cmdline_option): List DriverOnly enum values as valid only in the error message of the driver, not in the messages of the language compilers. From-SVN: r226297
2015-07-09flags.h: Don't include flag-types.h or options.h.Andrew MacLeod
2015-07-09 Andrew MacLeod <amacleod@redhat.com> * flags.h: Don't include flag-types.h or options.h. * opts-common.c: Adjust includes. * opts-global.c: Likewise. * common/config/epiphany/epiphany-common.c: Likewise. c * c-array-notation.c: Adjust includes for flags.h changes. * c-objc-common.c: Likewise. c-family * c-common.h: Adjust includes for flags.h changes. * stub-objc.c: Likewise. fortran * arith.c: Adjust includes for flags.h changes. * array.c: Likewise. * check.c: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * frontend-passes.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * io.c: Likewise. * match.c: Likewise. * openmp.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. jit * dummy-frontend.c: Adjust includes for flags.h changes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto * lto-lang.c: Adjust includes for flags.h changes. From-SVN: r225608
2015-01-05Update copyright years.Jakub Jelinek
From-SVN: r219188
2014-08-20re PR c/59304 (#pragma diagnostic pop after warning fails for options ↵Manuel López-Ibáñez
unspecified in the command-line and disabled by default) gcc/ChangeLog: 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/59304 * opts-common.c (set_option): Call diagnostic_classify_diagnostic before setting the option. * diagnostic.c (diagnostic_classify_diagnostic): Record command-line status. gcc/testsuite/ChangeLog: 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/59304 * gcc.dg/pr59304.c: New test. From-SVN: r214221
2014-01-02Update copyright years in gcc/Richard Sandiford
From-SVN: r206289
2013-12-16opts-common.c (integral_argument): Add support for hexadecimal command ↵Chung-Lin Tang
option integer arguments. 2013-12-16 Chung-Lin Tang <cltang@codesourcery.com> * opts-common.c (integral_argument): Add support for hexadecimal command option integer arguments. Update comments. From-SVN: r206008
2013-03-05re PR bootstrap/56509 (gnattools build failure)Jakub Jelinek
PR bootstrap/56509 * opts.c (opts_obstack, opts_concat): Moved to... * opts-common.c (opts_obstack, opts_concat): ... here. From-SVN: r196449
2013-02-27opts.h: Include obstack.h.Jakub Jelinek
* opts.h: Include obstack.h. (opts_concat): New prototype. (opts_obstack): New declaration. * opts.c (opts_concat): New function. (opts_obstack): New variable. (init_options_struct): Call gcc_init_obstack on opts_obstack. (finish_options): Use opts_concat instead of concat and XOBNEWVEC instead of XNEWVEC. * opts-common.c (generate_canonical_option, decode_cmdline_option, generate_option): Likewise. * Makefile.in (OPTS_H): Depend on $(OBSTACK_H). * lto-wrapper.c (main): Call gcc_init_obstack on opts_obstack. From-SVN: r196305
2013-01-10Update copyright years in gcc/Richard Sandiford
From-SVN: r195098
2013-01-04Update Copyright years for files modified in 2011 and/or 2012.Jakub Jelinek
From-SVN: r194903
2012-11-17This patch rewrites the old VEC macro-based interface into a new one based ↵Diego Novillo
on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-09-10Remove unnecessary VEC function overloads.Diego Novillo
Several VEC member functions that accept an element 'T' used to have two overloads: one taking 'T', the second taking 'T *'. This used to be needed because of the interface dichotomy between vectors of objects and vectors of pointers. In the past, vectors of pointers would use pass-by-value semantics, but vectors of objects would use pass-by-reference semantics. This is no longer necessary, but the distinction had remained. The main side-effect of this change is some code reduction in code that manipulates vectors of objects. For instance, - struct iterator_use *iuse; - - iuse = VEC_safe_push (iterator_use, heap, iterator_uses, NULL); - iuse->iterator = iterator; - iuse->ptr = ptr; + struct iterator_use iuse = {iterator, ptr}; + VEC_safe_push (iterator_use, heap, iterator_uses, iuse); Compile time performance was not affected. Tested on x86_64 and ppc64. Also built all-gcc on all targets using VEC routines: arm, bfin, c6x, epiphany, ia64, mips, sh, spu, and vms. 2012-09-10 Diego Novillo <dnovillo@google.com> * vec.h (vec_t::quick_push): Remove overload that accepts 'T *'. Update all users. (vec_t::safe_push): Likewise. (vec_t::quick_insert): Likewise. (vec_t::lower_bound): Likewise. (vec_t::safe_insert): Likewise. (vec_t::replace): Change second argument to 'T &'. From-SVN: r191165
2011-11-11opts-common.c (generate_canonical_option): Free opt_text it it has been ↵Jakub Jelinek
allocated here and not stored anywhere. * opts-common.c (generate_canonical_option): Free opt_text it it has been allocated here and not stored anywhere. From-SVN: r181282
2011-11-03re PR lto/44965 (lto option code breaks file format with each added option)Richard Guenther
2011-11-03 Richard Guenther <rguenther@suse.de> PR lto/44965 * lto-opts.c: Re-implement. * lto-streamer.h (lto_register_user_option): Remove. (lto_read_file_options): Likewise. (lto_reissue_options): Likewise. (lto_clear_user_options): Likewise. (lto_clear_file_options): Likewise. * opts-global.c (post_handling_callback): Remove. (set_default_handlers): Do not set post_handling_callback. (decode_options): Remove LTO specific code. * lto-wrapper.c (merge_and_complain): New function. (run_gcc): Read all input file options and prepend a merged set before the linker driver options. * gcc.c (driver_post_handling_callback): Remove. (set_option_handlers): Do not set post_handling_callback. * opts-common.c (handle_option): Do not call post_handling_callback. * opts.h (struct cl_option_handlers): Remove post_handling_callback. lto/ * lto-lang.c (lto_post_options): Do not read file options. * lto.c (lto_read_all_file_options): Remove. (lto_init): Call lto_set_in_hooks here. From-SVN: r180827
2011-08-18Allow HOST_WIDE_INT for option variable.H.J. Lu
2011-08-18 H.J. Lu <hongjiu.lu@intel.com> Igor Zamyatin <igor.zamyatin@intel.com> * hwint.h (HOST_WIDE_INT_1): New. * opt-functions.awk (switch_bit_fields): Initialize the host_wide_int field. (host_wide_int_var_name): New. (var_type_struct): Check and return HOST_WIDE_INT. * opt-read.awk: Handle HOST_WIDE_INT for "Variable". * optc-save-gen.awk: Support HOST_WIDE_INT on var_target_other. * opth-gen.awk: Use HOST_WIDE_INT_1 on HOST_WIDE_INT. Properly check masks for HOST_WIDE_INT. * opts-common.c (set_option): Support HOST_WIDE_INT flag_var. (option_enabled): Likewise. (get_option_state): Likewise. * opts.h (cl_option): Add cl_host_wide_int. Change var_value to HOST_WIDE_INT. Co-Authored-By: Igor Zamyatin <igor.zamyatin@intel.com> From-SVN: r177864
2011-05-16opts-common.c (opt_enum_arg_to_value): New.Joseph Myers
* opts-common.c (opt_enum_arg_to_value): New. * opts.h (opt_enum_arg_to_value): Declare. * config/i386/i386.opt (fpmath): Remove. (mfpmath=): Use Enum, Init and Save. (fpmath_unit): New Enum and EnumValue entries. * config/i386/i386-c.c (ix86_pragma_target_parse): Update field name for function fpmath state. * config/i386/i386-opts.h (enum fpmath_unit): Move from i386.h. * config/i386/i386.c: Include diagnostic.h. (ix86_fpmath, IX86_FUNCTION_SPECIFIC_FPMATH): Remove. (ix86_target_string): Take enum fpmath_unit value instead of string. (ix86_debug_options): Update call to ix86_target_string. (ix86_option_override_internal): Don't process fpmath strings here. (x86_function_specific_save, ix86_function_specific_restore): Don't handle fpmath state specially. (ix86_function_specific_print): Pass fpmath state to ix86_target_string instead of printing in this function. (ix86_valid_target_attribute_inner_p): Take gcc_options pointer. Handle enum attributes. (IX86_ATTR_ENUM, ix86_opt_enum): New. (ix86_valid_target_attribute_tree): Update option_strings handling. Handle fpmath as enum option. (ix86_can_inline_p): Update field names for function fpmath state. (ix86_expand_builtin): Update call to ix86_target_string. * config/i386/i386.h (enum fpmath_unit): Move to i386-opts.h. (ix86_fpmath): Remove. * config/i386/t-i386 (i386.o): Update dependencies. From-SVN: r173809
2011-04-12opts-common.c (decode_cmdline_options_to_array): Remove variable argv_copied.Axel Freyn
2011-04-12 Axel Freyn <axel-freyn@gmx.de> * opts-common.c (decode_cmdline_options_to_array): Remove variable argv_copied. From-SVN: r172325
2011-04-04options.texi (ToLower): Document.Joseph Myers
* doc/options.texi (ToLower): Document. * opt-functions.awk (switch_bit_fields): Initialize cl_tolower field. * opts-common.c (decode_cmdline_option): Handle cl_tolower. * opts.h (cl_option): Add cl_tolower field. * config/rx/rx.c (rx_handle_option): Use strcmp of -mcpu= arguments with lowercase strings. * config/rx/rx.opt (mcpu=): Add ToLower. * config/rx/t-rx (MULTILIB_MATCHES): Don't handle uppercase -mcpu= argument. From-SVN: r171932
2011-03-31opts.h (cl_option): Add comments to fields.Joseph Myers
* opts.h (cl_option): Add comments to fields. Add bit-fields for various flags. (CL_SEPARATE_NARGS_SHIFT, CL_SEPARATE_NARGS_MASK, CL_SEPARATE_ALIAS, CL_NO_DRIVER_ARG, CL_REJECT_DRIVER, CL_SAVE, CL_DISABLED, CL_REPOR, CL_REJECT_NEGATIVE, CL_MISSING_OK, CL_UINTEGER, CL_NEGATIVE_ALIAS): Remove. (CL_JOINED, CL_SEPARATE, CL_UNDOCUMENTED): Update bit positions. * opt-functions.awk (flag_init, switch_bit_fields): New. (switch_flags): Don't handle flags moved to bit-fields. Don't generate CL_MISSING_OK or CL_SAVE. * optc-gen.awk: Update to generate bit-field output as well as flags field. * gcc.c (driver_wrong_lang_callback): Use cl_reject_driver bit-field instead of CL_REJECT_DRIVER flag. * opts-common.c (generate_canonical_option, decode_cmdline_option): Use bit-fields instead of CL_* flags. * opts.c (maybe_default_option): Use cl_reject_negative bit-field instead of CL_REJECT_NEGATIVE flag. * toplev.c (print_switch_values): Use cl_report bit-field instead of CL_REPORT flag. From-SVN: r171804