aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.h
AgeCommit message (Collapse)AuthorFilesLines
2024-01-10gcc-urlifier: handle option prefixes such as '-fno-'David Malcolm1-0/+3
Given e.g. this missppelled option (omitting the trailing 's'): $ LANG=C ./xgcc -B. -fno-inline-small-function xgcc: error: unrecognized command-line option '-fno-inline-small-function'; did you mean '-fno-inline-small-functions'? we weren't providing a documentation URL for the suggestion. The issue is the URLification code uses find_opt, which doesn't consider the various '-fno-' prefixes. This patch adds a way to find the pertinent prefix remapping and uses it when determining URLs. With this patch, the suggestion '-fno-inline-small-functions' now gets a documentation link (to that of '-finline-small-functions'). gcc/ChangeLog: * gcc-urlifier.cc (gcc_urlifier::get_url_suffix_for_option): Handle prefix mappings before calling find_opt. (selftest::gcc_urlifier_cc_tests): Add example of urlifying a "-fno-"-prefixed command-line option. * opts-common.cc (get_option_prefix_remapping): New. * opts.h (get_option_prefix_remapping): New decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-01-04options: wire up options-urls.cc into gcc_urlifierDavid Malcolm1-0/+4
Changed in v2: - split out from the code that generates options-urls.cc - call the generated function, rather than use a generated array - pass around lang_mask gcc/ChangeLog: * diagnostic.h (diagnostic_make_option_url_cb): Add lang_mask param. (diagnostic_context::make_option_url): Update for lang_mask param. * gcc-urlifier.cc: Include "opts.h" and "options.h". (gcc_urlifier::gcc_urlifier): Add lang_mask param. (gcc_urlifier::m_lang_mask): New field. (doc_urls): Make static. (gcc_urlifier::get_url_for_quoted_text): Use label_text. (gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text. Look for an option by name before trying a binary search in doc_urls. (gcc_urlifier::get_url_suffix_for_quoted_text): Use label_text. (gcc_urlifier::get_url_suffix_for_option): New. (make_gcc_urlifier): Add lang_mask param. (selftest::gcc_urlifier_cc_tests): Update for above changes. Verify that a URL is found for "-fpack-struct". * gcc-urlifier.def: Drop options "--version" and "-fpack-struct". * gcc-urlifier.h (make_gcc_urlifier): Add lang_mask param. * gcc.cc (driver::global_initializations): Pass 0 for lang_mask to make_gcc_urlifier. * opts-diagnostic.h (get_option_url): Add lang_mask param. * opts.cc (get_option_html_page): Remove special-casing for analyzer and LTO. (get_option_url_suffix): New. (get_option_url): Reimplement. (selftest::test_get_option_html_page): Rename to... (selftest::test_get_option_url_suffix): ...this and update for above changes. (selftest::opts_cc_tests): Update for renaming. * opts.h: Include "rich-location.h". (get_option_url_suffix): New decl. gcc/testsuite/ChangeLog: * lib/gcc-dg.exp: Set TERM to xterm. gcc/ChangeLog: * toplev.cc (general_init): Pass lang_mask to urlifier. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-01-04opts: add logic to generate options-urls.ccDavid Malcolm1-0/+4
Changed in v2: - split out from the code that uses this - now handles lang-specific URLs, as well as generic URLs - the generated options-urls.cc now contains a function with a switch statement, rather than an array, to support lang-specific URLs: const char * get_opt_url_suffix (int option_index, unsigned lang_mask) { switch (option_index) { [...snip...] case OPT_B: if (lang_mask & CL_D) return "gdc/Directory-Options.html#index-B"; return "gcc/Directory-Options.html#index-B"; [...snip...] return nullptr; } gcc/ChangeLog: * Makefile.in (ALL_OPT_URL_FILES): New. (GCC_OBJS): Add options-urls.o. (OBJS): Likewise. (OBJS-libcommon): Likewise. (s-options): Depend on $(ALL_OPT_URL_FILES), and add this to inputs to opt-gather.awk. (options-urls.cc): New Makefile target. * opt-functions.awk (url_suffix): New function. (lang_url_suffix): New function. * options-urls-cc-gen.awk: New file. * opts.h (get_opt_url_suffix): New decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2023-11-23gcc: Introduce -fhardenedMarek Polacek1-0/+1
In <https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628748.html> I proposed -fhardened, a new umbrella option that enables a reasonable set of hardening flags. The read of the room seems to be that the option would be useful. So here's a patch implementing that option. Currently, -fhardened enables: -D_FORTIFY_SOURCE=3 (or =2 for older glibcs) -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full (x86 GNU/Linux only) -fhardened will not override options that were specified on the command line (before or after -fhardened). For example, -D_FORTIFY_SOURCE=1 -fhardened means that _FORTIFY_SOURCE=1 will be used. Similarly, -fhardened -fstack-protector will not enable -fstack-protector-strong. Currently, -fhardened is only supported on GNU/Linux. In DW_AT_producer it is reflected only as -fhardened; it doesn't expand to anything. This patch provides -Whardened, enabled by default, which warns when -fhardened couldn't enable a particular option. I think most often it will say that _FORTIFY_SOURCE wasn't enabled because optimization were not enabled. gcc/c-family/ChangeLog: * c-opts.cc: Include "target.h". (c_finish_options): Maybe cpp_define _FORTIFY_SOURCE and _GLIBCXX_ASSERTIONS. gcc/ChangeLog: * common.opt (Whardened, fhardened): New options. * config.in: Regenerate. * config/bpf/bpf.cc: Include "opts.h". (bpf_option_override): If flag_stack_protector_set_by_fhardened_p, do not inform that -fstack-protector does not work. * config/i386/i386-options.cc (ix86_option_override_internal): When -fhardened, maybe enable -fcf-protection=full. * config/linux-protos.h (linux_fortify_source_default_level): Declare. * config/linux.cc (linux_fortify_source_default_level): New. * config/linux.h (TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL): Redefine. * configure: Regenerate. * configure.ac: Check if the linker supports '-z now' and '-z relro'. Check if -fhardened is supported on $target_os. * doc/invoke.texi: Document -fhardened and -Whardened. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL): Add. * gcc.cc (driver_handle_option): Remember if any link options or -static were specified on the command line. (process_command): When -fhardened, maybe enable -pie and -Wl,-z,relro,-z,now. * opts.cc (flag_stack_protector_set_by_fhardened_p): New global. (finish_options): When -fhardened, enable -ftrivial-auto-var-init=zero and -fstack-protector-strong. (print_help_hardened): New. (print_help): Call it. * opts.h (flag_stack_protector_set_by_fhardened_p): Declare. * target.def (fortify_source_default_level): New target hook. * targhooks.cc (default_fortify_source_default_level): New. * targhooks.h (default_fortify_source_default_level): Declare. * toplev.cc (process_options): When -fhardened, enable -fstack-clash-protection. If flag_stack_protector_set_by_fhardened_p, do not warn that -fstack-protector not supported for this target. Don't enable -fhardened when !HAVE_FHARDENED_SUPPORT. gcc/testsuite/ChangeLog: * gcc.misc-tests/help.exp: Test -fhardened. * c-c++-common/fhardened-1.S: New test. * c-c++-common/fhardened-1.c: New test. * c-c++-common/fhardened-10.c: New test. * c-c++-common/fhardened-11.c: New test. * c-c++-common/fhardened-12.c: New test. * c-c++-common/fhardened-13.c: New test. * c-c++-common/fhardened-14.c: New test. * c-c++-common/fhardened-15.c: New test. * c-c++-common/fhardened-2.c: New test. * c-c++-common/fhardened-3.c: New test. * c-c++-common/fhardened-4.c: New test. * c-c++-common/fhardened-5.c: New test. * c-c++-common/fhardened-6.c: New test. * c-c++-common/fhardened-7.c: New test. * c-c++-common/fhardened-8.c: New test. * c-c++-common/fhardened-9.c: New test. * gcc.target/i386/cf_check-6.c: New test.
2023-05-19Allow plugin dumpsNathan Sidwell1-0/+1
Defer dump option parsing until plugins are initialized. This allows one to use plugin names for dumps. PR other/99451 gcc/ * opts.h (handle_deferred_dump_options): Declare. * opts-global.cc (handle_common_deferred_options): Do not handle dump options here. (handle_deferred_dump_options): New. * toplev.cc (toplev::main): Call it after plugin init.
2023-01-02Update copyright years.Jakub Jelinek1-1/+1
2022-09-02Add TARGET_COMPUTE_MULTILIB hook to override multi-lib result.Kito Cheng1-0/+36
Create a new hook to let target could override the multi-lib result, the motivation is RISC-V might have very complicated multi-lib re-use rule*, which is hard to maintain and use current multi-lib scripts, we even hit the "argument list too long" error when we tried to add more multi-lib reuse rule. So I think it would be great to have a target specific way to determine the multi-lib re-use rule, then we could write those rule in C, instead of expand every possible case in MULTILIB_REUSE. * Here is an example for RISC-V multi-lib rules: https://gist.github.com/kito-cheng/0289cd42d9a756382e5afeb77b42b73b gcc/ChangeLog: * common/common-target.def (compute_multilib): New. * common/common-targhooks.h (default_compute_multilib): New. * common/common-targhooks.cc (default_compute_multilib): New. * doc/tm.texi.in (TARGET_COMPUTE_MULTILIB): New. * doc/tm.texi: Regen. * gcc.cc: Include common/common-target.h. (set_multilib_dir) Call targetm_common.compute_multilib. (SWITCH_LIVE): Move to opts.h. (SWITCH_FALSE): Ditto. (SWITCH_IGNORE): Ditto. (SWITCH_IGNORE_PERMANENTLY): Ditto. (SWITCH_KEEP_FOR_GCC): Ditto. (struct switchstr): Ditto. * opts.h (SWITCH_LIVE): Move from gcc.c. (SWITCH_FALSE): Ditto. (SWITCH_IGNORE): Ditto. (SWITCH_IGNORE_PERMANENTLY): Ditto. (SWITCH_KEEP_FOR_GCC): Ditto. (struct switchstr): Ditto.
2022-06-18ubsan: Add -fsanitize-trap= supportJakub Jelinek1-0/+1
On Thu, Jun 16, 2022 at 09:32:02PM +0100, Jonathan Wakely wrote: > It looks like clang has addressed this deficiency now: > > https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#usage Thanks, that is roughly what I'd implement anyway and apparently they have it already since 2015, we've added the -fsanitize-undefined-trap-on-error support back in 2014 and didn't change it since then. As a small divergence from clang, I chose -fsanitize-undefined-trap-on-error to be a (deprecated) alias for -fsanitize-trap aka -fsanitize-trap=all rather thn -fsanitize-trap=undefined which seems to be what clang does, because for a deprecated option it is IMHO more important backwards compatibility with what gcc did over the past 8 years rather than clang compatibility. Some sanitizers (e.g. asan, lsan, tsan) don't support traps, -fsanitize-trap=address etc. will be rejected (if enabled at the end of command line), -fno-sanitize-trap= can be specified even for them. This is similar behavior to -fsanitize-recover=. One complication is vptr sanitization, which can't easily trap, as the whole slow path of the checking is inside of libubsan. Previously, -fsanitize=vptr -fsanitize-undefined-trap-on-error silently ignored vptr sanitization. This patch similarly to what clang does will accept -fsanitize-trap=all or -fsanitize-trap=undefined which enable the vptr bit as trapping and again that causes silent disabling of vptr sanitization, while -fsanitize-trap=vptr is rejected (already during option processing). 2022-06-18 Jakub Jelinek <jakub@redhat.com> gcc/ * common.opt (flag_sanitize_trap): New variable. (fsanitize-trap=, fsanitize-trap): New options. (fsanitize-undefined-trap-on-error): Change into deprecated alias for -fsanitize-trap=all. * opts.h (struct sanitizer_opts_s): Add can_trap member. * opts.cc (finish_options): Complain about unsupported -fsanitize-trap= options. (sanitizer_opts): Add can_trap values to all entries. (get_closest_sanitizer_option): Ignore -fsanitize-trap= options which have can_trap false. (parse_sanitizer_options): Add support for -fsanitize-trap=. For -fsanitize-trap=all, enable SANITIZE_UNDEFINED | SANITIZE_UNDEFINED_NONDEFAULT. Disallow -fsanitize-trap=vptr here. (common_handle_option): Handle OPT_fsanitize_trap_ and OPT_fsanitize_trap. * sanopt.cc (maybe_optimize_ubsan_null_ifn): Check flag_sanitize_trap & SANITIZE_{NULL,ALIGNMENT} instead of flag_sanitize_undefined_trap_on_error. * gcc.cc (sanitize_spec_function): Use flag_sanitize & ~flag_sanitize_trap instead of flag_sanitize and drop use of flag_sanitize_undefined_trap_on_error in "undefined" handling. * ubsan.cc (ubsan_instrument_unreachable): Use flag_sanitize_trap & SANITIZE_??? instead of flag_sanitize_undefined_trap_on_error. (ubsan_expand_bounds_ifn, ubsan_expand_null_ifn, ubsan_expand_objsize_ifn, ubsan_expand_ptr_ifn, ubsan_build_overflow_builtin, instrument_bool_enum_load, ubsan_instrument_float_cast, instrument_nonnull_arg, instrument_nonnull_return, instrument_builtin): Likewise. * doc/invoke.texi (-fsanitize-trap=, -fsanitize-trap): Document. (-fsanitize-undefined-trap-on-error): Document as deprecated alias of -fsanitize-trap. gcc/c-family/ * c-ubsan.cc (ubsan_instrument_division, ubsan_instrument_shift): Use flag_sanitize_trap & SANITIZE_??? instead of flag_sanitize_undefined_trap_on_error. If 2 sanitizers are involved and flag_sanitize_trap differs for them, emit __builtin_trap only for the comparison where trap is requested. (ubsan_instrument_vla, ubsan_instrument_return): Use lag_sanitize_trap & SANITIZE_??? instead of flag_sanitize_undefined_trap_on_error. gcc/cp/ * cp-ubsan.cc (cp_ubsan_instrument_vptr_p): Use flag_sanitize_trap & SANITIZE_VPTR instead of flag_sanitize_undefined_trap_on_error. gcc/testsuite/ * c-c++-common/ubsan/nonnull-4.c: Use -fsanitize-trap=all instead of -fsanitize-undefined-trap-on-error. * c-c++-common/ubsan/div-by-zero-4.c: Use -fsanitize-trap=signed-integer-overflow instead of -fsanitize-undefined-trap-on-error. * c-c++-common/ubsan/overflow-add-4.c: Use -fsanitize-trap=undefined instead of -fsanitize-undefined-trap-on-error. * c-c++-common/ubsan/pr56956.c: Likewise. * c-c++-common/ubsan/pr68142.c: Likewise. * c-c++-common/ubsan/pr80932.c: Use -fno-sanitize-trap=all -fsanitize-trap=shift,undefined instead of -fsanitize-undefined-trap-on-error. * c-c++-common/ubsan/align-8.c: Use -fsanitize-trap=alignment instead of -fsanitize-undefined-trap-on-error.
2022-01-24options: Add EnumBitSet property support [PR104158]Jakub Jelinek1-0/+12
On Sat, Jan 22, 2022 at 01:47:08AM +0100, Jakub Jelinek via Gcc-patches wrote: > I think with the 2) patch I achieve what we want for Fortran, for 1) > the only behavior from gcc 11 is that > -fsanitize-coverage=trace-cmp,trace-cmp is now rejected. > This is mainly from the desire to disallow > -fconvert=big-endian,little-endian or -Wbidi-chars=bidirectional,any > etc. where it would be confusing to users what exactly it means. > But it is the only from these options that actually acts as an Enum > bit set, each enumerator can be specified with all the others. > So one option would be stop requiring the EnumSet implies Set properties > must be specified and just require that either they are specified on all > EnumValues, or on none of them; the latter case would be for > -fsanitize-coverage= and the non-Set case would mean that all the > EnumValues need to have disjoint Value bitmasks and that they can > be all specified and unlike the Set case also repeated. > Thoughts on this? Here is an incremental patch to the first two patches of the series that implements EnumBitSet that fully restores the -fsanitize-coverage GCC 11 behavior. 2022-01-24 Jakub Jelinek <jakub@redhat.com> PR sanitizer/104158 * opt-functions.awk (var_set): Handle EnumBitSet property. * optc-gen.awk: Don't disallow RejectNegative if EnumBitSet is specified. * opts.h (enum cl_enum_var_value): New type. * opts-common.cc (decode_cmdline_option): Use CLEV_* values. Handle CLEV_BITSET. (cmdline_handle_error): Handle CLEV_BITSET. * opts.cc (test_enum_sets): Also test EnumBitSet requirements. * doc/options.texi (EnumBitSet): Document. * common.opt (fsanitize-coverage=): Use EnumBitSet instead of EnumSet. (trace-pc, trace-cmp): Drop Set properties. * gcc.dg/sancov/pr104158-7.c: Adjust for repeating of arguments being allowed.
2022-01-24options: Add EnumSet and Set property support [PR104158]Jakub Jelinek1-2/+10
The following patch is infrastructure support for at least 3 different options that need changes: 1) PR104158 talks about a regression with the -fsanitizer-coverage= option; in GCC 11 and older and on trunk prior to r12-1177, this option behaved similarly to -f{,no-}sanitizer{,-recover}= options, namely that the option allows negative and argument of the option is a list of strings, each of them has some enumerator and -fsanitize-coverage= enabled those bits in the underlying flag_sanitize_coverage, while -fno-sanitize-coverage= disabled them. So, -fsanitize-coverage=trace-pc,trace-cmp was equivalent to -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp and both set flag_sanitize_coverage to (SANITIZE_COV_TRACE_PC | SANITIZE_COV_TRACE_CMP) Also, e.g. -fsanitize-coverage=trace-pc,trace-cmp -fno-sanitize-coverage=trace-pc would in the end set flag_sanitize_coverage to SANITIZE_COV_TRACE_CMP (first set both bits, then subtract one) The r12-1177 change, I think done to improve argument misspelling diagnostic, changed the option incompatibly in multiple ways, -fno-sanitize-coverage= is now rejected, only a single argument is allowed, not multiple and -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp enables just SANITIZE_COV_TRACE_CMP and not both (each option overrides the previous value) 2) Thomas Koenig wants to extend Fortran -fconvert= option for the ppc64le real(kind=16) swapping support; currently the option accepts -fconvert={native,swap,big-endian,little-endian} and the intent is to add support for -fconvert=r16_ibm and -fconvert=r16_ieee (that alone is just normal Enum), but also to handle -fconvert=swap,r16_ieee or -fconvert=r16_ieee,big-endian but not -fconvert=big-endian,little-endian - the native/swap/big-endian/little-endian are one mutually exclusive set and r16_ieee/r16_ibm another one. See https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587943.html and thread around that. 3) Similarly Marek Polacek wants to extend the -Wbidi-chars= option, such that it will handle not just the current -Wbidi-chars={none,bidirectional,any}, but also -Wbidi-chars=ucn and bidirectional,ucn and ucn,any etc. Again two separate sets, one none/bidirectional/any and another one ucn. See https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588960.html The following patch adds framework for this and I'll post incremental patches for 1) and 2). As I've tried to document, such options are marked by additional EnumSet property on the option and in that case all the EnumValues in the Enum referenced from it must use a new Set property with set number (initially I wanted just mark last enumerator in each mutually exclusive set, but optionlist is sorted and so it doesn't really work well). So e.g. for the Fortran -fconvert=, one specifies: fconvert= Fortran RejectNegative Joined Enum(gfc_convert) EnumSet Var(flag_convert) Init(GFC_FLAG_CONVERT_NATIVE) -fconvert=<big-endian|little-endian|native|swap|r16_ieee|r16_ibm> The endianness used for unformatted files. Enum Name(gfc_convert) Type(enum gfc_convert) UnknownError(Unrecognized option to endianness value: %qs) EnumValue Enum(gfc_convert) String(big-endian) Value(GFC_FLAG_CONVERT_BIG) Set(1) EnumValue Enum(gfc_convert) String(little-endian) Value(GFC_FLAG_CONVERT_LITTLE) Set(1) EnumValue Enum(gfc_convert) String(native) Value(GFC_FLAG_CONVERT_NATIVE) Set(1) EnumValue Enum(gfc_convert) String(swap) Value(GFC_FLAG_CONVERT_SWAP) Set(1) EnumValue Enum(gfc_convert) String(r16_ieee) Value(GFC_FLAG_CONVERT_R16_IEEE) Set(2) EnumValue Enum(gfc_convert) String(r16_ibm) Value(GFC_FLAG_CONVERT_R16_IBM) Set(2) and this says to the option handling code that 1) if only one arg is specified to one instance of the option, it can be any of those 6 2) if two args are specified, one has to be from the first 4 and another from the last 2, in any order 3) at most 2 args may be specified (there are just 2 sets) There is a requirement on the Value values checked in self-test, the values from one set ored together must be disjunct from values from another set ored together. In the Fortran case, the first 4 are 0-3 so mask is 3, and the last 2 are 4 and 8, so mask is 12. When say -fconvert=big-endian is specified, it sets the first set to GFC_FLAG_CONVERT_BIG (2) but doesn't modify whatever value the other set had, so e.g. -fconvert=big-endian -fconvert=r16_ieee -fconvert=r16_ieee -fconvert=big-endian -fconvert=r16_ieee,big_endian -fconvert=big_endian,r16_ieee all behave the same. Also, with the EnumSet support, it is now possible to allow not specifying RejectNegative - we can set some set's value and then clear it and set it again to some other value etc. I think with the 2) patch I achieve what we want for Fortran, for 1) the only behavior from gcc 11 is that -fsanitize-coverage=trace-cmp,trace-cmp is now rejected. This is mainly from the desire to disallow -fconvert=big-endian,little-endian or -Wbidi-chars=bidirectional,any etc. where it would be confusing to users what exactly it means. But it is the only from these options that actually acts as an Enum bit set, each enumerator can be specified with all the others. So one option would be stop requiring the EnumSet implies Set properties must be specified and just require that either they are specified on all EnumValues, or on none of them; the latter case would be for -fsanitize-coverage= and the non-Set case would mean that all the EnumValues need to have disjoint Value bitmasks and that they can be all specified and unlike the Set case also repeated. Thoughts on this? 2022-01-24 Jakub Jelinek <jakub@redhat.com> PR sanitizer/104158 * opt-functions.awk (var_set): Handle EnumSet property. * optc-gen.awk: Don't disallow RejectNegative if EnumSet is specified. * opt-read.awk: Handle Set property. * opts.h (CL_ENUM_SET_SHIFT, CL_ERR_ENUM_SET_ARG): Define. (struct cl_decoded_option): Mention enum in value description. Add mask member. (set_option): Add mask argument defaulted to 0. * opts.cc (test_enum_sets): New function. (opts_cc_tests): Call it. * opts-common.cc (enum_arg_to_value): Change return argument from bool to int, on success return index into the cl_enum_arg array, on failure -1. Add len argument, if non-0, use strncmp instead of strcmp. (opt_enum_arg_to_value): Adjust caller. (decode_cmdline_option): Handle EnumSet represented as CLVC_ENUM with non-zero var_value. Initialize decoded->mask. (decode_cmdline_options_to_array): CLear opt_array[0].mask. (handle_option): Pass decoded->mask to set_options last argument. (generate_option): Clear decoded->mask. (generate_option_input_file): Likewise. (cmdline_handle_error): Handle CL_ERR_ENUM_SET_ARG. (set_option): Add mask argument, use it for CLVC_ENUM. (control_warning_option): Adjust enum_arg_to_value caller. * doc/options.texi: Document Set and EnumSet properties.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-12-28driver: Improve option diagnostics [PR103465]Martin Liska1-0/+2
It happens that options are parsed and various diagnostics happen in finish_options. That's a proper place as the function is also called for optimize/target attributes (pragmas). However, it is possible that target overwrites an option from command line and so the diagnostics does not happen. That's fixed in the patch. - options are parsed and finish_options is called: if (opts->x_flag_unwind_tables && !targetm_common.unwind_tables_default && opts->x_flag_reorder_blocks_and_partition && (ui_except == UI_SJLJ || ui_except >= UI_TARGET)) { if (opts_set->x_flag_reorder_blocks_and_partition) inform (loc, "%<-freorder-blocks-and-partition%> does not support " "unwind info on this architecture"); opts->x_flag_reorder_blocks_and_partition = 0; opts->x_flag_reorder_blocks = 1; } It's not triggered because of opts->x_flag_unwind_tables is false by default, but the option is overwritten in target: ... if (TARGET_64BIT_P (opts->x_ix86_isa_flags)) { if (opts->x_optimize >= 1) SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer, !USE_IX86_FRAME_POINTER); if (opts->x_flag_asynchronous_unwind_tables && TARGET_64BIT_MS_ABI) SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1); ... PR driver/103465 gcc/ChangeLog: * opts.c (finish_options): More part of diagnostics to ... (diagnose_options): ... here. Call the function from both finish_options and process_options. * opts.h (diagnose_options): Declare. * toplev.c (process_options): Call diagnose_options.
2021-12-07Fix --help -Q outputMartin Liska1-2/+2
PR middle-end/103438 gcc/ChangeLog: * config/s390/s390.c (s390_valid_target_attribute_inner_p): Use new enum CLVC_INTEGER. * opt-functions.awk: Use new CLVC_INTEGER. * opts-common.c (set_option): Likewise. (option_enabled): Return -1,0,1 for CLVC_INTEGER. (get_option_state): Use new CLVC_INTEGER. (control_warning_option): Likewise. * opts.h (enum cl_var_type): Likewise.
2021-10-08Come up with OPTION_SET_P macro.Martin Liska1-0/+4
gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_post_options): Use new macro OPTION_SET_P. (gnat_init_gcc_eh): Likewise. (gnat_init_gcc_fp): Likewise. gcc/c-family/ChangeLog: * c-opts.c (c_common_post_options): Use new macro OPTION_SET_P. gcc/ChangeLog: * config/alpha/alpha.c (alpha_option_override): Use new macro OPTION_SET_P. * config/arc/arc.c (arc_override_options): Likewise. * config/arm/arm.c (arm_option_override): Likewise. * config/bfin/bfin.c (bfin_load_pic_reg): Likewise. * config/c6x/c6x.c (c6x_option_override): Likewise. * config/csky/csky.c: Likewise. * config/darwin.c (darwin_override_options): Likewise. * config/frv/frv.c (frv_option_override): Likewise. * config/i386/djgpp.h: Likewise. * config/i386/i386.c (ix86_stack_protect_guard): Likewise. (ix86_max_noce_ifcvt_seq_cost): Likewise. * config/ia64/ia64.c (ia64_option_override): Likewise. (ia64_override_options_after_change): Likewise. * config/m32c/m32c.c (m32c_option_override): Likewise. * config/m32r/m32r.c (m32r_init): Likewise. * config/m68k/m68k.c (m68k_option_override): Likewise. * config/microblaze/microblaze.c (microblaze_option_override): Likewise. * config/mips/mips.c (mips_option_override): Likewise. * config/nios2/nios2.c (nios2_option_override): Likewise. * config/nvptx/nvptx.c (nvptx_option_override): Likewise. * config/pa/pa.c (pa_option_override): Likewise. * config/riscv/riscv.c (riscv_option_override): Likewise. * config/rs6000/aix71.h: Likewise. * config/rs6000/aix72.h: Likewise. * config/rs6000/aix73.h: Likewise. * config/rs6000/rs6000.c (darwin_rs6000_override_options): Likewise. (rs6000_override_options_after_change): Likewise. (rs6000_linux64_override_options): Likewise. (glibc_supports_ieee_128bit): Likewise. (rs6000_option_override_internal): Likewise. (rs6000_file_start): Likewise. (rs6000_darwin_file_start): Likewise. * config/rs6000/rtems.h: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/vxworks.h (SUB3TARGET_OVERRIDE_OPTIONS): Likewise. * config/s390/s390.c (s390_option_override): Likewise. * config/sh/linux.h: Likewise. * config/sh/netbsd-elf.h (while): Likewise. * config/sh/sh.c (sh_option_override): Likewise. * config/sol2.c (solaris_override_options): Likewise. * config/sparc/sparc.c (sparc_option_override): Likewise. * config/tilegx/tilegx.c (tilegx_option_override): Likewise. * config/visium/visium.c (visium_option_override): Likewise. * config/vxworks.c (vxworks_override_options): Likewise. * lto-opts.c (lto_write_options): Likewise. * omp-expand.c (expand_omp_simd): Likewise. * omp-general.c (omp_max_vf): Likewise. * omp-offload.c (oacc_xform_loop): Likewise. * opts.h (OPTION_SET_P): Likewise. * targhooks.c (default_max_noce_ifcvt_seq_cost): Likewise. * toplev.c (process_options): Likewise. * tree-predcom.c: Likewise. * tree-sra.c (analyze_all_variable_accesses): Likewise. gcc/cp/ChangeLog: * constexpr.c (maybe_warn_about_constant_value): Use new macro OPTION_SET_P. * decl.c (redeclaration_error_message): Likewise. (cxx_init_decl_processing): Likewise. gcc/d/ChangeLog: * d-lang.cc (d_post_options): Use new macro OPTION_SET_P. gcc/fortran/ChangeLog: * options.c (gfc_post_options): Use new macro OPTION_SET_P. gcc/objc/ChangeLog: * objc-next-runtime-abi-01.c: Use new macro OPTION_SET_P. * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Likewise.
2021-02-08opts: fix handling of -fpatchable-function-entries optionMartin Liska1-0/+4
gcc/ChangeLog: PR lto/98971 * cfgexpand.c (pass_expand::execute): Parse per-function option flag_patchable_function_entry and use it. * common.opt: Remove function_entry_patch_area_size and function_entry_patch_area_start global variables. * opts.c (parse_and_check_patch_area): New function. (common_handle_option): Use it. * opts.h (parse_and_check_patch_area): New function. * toplev.c (process_options): Parse and use function_entry_patch_area_size.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-12-16Remove Report keyword for optionsMartin Liska1-2/+0
Since g:7caa49706316e650fb67719e1a1bf3a35054b685 the option is ignored as we print used command line for -fverbose-asm output. gcc/ChangeLog: * doc/options.texi: Remove Report keyword. * opt-functions.awk: Print error when Report keyword is used. * optc-gen.awk: Do not handle Report keyword. * opts.h (struct cl_option): Remove cl_report bitfield flag.
2020-12-04Refactor -frecord-gcc-switches.Martin Liska1-0/+6
gcc/ChangeLog: * doc/tm.texi: Change argument of the record_gcc_switches hook and remove SWITCH_TYPE_* enum values. * dwarf2out.c (gen_producer_string): Move to opts.c and remove handling of the dwarf_record_gcc_switches option. (dwarf2out_early_finish): Use moved gen_producer_string function. * opts.c (gen_producer_string): New. * opts.h (gen_producer_string): New. * target.def: Change type of record_gcc_switches. * target.h (enum print_switch_type): Remove. (elf_record_gcc_switches): Change first argument. * toplev.c (MAX_LINE): Remove. (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. (print_single_switch): Likewise. (print_switch_values): Likewise. (init_asm_output): Use new gen_producer_string function. (process_options): Likewise. * varasm.c (elf_record_gcc_switches): Just save the string argument to the ELF container.
2020-11-18plugins: Allow plugins to handle global_options changesJakub Jelinek1-0/+11
Any time somebody adds or removes an option in some *.opt file (which e.g. on the 10 branch after branching off 11 happened 7 times already), many offsets in global_options variable change and so plugins that ever access GCC options or other global_options values are ABI dependent on it. It is true we don't guarantee ABI stability for plugins, but we change the most often used data structures on the release branches only very rarely and so the options changes are the most problematic for ABI stability of plugins. Annobin uses a way to remap accesses to some of the global_options.x_* by looking them up in the cl_options array where we have offsetof (struct gcc_options, x_flag_lto) etc. remembered, but sadly doesn't do it for all options (e.g. some flag_* etc. option accesses may be hidden in various macros like POINTER_SIZE), and more importantly some struct gcc_options offsets are not covered at all. E.g. there is no offsetof (struct gcc_options, x_optimize), offsetof (struct gcc_options, x_flag_sanitize) etc. Those are usually: Variable int optimize in the *.opt files. The following patch allows the plugins to deal with reshuffling of even the global_options fields that aren't tracked in cl_options by adding another array that describes those, which adds an 816 bytes long array and 1039 bytes in string literals, so 1855 .rodata bytes in total ATM. And adds it only if --enable-plugin (the default), with --disable-plugin it will not be compiled in. 2020-11-18 Jakub Jelinek <jakub@redhat.com> * opts.h (struct cl_var): New type. (cl_vars): Declare. * optc-gen.awk: Generate cl_vars array.
2020-10-30Add -fzero-call-used-regs option and zero_call_used_regs function attributes.qing zhao1-0/+6
This new feature causes the compiler to zero a subset of all call-used registers at function return. This is used to increase program security by either mitigating Return-Oriented Programming (ROP) attacks or preventing information leakage through registers. gcc/ChangeLog: 2020-10-30 Qing Zhao <qing.zhao@oracle.com> H.J.Lu <hjl.tools@gmail.com> * common.opt: Add new option -fzero-call-used-regs * config/i386/i386.c (zero_call_used_regno_p): New function. (zero_call_used_regno_mode): Likewise. (zero_all_vector_registers): Likewise. (zero_all_st_registers): Likewise. (zero_all_mm_registers): Likewise. (ix86_zero_call_used_regs): Likewise. (TARGET_ZERO_CALL_USED_REGS): Define. * df-scan.c (df_epilogue_uses_p): New function. (df_get_exit_block_use_set): Replace EPILOGUE_USES with df_epilogue_uses_p. * df.h (df_epilogue_uses_p): Declare. * doc/extend.texi: Document the new zero_call_used_regs attribute. * doc/invoke.texi: Document the new -fzero-call-used-regs option. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_ZERO_CALL_USED_REGS): New hook. * emit-rtl.h (struct rtl_data): New field must_be_zero_on_return. * flag-types.h (namespace zero_regs_flags): New namespace. * function.c (gen_call_used_regs_seq): New function. (class pass_zero_call_used_regs): New class. (pass_zero_call_used_regs::execute): New function. (make_pass_zero_call_used_regs): New function. * optabs.c (expand_asm_reg_clobber_mem_blockage): New function. * optabs.h (expand_asm_reg_clobber_mem_blockage): Declare. * opts.c (zero_call_used_regs_opts): New structure array initialization. (parse_zero_call_used_regs_options): New function. (common_handle_option): Handle -fzero-call-used-regs. * opts.h (zero_call_used_regs_opts): New structure array. * passes.def: Add new pass pass_zero_call_used_regs. * recog.c (valid_insn_p): New function. * recog.h (valid_insn_p): Declare. * resource.c (init_resource_info): Replace EPILOGUE_USES with df_epilogue_uses_p. * target.def (zero_call_used_regs): New hook. * targhooks.c (default_zero_call_used_regs): New function. * targhooks.h (default_zero_call_used_regs): Declare. * tree-pass.h (make_pass_zero_call_used_regs): Declare. gcc/c-family/ChangeLog: 2020-10-30 Qing Zhao <qing.zhao@oracle.com> H.J.Lu <hjl.tools@gmail.com> * c-attribs.c (c_common_attribute_table): Add new attribute zero_call_used_regs. (handle_zero_call_used_regs_attribute): New function. gcc/testsuite/ChangeLog: 2020-10-30 Qing Zhao <qing.zhao@oracle.com> H.J.Lu <hjl.tools@gmail.com> * c-c++-common/zero-scratch-regs-1.c: New test. * c-c++-common/zero-scratch-regs-10.c: New test. * c-c++-common/zero-scratch-regs-11.c: New test. * c-c++-common/zero-scratch-regs-2.c: New test. * c-c++-common/zero-scratch-regs-3.c: New test. * c-c++-common/zero-scratch-regs-4.c: New test. * c-c++-common/zero-scratch-regs-5.c: New test. * c-c++-common/zero-scratch-regs-6.c: New test. * c-c++-common/zero-scratch-regs-7.c: New test. * c-c++-common/zero-scratch-regs-8.c: New test. * c-c++-common/zero-scratch-regs-9.c: New test. * c-c++-common/zero-scratch-regs-attr-usages.c: New test. * gcc.target/i386/zero-scratch-regs-1.c: New test. * gcc.target/i386/zero-scratch-regs-10.c: New test. * gcc.target/i386/zero-scratch-regs-11.c: New test. * gcc.target/i386/zero-scratch-regs-12.c: New test. * gcc.target/i386/zero-scratch-regs-13.c: New test. * gcc.target/i386/zero-scratch-regs-14.c: New test. * gcc.target/i386/zero-scratch-regs-15.c: New test. * gcc.target/i386/zero-scratch-regs-16.c: New test. * gcc.target/i386/zero-scratch-regs-17.c: New test. * gcc.target/i386/zero-scratch-regs-18.c: New test. * gcc.target/i386/zero-scratch-regs-19.c: New test. * gcc.target/i386/zero-scratch-regs-2.c: New test. * gcc.target/i386/zero-scratch-regs-20.c: New test. * gcc.target/i386/zero-scratch-regs-21.c: New test. * gcc.target/i386/zero-scratch-regs-22.c: New test. * gcc.target/i386/zero-scratch-regs-23.c: New test. * gcc.target/i386/zero-scratch-regs-24.c: New test. * gcc.target/i386/zero-scratch-regs-25.c: New test. * gcc.target/i386/zero-scratch-regs-26.c: New test. * gcc.target/i386/zero-scratch-regs-27.c: New test. * gcc.target/i386/zero-scratch-regs-28.c: New test. * gcc.target/i386/zero-scratch-regs-29.c: New test. * gcc.target/i386/zero-scratch-regs-30.c: New test. * gcc.target/i386/zero-scratch-regs-31.c: New test. * gcc.target/i386/zero-scratch-regs-3.c: New test. * gcc.target/i386/zero-scratch-regs-4.c: New test. * gcc.target/i386/zero-scratch-regs-5.c: New test. * gcc.target/i386/zero-scratch-regs-6.c: New test. * gcc.target/i386/zero-scratch-regs-7.c: New test. * gcc.target/i386/zero-scratch-regs-8.c: New test. * gcc.target/i386/zero-scratch-regs-9.c: New test.
2020-04-30--with-{documentation,changes}-root-url tweaksJakub Jelinek1-1/+0
> , CHANGES_URL ("gcc-10/changes.html#empty_base"); > > where the macro would just use preprocessor string concatenation? Ok, the following patch implements it (doesn't introduce a separate macro and just uses CHANGES_ROOT_URL "gcc-10/changes.html#empty_base"), in addition adds the documentation Joseph requested. 2020-04-30 Jakub Jelinek <jakub@redhat.com> * configure.ac (--with-documentation-root-url, --with-changes-root-url): Diagnose URL not ending with /, use AC_DEFINE_UNQUOTED instead of AC_SUBST. * opts.h (get_changes_url): Remove. * opts.c (get_changes_url): Remove. * Makefile.in (CFLAGS-opts.o): Don't add -DDOCUMENTATION_ROOT_URL or -DCHANGES_ROOT_URL. * doc/install.texi (--with-documentation-root-url, --with-changes-root-url): Document. * config/arm/arm.c (aapcs_vfp_is_call_or_return_candidate): Don't call get_changes_url and free, change url variable type to const char * and set it to CHANGES_ROOT_URL "gcc-10/changes.html#empty_base". * config/s390/s390.c (s390_function_arg_vector, s390_function_arg_float): Likewise. * config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate): Likewise. * config/rs6000/rs6000-call.c (rs6000_discover_homogeneous_aggregate): Likewise. * config.in: Regenerate. * configure: Regenerate.
2020-04-29diagnostics: Add %{...%} pretty-format support for URLs and use it in ↵Jakub Jelinek1-0/+1
-Wpsabi diagnostics The following patch attempts to use the diagnostics URL support if available to provide more information about the C++17 empty base and C++20 [[no_unique_address]] empty class ABI changes in -Wpsabi diagnostics. in GCC 10.1 at the end of the diagnostics is then in some terminals underlined with a dotted line and points to a (to be written) anchor in gcc-10/changes.html which we need to write anyway. 2020-04-29 Jakub Jelinek <jakub@redhat.com> * configure.ac (-with-changes-root-url): New configure option, defaulting to https://gcc.gnu.org/. * Makefile.in (CFLAGS-opts.o): Define CHANGES_ROOT_URL for opts.c. * pretty-print.c (get_end_url_string): New function. (pp_format): Handle %{ and %} for URLs. (pp_begin_url): Use pp_string instead of pp_printf. (pp_end_url): Use get_end_url_string. * opts.h (get_changes_url): Declare. * opts.c (get_changes_url): New function. * config/rs6000/rs6000-call.c: Include opts.h. (rs6000_discover_homogeneous_aggregate): Use %{in GCC 10.1%} instead of just in GCC 10.1 in diagnostics and add URL. * config/arm/arm.c (aapcs_vfp_is_call_or_return_candidate): Likewise. * config/aarch64/aarch64.c (aarch64_vfp_is_call_or_return_candidate): Likewise. * config/s390/s390.c (s390_function_arg_vector, s390_function_arg_float): Likewise. * configure: Regenerated. * c-format.c (PP_FORMAT_CHAR_TABLE): Add %{ and %}.
2020-02-24PR47785: Add support for handling Xassembler/Wa options with LTO.Prathamesh Kulkarni1-0/+5
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 Jelinek1-1/+1
From-SVN: r279813
2019-11-12Remove last leftover usage of params* files.Martin Liska1-1/+0
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 Liska1-0/+10
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-07-24PR driver/80545 - option -Wstringop-overflow not recognized by FortranMartin Sebor1-1/+2
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-05-28Support again multiple --help options (PR other/90315).Martin Liska1-2/+3
2019-05-28 Martin Liska <mliska@suse.cz> PR other/90315 * opts-global.c (decode_options): Print help for all help_option_arguments. * opts.c (print_help): Add new argument. (common_handle_option): Remember all values into help_option_arguments. * opts.h (print_help): Add new argument. From-SVN: r271700
2019-05-03opts.h (finish_options): Remove lang_mask argument.Jakub Jelinek1-2/+4
* opts.h (finish_options): Remove lang_mask argument. (print_help, help_option_argument): Declare. * opts.c (print_help): Remove forward declaration, no longer static. (finish_options): Remove lang_mask argument, don't call print_help here. * opts-global.c (decode_options): Adjust finish_option caller, call print_help here. From-SVN: r270836
2019-05-02Postpone print of --help=* option.Martin Liska1-1/+2
2019-05-02 Martin Liska <mliska@suse.cz> * gcc.c (process_command): Add dummy file only if n_infiles == 0. * opts-global.c (decode_options): Pass lang_mask. * opts.c (print_help): New function. (finish_options): Print --help if help_option_argument is set. (common_handle_option): Factor out content of OPT__help_ into print_help. * opts.h (finish_options): Add new argument. From-SVN: r270788
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-08-17Merge Ignore and Deprecated in .opt files.Martin Liska1-3/+0
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 Sebor1-8/+18
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-07-04[multiple changes]Martin Liska1-0/+7
2018-07-04 Denys Vlasenko <dvlasenk@redhat.com> Martin Liska <mliska@suse.cz> PR middle-end/66240 PR target/45996 PR c/84100 * common.opt: Rename align options with 'str_' prefix. * common/config/i386/i386-common.c (set_malign_value): New function. (ix86_handle_option): Use it to set -falign-* options/ * config/aarch64/aarch64-protos.h (struct tune_params): Change type from int to string. * config/aarch64/aarch64.c: Update default values from int to string. * config/alpha/alpha.c (alpha_override_options_after_change): Likewise. * config/arm/arm.c (arm_override_options_after_change_1): Likewise. * config/i386/dragonfly.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. * config/i386/freebsd.h (SUBALIGN_LOG): New. (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. * config/i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. * config/i386/gnu-user.h (SUBALIGN_LOG): New. (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. * config/i386/i386.c (struct ptt): Change type from int to string. (ix86_default_align): Set default values. * config/i386/i386.h (ASM_OUTPUT_MAX_SKIP_PAD): Print max skip conditionally. * config/i386/iamcu.h (SUBALIGN_LOG): New. (ASM_OUTPUT_MAX_SKIP_ALIGN): * config/i386/lynx.h (ASM_OUTPUT_MAX_SKIP_ALIGN): * config/i386/netbsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. * config/i386/openbsdelf.h (SUBALIGN_LOG): New. (ASM_OUTPUT_MAX_SKIP_ALIGN) Print max skip conditionally.: * config/i386/x86-64.h (SUBALIGN_LOG): New. (ASM_OUTPUT_MAX_SKIP_ALIGN): Print max skip conditionally. (ASM_OUTPUT_MAX_SKIP_PAD): Likewise. * config/ia64/ia64.c (ia64_option_override): Set default values for alignment options. * config/m68k/m68k.c: Handle new str_align_* options. * config/mips/mips.c (mips_set_compression_mode): Change type of constants. (mips_option_override): Set default values for options. * config/powerpcspe/powerpcspe.c (rs6000_option_override_internal): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/rx/rx.c (rx_option_override): Likewise. * config/rx/rx.h (JUMP_ALIGN): Use align_jumps_log. (LABEL_ALIGN): Use align_labels_log. (LOOP_ALIGN): Use align_loops_align. * config/s390/s390.c (s390_asm_output_function_label): Use new macros. * config/sh/sh.c (sh_override_options_after_change): Change type of constants. * config/spu/spu.c (spu_sched_init): Likewise. * config/sparc/sparc.c (sparc_option_override): Set default values for options. * config/visium/visium.c (visium_option_override): Likewise. * config/visium/visium.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Do not emit p2align format with last argument if it's not needed. * doc/invoke.texi: Document extended format of -falign-*. * final.c: Use align_labels alignment. * flags.h (struct target_flag_state): Change type to use align_flags. (struct align_flags_tuple): New. (struct align_flags): Likewise. (align_loops_log): Redefine macro to use new types. (align_loops_max_skip): Redefine macro to use new types. (align_jumps_log): Redefine macro to use new types. (align_jumps_max_skip): Redefine macro to use new types. (align_labels_log): Redefine macro to use new types. (align_labels_max_skip): Redefine macro to use new types. (align_functions_log): Redefine macro to use new types. (align_loops): Redefine macro to use new types. (align_jumps): Redefine macro to use new types. (align_labels): Redefine macro to use new types. (align_functions): Redefine macro to use new types. (align_functions_max_skip): Redefine macro to use new types. (align_loops_value): New macro. (align_jumps_value): New macro. (align_labels_value): New macro. (align_functions_value): New macro. * function.c (invoke_set_current_function_hook): Propagate alignment values from flags to global variables default in topleev.h. * ipa-icf.c (sem_function::equals_wpa): Use cl_optimization_option_eq instead of memcmp. * lto-streamer.h (cl_optimization_stream_out): Support streaming of string types. (cl_optimization_stream_in): Likewise. * optc-save-gen.awk: Support strings in cl_optimization. * opth-gen.awk: Likewise. * opts.c (finish_options): Remove error checking of invalid value ranges. (MAX_CODE_ALIGN): Remove. (MAX_CODE_ALIGN_VALUE): Likewise. (parse_and_check_align_values): New function. (check_alignment_argument): Likewise. (common_handle_option): Use check_alignment_argument. * opts.h (parse_and_check_align_values): Declare. * toplev.c (init_alignments): Remove. (read_log_maxskip): New. (parse_N_M): Likewise. (parse_alignment_opts): Likewise. (backend_init_target): Remove usage of init_alignments. * toplev.h (parse_alignment_opts): Declare. * tree-streamer-in.c (streamer_read_tree_bitfields): Add new argument. * tree-streamer-out.c (streamer_write_tree_bitfields): Likewise. * tree.c (cl_option_hasher::equal): New. * varasm.c: Use new global macros. 2018-07-04 Martin Liska <mliska@suse.cz> PR middle-end/66240 PR target/45996 PR c/84100 * lto.c (compare_tree_sccs_1): Use cl_optimization_option_eq instead of memcmp. 2018-07-04 Martin Liska <mliska@suse.cz> PR middle-end/66240 PR target/45996 PR c/84100 * gcc.dg/pr84100.c (foo): * gcc.target/i386/falign-functions-2.c: New test. * gcc.target/i386/falign-functions.c: New test. From-SVN: r262375
2018-06-12Come up with Deprecated option flag.Martin Liska1-0/+3
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 Jelinek1-1/+1
From-SVN: r256169
2017-10-11Do not error for no_sanitize attributes (PR sanitizer/82490).Martin Liska1-1/+1
2017-10-11 Martin Liska <mliska@suse.cz> PR sanitizer/82490 * opts.c (parse_no_sanitize_attribute): Do not use error_value variable. * opts.h (parse_no_sanitize_attribute): Remove last argument. 2017-10-11 Martin Liska <mliska@suse.cz> PR sanitizer/82490 * c-attribs.c (handle_no_sanitize_attribute): Report directly Wattributes warning. 2017-10-11 Martin Liska <mliska@suse.cz> PR sanitizer/82490 * c-c++-common/ubsan/attrib-5.c: New test. From-SVN: r253640
2017-08-29Fix --help=target (PR other/39851).Martin Liska1-5/+13
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 Liska1-2/+7
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-06-13Implement no_sanitize function attributeMartin Liska1-0/+2
2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-c++-common/ubsan/attrib-2.c (float_cast2): Enhance the test by adding no_sanitize attribute. * gcc.dg/asan/use-after-scope-4.c: Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-attribs.c (add_no_sanitize_value): New function. (handle_no_sanitize_attribute): Likewise. (handle_no_sanitize_address_attribute): Use the function. (handle_no_sanitize_thread_attribute): New function. (handle_no_address_safety_analysis_attribute): Use add_no_sanitize_value. (handle_no_sanitize_undefined_attribute): Likewise. * c-common.h: Declare new functions. * c-ubsan.c (ubsan_instrument_division): Use sanitize_flags_p. (ubsan_instrument_shift): Likewise. (ubsan_instrument_bounds): Likewise. (ubsan_maybe_instrument_array_ref): Likewise. (ubsan_maybe_instrument_reference_or_call): Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * asan.c (asan_sanitize_stack_p): Use sanitize_flags_p. (gate_asan): Likewise. * asan.h (asan_no_sanitize_address_p): Remove the function. (sanitize_flags_p): New function. * builtins.def: Fix coding style. * common.opt: Use renamed enum value. * convert.c (convert_to_integer_1): Use sanitize_flags_p. * doc/extend.texi: Document no_sanitize attribute. * flag-types.h (enum sanitize_code): Rename SANITIZE_NONDEFAULT to SANITIZE_UNDEFINED_NONDEFAULT. * gcc.c (sanitize_spec_function): Use the renamed enum value. * gimple-fold.c (optimize_atomic_compare_exchange_p): Use sanitize_flags_p. * gimplify.c (gimplify_function_tree): Likewise. * ipa-inline.c (sanitize_attrs_match_for_inline_p): Likewise. * opts.c (parse_no_sanitize_attribute): New function. (common_handle_option): Use renamed enum value. * opts.h (parse_no_sanitize_attribute): Declare. * tree.c (sanitize_flags_p): New function. * tree.h: Declared here. * tsan.c: Use sanitize_flags_p. * ubsan.c (ubsan_expand_null_ifn): Likewise. (instrument_mem_ref): Likewise. (instrument_bool_enum_load): Likewise. (do_ubsan_in_current_function): Remove the function. (pass_ubsan::execute): Use sanitize_flags_p. * ubsan.h: Remove do_ubsan_in_current_function * tree-cfg.c (print_no_sanitize_attr_value): New function. (dump_function_to_file): Use it here. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * class.c (build_base_path): Use sanitize_flags_p. * cp-gimplify.c (cp_genericize_r): Likewise. (cp_genericize_tree): Likewise. (cp_genericize): Likewise. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise. * decl.c (compute_array_index_type): Likewise. (start_preparsed_function): Likewise. * decl2.c (one_static_initialization_or_destruction): Likewise. * init.c (finish_length_check): Likewise. * lambda.c (maybe_add_lambda_conv_op): Likewise. * typeck.c (cp_build_binary_op): Likewise. (build_static_cast_1): Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-convert.c (convert): Use sanitize_flags_p. * c-decl.c (grokdeclarator): Likewise. * c-typeck.c (convert_for_assignment): Likewise. (c_finish_return): Likewise. (build_binary_op): Likewise. From-SVN: r249158
2017-02-25re PR c/79677 (Weird handling of -Werror=)Jakub Jelinek1-1/+1
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 Jelinek1-1/+1
From-SVN: r243994
2016-09-26Fix handling of -fsanitize-recover* options.Martin Liska1-0/+1
* common.opt: Exclude SANITIZE_UNREACHABLE and SANITIZE_RETURN from default sanitize recover values. * doc/invoke.texi: Fix documentation related to -fsanitize=leak, -fsanitize=address, -fsanitize=thread and -fsanitize-recover. * flag-types.h: Replace couple of 1 << x to 1UL << x, make it consistent. * opts.c (finish_options): Do a generic loop over options that can be recovered. (parse_sanitizer_options): Exclude SANITIZE_UNREACHABLE and SANITIZE_RETURN. (common_handle_option): Likewise. * opts.h: Declare can_recover to sanitizer_opts_s. * c-c++-common/ubsan/sanitize-recover-1.c: New test. * c-c++-common/ubsan/sanitize-recover-2.c: New test. * c-c++-common/ubsan/sanitize-recover-3.c: New test. * c-c++-common/ubsan/sanitize-recover-4.c: New test. * c-c++-common/ubsan/sanitize-recover-5.c: New test. * c-c++-common/ubsan/sanitize-recover-6.c: New test. * c-c++-common/ubsan/sanitize-recover-7.c: New test. * c-c++-common/ubsan/sanitize-recover-8.c: New test. * c-c++-common/ubsan/sanitize-recover-9.c: New test. From-SVN: r240491
2016-09-13re PR middle-end/77475 (unnecessary or misleading context in reporting ↵Jakub Jelinek1-0/+3
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 Malcolm1-0/+1
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-02-16re PR target/48344 (powerpc ICE with -fstack-limit-register=r2)Kelvin Nilsen1-0/+4
[gcc] 2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org> PR Target/48344 * opts-global.c (handle_common_deferred_options): Introduce and initialize two global variables to remember command-line options specifying a stack-limiting register. * opts.h: Add extern declarations of the two new global variables. * emit-rtl.c (init_emit_once): Initialize the stack_limit_rtx variable based on the values of the two new global variables. [gcc/testsuite] 2016-02-16 Kelvin Nilsen <kelvin@gcc.gnu.org> PR Target/48344 * gcc.target/powerpc/pr48344-1.c: New test. From-SVN: r233477
2016-02-12PR driver/69265 and 69453: improved suggestions for various misspelled optionsDavid Malcolm1-0/+11
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-26re PR lto/69254 (ICE in streamer_get_builtin_tree when using ↵Jakub Jelinek1-0/+2
-fsanitize=shift on the compile side only) PR lto/69254 * opts.h (parse_sanitizer_options): New prototype. * opts.c (sanitizer_opts): New array. (parse_sanitizer_options): New function. (common_handle_option): Use parse_sanitizer_options. From-SVN: r232826
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055