Skip to content
Snippets Groups Projects
  1. Feb 20, 2025
  2. Jan 02, 2025
  3. Nov 18, 2024
    • David Malcolm's avatar
      diagnostics: add support for nested diagnostics [PR116253] · a5af2ec1
      David Malcolm authored
      
      Previously the diagnostic subsystem supported a one-deep
      hierarchy via auto_diagnostic_group, for associating
      notes with the warning/error they annotate; this only
      affects SARIF output, not text output.
      
      This patch adds support to the diagnostics subsystem for
      capturing arbitrarily deep nesting structure within
      diagnostic messages.
      
      This patch:
      * adds the ability to express nesting internally when
        building diagnostics
      * captures the nesting in SARIF output in the form documented
        in SG15's P3358R0 ("SARIF for Structured Diagnostics") via
        a "nestingLevel" property
      * adds a new experimental mode to text output to see the
        hierarchy, via:
        -fdiagnostics-set-output=text:experimental-nesting=yes
      * adds test coverage via a plugin, which with the above
        option emits:
        • note: child 0
          • note: grandchild 0 0
          • note: grandchild 0 1
          • note: grandchild 0 2
        • note: child 1
          • note: grandchild 1 0
          • note: grandchild 1 1
          • note: grandchild 1 2
        • note: child 2
          • note: grandchild 2 0
          • note: grandchild 2 1
          • note: grandchild 2 2
        using '*' rather than '•' if the text_art::theme is ascii-only.
      
      My hope is to eventually:
      (a) use this to improve C++'s template diagnostics
      (b) remove the "experimental" caveat from the the text output mode
      
      but this patch doesn't touch the C++ frontend, leaving both of these
      to followup work.
      
      gcc/c-family/ChangeLog:
      	PR other/116253
      	* c-opts.cc (c_diagnostic_text_finalizer): Use
      	text_output.build_indent_prefix for prefix to
      	diagnostic_show_locus.
      
      gcc/ChangeLog:
      	PR other/116253
      	* diagnostic-core.h (class auto_diagnostic_nesting_level): New.
      	* diagnostic-format-sarif.cc (class sarif_builder): Update leading
      	comment re nesting of diagnostics.
      	(sarif_result::on_nested_diagnostic): Add nestingLevel property.
      	* diagnostic-format-text.cc (on_report_diagnostic): If we're
      	showing nested diagnostics, then print changes of location on a
      	new line, indented, and update m_last_location.
      	(diagnostic_text_output_format::build_prefix): If m_show_nesting,
      	then potentially add indentation and a bullet point.
      	(get_bullet_point_unichar): New.
      	(use_unicode_p): New.
      	(diagnostic_text_output_format::build_indent_prefix): New.
      	* diagnostic-format-text.h
      	(diagnostic_text_output_format::diagnostic_text_output_format):
      	Initialize m_show_nesting and m_show_nesting_levels.
      	(diagnostic_text_output_format::build_indent_prefix): New decl.
      	(diagnostic_text_output_format::show_nesting_p): New accessor
      	(diagnostic_text_output_format::show_locations_in_nesting_p):
      	Likewise.
      	(diagnostic_text_output_format::set_show_nesting): New.
      	(diagnostic_text_output_format::set_show_locations_in_nesting):
      	New.
      	(diagnostic_text_output_format::set_show_nesting_levels): New.
      	(diagnostic_text_output_format::m_show_nesting): New field.
      	(diagnostic_text_output_format::m_show_locations_in_nesting): New
      	field.
      	(diagnostic_text_output_format::m_show_nesting_levels): New field.
      	* diagnostic-global-context.cc
      	(auto_diagnostic_nesting_level::auto_diagnostic_nesting_level):
      	New.
      	(auto_diagnostic_nesting_level::~auto_diagnostic_nesting_level):
      	New.
      	* diagnostic-show-locus.cc (layout_printer::print): Temporarily
      	set DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE.
      	* diagnostic.cc (diagnostic_context::initialize): Update for
      	renaming of m_nesting_depth to m_group_nesting_depth and
      	initialize m_diagnostic_nesting_level.
      	(diagnostic_context::finish): Update for renaming of
      	m_nesting_depth to m_group_nesting_depth.
      	(diagnostic_context::report_diagnostic): Likewise.
      	(diagnostic_context::begin_group): Likewise.
      	(diagnostic_context::end_group): Likewise.
      	(diagnostic_context::push_nesting_level): New.
      	(diagnostic_context::pop_nesting_level): New.
      	(diagnostic_context::set_diagnostic_buffer): Update for renaming
      	of m_nesting_depth to m_group_nesting_depth.  Assert that we don't
      	have nested diagnostics.
      	* diagnostic.h (diagnostic_context::push_nesting_level): New decl.
      	(diagnostic_context::pop_nesting_level): New decl.
      	(diagnostic_context::get_diagnostic_nesting_level): New accessor.
      	(diagnostic_context::build_indent_prefix): New decl.
      	(diagnostic_context::m_diagnostic_groups): Rename m_nesting_depth
      	to m_group_nesting_depth and add field m_diagnostic_nesting_level.
      	* doc/invoke.texi (fdiagnostics-add-output): Add note about
      	"experimental" schemes, keys, and values.  Add keys
      	"experimental-nesting", "experimental-nesting-show-locations",
      	and "experimental-nesting-show-levels" to text scheme.
      	* opts-diagnostic.cc (text_scheme_handler::make_sink): Add keys
      	"experimental-nesting", "experimental-nesting-show-locations",
      	and "experimental-nesting-show-levels".
      
      gcc/testsuite/ChangeLog:
      	PR other/116253
      	* gcc.dg/plugin/diagnostic-test-nesting-sarif.c: New test.
      	* gcc.dg/plugin/diagnostic-test-nesting-sarif.py: New test.
      	* gcc.dg/plugin/diagnostic-test-nesting-text-indented-show-levels.c:
      	New test.
      	* gcc.dg/plugin/diagnostic-test-nesting-text-indented-unicode.c:
      	New test.
      	* gcc.dg/plugin/diagnostic-test-nesting-text-indented.c: New test.
      	* gcc.dg/plugin/diagnostic-test-nesting-text-plain.c: New test.
      	* gcc.dg/plugin/diagnostic_plugin_test_nesting.c: New test plugin.
      	* gcc.dg/plugin/plugin.exp: Add the above.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      a5af2ec1
  4. Sep 09, 2024
    • David Malcolm's avatar
      diagnostics: introduce struct diagnostic_option_id · 89991f31
      David Malcolm authored
      
      Use a new struct diagnostic_option_id rather than just "int" when
      referring to command-line options controlling warnings in the
      diagnostic subsystem.
      
      No functional change intended, but better documents the meaning of
      the code.
      
      gcc/c-family/ChangeLog:
      	* c-common.cc (c_option_controlling_cpp_diagnostic): Return
      	diagnostic_option_id rather than int.
      	(c_cpp_diagnostic): Update for renaming of
      	diagnostic_override_option_index to diagnostic_set_option_id.
      
      gcc/c/ChangeLog:
      	* c-errors.cc (pedwarn_c23): Use "diagnostic_option_id option_id"
      	rather than "int opt".  Update for renaming of diagnostic_info
      	field.
      	(pedwarn_c11): Likewise.
      	(pedwarn_c99): Likewise.
      	(pedwarn_c90): Likewise.
      	* c-tree.h (pedwarn_c90): Likewise for decl.
      	(pedwarn_c99): Likewise.
      	(pedwarn_c11): Likewise.
      	(pedwarn_c23): Likewise.
      
      gcc/cp/ChangeLog:
      	* constexpr.cc (constexpr_error): Update for renaming of
      	diagnostic_info field.
      	* cp-tree.h (pedwarn_cxx98): Use "diagnostic_option_id" rather
      	than "int".
      	* error.cc (cp_adjust_diagnostic_info): Update for renaming of
      	diagnostic_info field.
      	(pedwarn_cxx98): Use "diagnostic_option_id option_id" rather than
      	"int opt".  Update for renaming of diagnostic_info field.
      	(diagnostic_set_info): Likewise.
      
      gcc/d/ChangeLog:
      	* d-diagnostic.cc (d_diagnostic_report_diagnostic): Update for
      	renaming of diagnostic_info field.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (struct diagnostic_option_id): New.
      	(warning): Use it rather than "int" for param.
      	(warning_n): Likewise.
      	(warning_at): Likewise.
      	(warning_meta): Likewise.
      	(pedwarn): Likewise.
      	(permerror_opt): Likewise.
      	(emit_diagnostic): Likewise.
      	(emit_diagnostic_valist): Likewise.
      	(emit_diagnostic_valist_meta): Likewise.
      	* diagnostic-format-json.cc
      	(json_output_format::on_report_diagnostic): Update for renaming of
      	diagnostic_info field.
      	* diagnostic-format-sarif.cc (sarif_builder::make_result_object):
      	Likewise.
      	(make_reporting_descriptor_object_for_warning): Likewise.
      	* diagnostic-format-text.cc (print_option_information): Likewise.
      	* diagnostic-global-context.cc (emit_diagnostic): Use
      	"diagnostic_option_id option_id" rather than "int opt".
      	(emit_diagnostic_valist): Likewise.
      	(emit_diagnostic_valist_meta): Likewise.
      	(warning): Likewise.
      	(warning_at): Likewise.
      	(warning_meta): Likewise.
      	(warning_n): Likewise.
      	(pedwarn): Likewise.
      	(permerror_opt): Likewise.
      	* diagnostic.cc (diagnostic_set_info_translated): Update for
      	renaming of diagnostic_info field.
      	(diagnostic_option_classifier::classify_diagnostic): Use
      	"diagnostic_option_id option_id" rather than "int opt".
      	(update_effective_level_from_pragmas): Update for renaming of
      	diagnostic_info field.
      	(diagnostic_context::diagnostic_enabled): Likewise.
      	(diagnostic_context::warning_enabled_at): Use
      	"diagnostic_option_id option_id" rather than "int opt".
      	(diagnostic_context::diagnostic_impl): Likewise.
      	(diagnostic_context::diagnostic_n_impl): Likewise.
      	* diagnostic.h (diagnostic_info::diagnostic_info): Update for...
      	(diagnostic_info::option_index): Rename...
      	(diagnostic_info::option_id): ...to this.
      	(class diagnostic_option_manager): Use
      	"diagnostic_option_id option_id" rather than "int opt" for vfuncs.
      	(diagnostic_option_classifier): Likewise for member funcs.
      	(diagnostic_classification_change_t::option): Add comment.
      	(diagnostic_context::warning_enabled_at): Use
      	"diagnostic_option_id option_id" rather than "int option_index".
      	(diagnostic_context::option_unspecified_p): Likewise.
      	(diagnostic_context::classify_diagnostic): Likewise.
      	(diagnostic_context::option_enabled_p): Likewise.
      	(diagnostic_context::make_option_name): Likewise.
      	(diagnostic_context::make_option_url): Likewise.
      	(diagnostic_context::diagnostic_impl): Likewise.
      	(diagnostic_context::diagnostic_n_impl): Likewise.
      	(diagnostic_override_option_index): Rename...
      	(diagnostic_set_option_id): ...to this, and update for
      	diagnostic_info field renaming.
      	(diagnostic_classify_diagnostic): Use "diagnostic_option_id"
      	rather than "int".
      	(warning_enabled_at): Likewise.
      	(option_unspecified_p): Likewise.
      
      gcc/fortran/ChangeLog:
      	* cpp.cc (cb_cpp_diagnostic_cpp_option): Convert return type from
      	"int" to "diagnostic_option_id".
      	(cb_cpp_diagnostic): Update for renaming of
      	diagnostic_override_option_index to diagnostic_set_option_id.
      	* error.cc (gfc_warning): Update for renaming of diagnostic_info
      	field.
      	(gfc_warning_now_at): Likewise.
      	(gfc_warning_now): Likewise.
      	(gfc_warning_internal): Likewise.
      
      gcc/ChangeLog:
      	* ipa-pure-const.cc: Replace include of "opts.h" with
      	"opts-diagnostic.h".
      	(suggest_attribute): Convert param from int to
      	diagnostic_option_id.
      	* lto-wrapper.cc (class lto_diagnostic_option_manager): Use
      	diagnostic_option_id rather than "int".
      	* opts-common.cc
      	(compiler_diagnostic_option_manager::option_enabled_p): Likewise.
      	* opts-diagnostic.h (class gcc_diagnostic_option_manager):
      	Likewise.
      	(class compiler_diagnostic_option_manager): Likewise.
      	* opts.cc (compiler_diagnostic_option_manager::make_option_name):
      	Likewise.
      	(gcc_diagnostic_option_manager::make_option_url): Likewise.
      	* substring-locations.cc
      	(format_string_diagnostic_t::emit_warning_n_va): Likewise.
      	(format_string_diagnostic_t::emit_warning_va): Likewise.
      	(format_string_diagnostic_t::emit_warning): Likewise.
      	(format_string_diagnostic_t::emit_warning_n): Likewise.
      	* substring-locations.h
      	(format_string_diagnostic_t::emit_warning_va): Likewise.
      	(format_string_diagnostic_t::emit_warning_n_va): Likewise.
      	(format_string_diagnostic_t::emit_warning): Likewise.
      	(format_string_diagnostic_t::emit_warning_n): Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      89991f31
  5. Mar 20, 2024
    • Lewis Hyatt's avatar
      diagnostics: Fix behavior of permerror options after diagnostic pop [PR111918] · 44ba7bcb
      Lewis Hyatt authored
      When a diagnostic pragma changes the classification of a given diagnostic,
      the global options flags (such as warn_narrowing, etc.) may get changed too.
      Specifically, if a warning was not enabled initially and was later enabled
      by a pragma, then the corresponding global flag will change from false to
      true when the pragma is processed. That change is permanent and is not
      undone by a subsequent `#pragma GCC diagnostic pop'; the warning flag needs
      to remain enabled since a diagnostic could be generated later on for a
      source location prior to the pop.
      
      So in order to support popping to the initial classification, given that the
      global options flags no longer reflect that state, the diagnostic_context
      object itself remembers the way things were before it changed anything. The
      current implementation works fine for diagnostics that are always errors or
      always warnings, but it doesn't do the right thing for diagnostics that
      could be either, such as -Wnarrowing. The classification of that diagnostic
      (or any permerror diagnostic) depends on the state of -fpermissive; for the
      particular case of -Wnarrowing it also matters whether a compile-time or
      run-time narrowing is being diagnosed.
      
      The problem is that the current implementation insists on recording whether
      an enabled diagnostic should be a DK_WARNING or a DK_ERROR, and then, after
      popping to the initial state, it overrides it always to that type only. Fix
      that up by adding a new internal diagnostic type DK_ANY. This just indicates
      that the diagnostic is enabled without mandating exactly what type of
      diagnostic it should be. Then the diagnostic can be emitted with whatever
      type the frontend asks for.
      
      Incidentally, while making this change, I noticed that classify_diagnostic()
      spends some time computing a return value (the old classification kind) that
      is not used anywhere. The computed value seems to have some problems, mainly
      that it does not take into account `#pragma GCC diagnostic pop' at all, and
      so the returned value doesn't seem like it could make sense in many
      contexts. Given it would also not be desirable to leak the new internal-only
      DK_ANY type to outside callers, I think it would make sense in a subsequent
      cleanup patch to remove the return value altogether.
      
      gcc/ChangeLog:
      
      	PR c++/111918
      	* diagnostic-core.h (enum diagnostic_t): Add DK_ANY special flag.
      	* diagnostic.cc (diagnostic_option_classifier::classify_diagnostic):
      	Make use of DK_ANY to indicate a diagnostic was initially enabled.
      	(diagnostic_context::diagnostic_enabled): Do not change the type of
      	a diagnostic if the saved classification is type DK_ANY.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/111918
      	* g++.dg/cpp0x/Wnarrowing21a.C: New test.
      	* g++.dg/cpp0x/Wnarrowing21b.C: New test.
      	* g++.dg/cpp0x/Wnarrowing21c.C: New test.
      	* g++.dg/cpp0x/Wnarrowing21d.C: New test.
      44ba7bcb
  6. Feb 13, 2024
    • David Malcolm's avatar
      diagnostics: unbreak 'make gcc.pot' · b753ef8f
      David Malcolm authored
      
      As noted by Joseph, I broke "make gcc.pot" in r14-6057-g12b67d1e13b3cf
      by adding an overloaded format API with the format string in a different
      position, leading to this failure:
      
      emit_diagnostic_valist used incompatibly as both --keyword=emit_diagnostic_valist:4
      --flag=emit_diagnostic_valist:4:gcc-internal-format and --keyword=emit_diagnostic_valist:5
      --flag=emit_diagnostic_valist:5:gcc-internal-format
      
      Fix by replacing the overloaded function with one with a different name.
      
      See also r10-6297-g6c8e584430bc5d for previous fixes for this involving
      the same function, or r5-6946-g40fecdd62f7d29 and
      r5-6959-gdb30e21cbff7b9 for older fixes for similar issues.
      
      gcc/analyzer/ChangeLog:
      	* pending-diagnostic.cc (diagnostic_emission_context::warn):
      	Update for renaming of emit_diagnostic_valist overload to
      	emit_diagnostic_valist_meta.
      	(diagnostic_emission_context::inform): Likewise.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (emit_diagnostic_valist): Rename overload
      	to...
      	(emit_diagnostic_valist_meta): ...this.
      	* diagnostic.cc (emit_diagnostic_valist): Likewise, to...
      	(emit_diagnostic_valist_meta): ...this.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      b753ef8f
  7. Jan 03, 2024
  8. Dec 01, 2023
    • David Malcolm's avatar
      diagnostics, analyzer: add optional per-diagnostic property bags to SARIF · 12b67d1e
      David Malcolm authored
      
      I've found it useful in debugging the analyzer for the SARIF output to
      contain extra analyzer-specific data in each diagnostic.
      
      This patch:
      * adds a way for a diagnostic_metadata to populate a property
      bag within a SARIF "result" object based on a new vfunc
      * reworks how diagnostics are emitted within the analyzer so
      that a custom diagnostic_metadata subclass is used, which populates
      the property bag with information from the saved_diagnostic, and with
      a vfunc hook allowing for per-pending_diagnotic-subclass extra
      properties.
      
      Doing so makes it trivial to go from the SARIF output back to
      pertinent parts of the analyzer's internals (e.g. the index of
      the diagnostic within the ana::diagnostic_manager, the index of
      the ana::exploded_node, etc).
      
      It also replaces a lot of boilerplate in the "emit" implementations
      in the various pending_diagnostics subclasses.  In particular, doing
      so fixes missing CVE metadata for -Wanalyzer-fd-phase-mismatch (where
      sm-fd.cc's fd_phase_mismatch::emit was failing to use its
      diagnostic_metadata instance).
      
      gcc/analyzer/ChangeLog:
      	* analyzer.h (class saved_diagnostic): New forward decl.
      	* bounds-checking.cc: Update for changes to
      	pending_diagnostic::emit.
      	* call-details.cc: Likewise.
      	* diagnostic-manager.cc: Include "diagnostic-format-sarif.h".
      	(saved_diagnostic::maybe_add_sarif_properties): New.
      	(class pending_diagnostic_metadata): New.
      	(diagnostic_manager::emit_saved_diagnostic): Create a
      	pending_diagnostic_metadata and a diagnostic_emission_context.
      	Pass the latter to the pending_diagnostic::emit vfunc.
      	* diagnostic-manager.h
      	(saved_diagnostic::maybe_add_sarif_properties): New decl.
      	* engine.cc: Update for changes to pending_diagnostic::emit.
      	* infinite-loop.cc: Likewise.
      	* infinite-recursion.cc: Likewise.
      	* kf-analyzer.cc: Likewise.
      	* kf.cc: Likewise.
      	* pending-diagnostic.cc
      	(diagnostic_emission_context::get_pending_diagnostic): New.
      	(diagnostic_emission_context::warn): New.
      	(diagnostic_emission_context::inform): New.
      	* pending-diagnostic.h (class diagnostic_emission_context): New.
      	(pending_diagnostic::emit): Update params.
      	(pending_diagnostic::maybe_add_sarif_properties): New vfunc.
      	* region.cc: Don't include "diagnostic-metadata.h".
      	* region-model.cc: Include "diagnostic-format-sarif.h".  Update
      	for changes to pending_diagnostic::emit.
      	(exposure_through_uninit_copy::maybe_add_sarif_properties): New.
      	* sm-fd.cc: Update for changes to pending_diagnostic::emit.
      	* sm-file.cc: Likewise.
      	* sm-malloc.cc: Likewise.
      	* sm-pattern-test.cc: Likewise.
      	* sm-sensitive.cc: Likewise.
      	* sm-signal.cc: Likewise.
      	* sm-taint.cc: Likewise.
      	* store.cc: Don't include "diagnostic-metadata.h".
      	* varargs.cc: Update for changes to pending_diagnostic::emit.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (emit_diagnostic_valist): New overload decl.
      	* diagnostic-format-sarif.cc (sarif_builder::make_result_object):
      	When we have metadata, call its maybe_add_sarif_properties vfunc.
      	* diagnostic-metadata.h (class sarif_object): Forward decl.
      	(diagnostic_metadata::~diagnostic_metadata): New.
      	(diagnostic_metadata::maybe_add_sarif_properties): New vfunc.
      	* diagnostic.cc (emit_diagnostic_valist): New overload.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/analyzer/fd-accept.c: Update for fix to missing CWE
      	metadata for -Wanalyzer-fd-phase-mismatch.
      	* gcc.dg/analyzer/fd-bind.c: Likewise.
      	* gcc.dg/analyzer/fd-socket-misuse.c: Likewise.
      	* gcc.dg/plugin/analyzer_cpython_plugin.c: Update for changes to
      	pending_diagnostic::emit.
      	* gcc.dg/plugin/analyzer_gil_plugin.c: Likewise.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      12b67d1e
  9. Oct 19, 2023
    • Jason Merrill's avatar
      diagnostic: rename new permerror overloads · 1ec36bcd
      Jason Merrill authored
      While checking another change, I noticed that the new permerror overloads
      break gettext with "permerror used incompatibly as both
       --keyword=permerror:2 --flag=permerror:2:gcc-internal-format and
       --keyword=permerror:3 --flag=permerror:3:gcc-internal-format".  So let's
      change the name.
      
      gcc/ChangeLog:
      
      	* diagnostic-core.h (permerror): Rename new overloads...
      	(permerror_opt): To this.
      	* diagnostic.cc: Likewise.
      
      gcc/cp/ChangeLog:
      
      	* typeck2.cc (check_narrowing): Adjust.
      1ec36bcd
  10. Oct 18, 2023
    • Jason Merrill's avatar
      diagnostic: add permerror variants with opt · ef10cb86
      Jason Merrill authored
      In the discussion of promoting some pedwarns to be errors by default, rather
      than move them all into -fpermissive it seems to me to make sense to support
      DK_PERMERROR with an option flag.  This way will also work with
      -fpermissive, but users can also still use -Wno-error=narrowing to downgrade
      that specific diagnostic rather than everything affected by -fpermissive.
      
      So, for diagnostics that we want to make errors by default we can just
      change the pedwarn call to permerror.
      
      The tests check desired behavior for such a permerror in a system header
      with various flags.  The patch preserves the existing permerror behavior of
      ignoring -w and system headers by default, but respecting them when
      downgraded to a warning by -fpermissive.
      
      This seems similar to but a bit better than the approach of forcing
      -pedantic-errors that I previously used for -Wnarrowing: specifically, in
      that now -w by itself is not enough to silence the -Wnarrowing
      error (integer-pack2.C).
      
      gcc/ChangeLog:
      
      	* doc/invoke.texi: Move -fpermissive to Warning Options.
      	* diagnostic.cc (update_effective_level_from_pragmas): Remove
      	redundant system header check.
      	(diagnostic_report_diagnostic): Move down syshdr/-w check.
      	(diagnostic_impl): Handle DK_PERMERROR with an option number.
      	(permerror): Add new overloads.
      	* diagnostic-core.h (permerror): Declare them.
      
      gcc/cp/ChangeLog:
      
      	* typeck2.cc (check_narrowing): Use permerror.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/ext/integer-pack2.C: Add -fpermissive.
      	* g++.dg/diagnostic/sys-narrow.h: New test.
      	* g++.dg/diagnostic/sys-narrow1.C: New test.
      	* g++.dg/diagnostic/sys-narrow1a.C: New test.
      	* g++.dg/diagnostic/sys-narrow1b.C: New test.
      	* g++.dg/diagnostic/sys-narrow1c.C: New test.
      	* g++.dg/diagnostic/sys-narrow1d.C: New test.
      	* g++.dg/diagnostic/sys-narrow1e.C: New test.
      	* g++.dg/diagnostic/sys-narrow1f.C: New test.
      	* g++.dg/diagnostic/sys-narrow1g.C: New test.
      	* g++.dg/diagnostic/sys-narrow1h.C: New test.
      	* g++.dg/diagnostic/sys-narrow1i.C: New test.
      ef10cb86
  11. Sep 07, 2023
  12. Jan 02, 2023
  13. Jan 03, 2022
  14. Jan 04, 2021
  15. Jan 28, 2020
    • David Malcolm's avatar
      diagnostic_metadata: unbreak xgettext (v2) · 6c8e5844
      David Malcolm authored
      Changed in v2:
      - rename from warning_with_metadata_at to warning_meta
      - fix test plugins
      
      While C++ can have overloads, xgettext can't deal with overloads that have
      different argument positions, leading to two failures in "make gcc.pot":
      
      emit_diagnostic_valist used incompatibly as both
      --keyword=emit_diagnostic_valist:4
      --flag=emit_diagnostic_valist:4:gcc-internal-format and
      --keyword=emit_diagnostic_valist:5
      --flag=emit_diagnostic_valist:5:gcc-internal-format
      
      warning_at used incompatibly as both
      --keyword=warning_at:3 --flag=warning_at:3:gcc-internal-format and
      --keyword=warning_at:4 --flag=warning_at:4:gcc-internal-format
      
      The emit_diagnostic_valist overload isn't used anywhere (I think it's
      a leftover from an earlier iteration of the analyzer patch kit).
      
      The warning_at overload is used throughout the analyzer but nowhere else.
      
      Ideally I'd like to consolidate this argument with something
      constructable in various ways:
      - from a metadata and an int or
      - from an int (or, better an "enum opt_code"),
      so that the overload happens when implicitly choosing the ctor, but
      that feels like stage 1 material.
      
      In the meantime, fix xgettext by deleting the unused overload and
      renaming the used one.
      
      gcc/analyzer/ChangeLog:
      	* region-model.cc (poisoned_value_diagnostic::emit): Update for
      	renaming of warning_at overload to warning_meta.
      	* sm-file.cc (file_leak::emit): Likewise.
      	* sm-malloc.cc (double_free::emit): Likewise.
      	(possible_null_deref::emit): Likewise.
      	(possible_null_arg::emit): Likewise.
      	(null_deref::emit): Likewise.
      	(null_arg::emit): Likewise.
      	(use_after_free::emit): Likewise.
      	(malloc_leak::emit): Likewise.
      	(free_of_non_heap::emit): Likewise.
      	* sm-sensitive.cc (exposure_through_output_file::emit): Likewise.
      	* sm-signal.cc (signal_unsafe_call::emit): Likewise.
      	* sm-taint.cc (tainted_array_index::emit): Likewise.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (warning_at): Rename overload to...
      	(warning_meta): ...this.
      	(emit_diagnostic_valist): Delete decl of overload taking
      	diagnostic_metadata.
      	* diagnostic.c (emit_diagnostic_valist): Likewise for defn.
      	(warning_at): Rename overload taking diagnostic_metadata to...
      	(warning_meta): ...this.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic_plugin_test_metadata.c: Update for
      	renaming of warning_at overload to warning_meta.
      	* gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise.
      6c8e5844
  16. Jan 01, 2020
  17. Dec 18, 2019
    • David Malcolm's avatar
      Add diagnostic_metadata and CWE support · 6d4a35ca
      David Malcolm authored
      This patch adds support for associating a diagnostic message with an
      optional diagnostic_metadata object, so that plugins can add extra data
      to their diagnostics (e.g. mapping a diagnostic to a taxonomy or coding
      standard such as from CERT or MISRA).
      
      Currently this only supports associating a CWE identifier with a
      diagnostic (which is what I'm using for the warnings in the analyzer
      patch kit), but adding a diagnostic_metadata class allows for future
      growth in this area without an explosion of further "warning_at"
      overloads for all of the different kinds of custom data that a plugin
      might want to add.
      
      This version of the patch renames the overly-general
      -fdiagnostics-show-metadata to -fdiagnostics-show-cwe and adds test
      coverage for it via a plugin.
      
      It also adds a note to the documentation that no GCC diagnostics
      currently use this; it's a feature for plugins (and, at some point,
      I hope, the analyzer).
      
      gcc/ChangeLog:
      	* common.opt (fdiagnostics-show-cwe): Add.
      	* diagnostic-core.h (class diagnostic_metadata): New forward decl.
      	(warning_at): Add overload taking a const diagnostic_metadata &.
      	(emit_diagnostic_valist): Add overload taking a
      	const diagnostic_metadata *.
      	* diagnostic-format-json.cc: Include "diagnostic-metadata.h".
      	(json_from_metadata): New function.
      	(json_end_diagnostic): Call it to add "metadata" child for
      	diagnostics with metadata.
      	(diagnostic_output_format_init): Clear context->show_cwe.
      	* diagnostic-metadata.h: New file.
      	* diagnostic.c: Include "diagnostic-metadata.h".
      	(diagnostic_impl): Add const diagnostic_metadata * param.
      	(diagnostic_n_impl): Likewise.
      	(diagnostic_initialize): Initialize context->show_cwe.
      	(diagnostic_set_info_translated): Initialize diagnostic->metadata.
      	(get_cwe_url): New function.
      	(print_any_cwe): New function.
      	(diagnostic_report_diagnostic): Call print_any_cwe if the
      	diagnostic has non-NULL metadata.
      	(emit_diagnostic): Pass NULL as the metadata in the call to
      	diagnostic_impl.
      	(emit_diagnostic_valist): Likewise.
      	(emit_diagnostic_valist): New overload taking a
      	const diagnostic_metadata *.
      	(inform): Pass NULL as the metadata in the call to
      	diagnostic_impl.
      	(inform_n): Likewise for diagnostic_n_impl.
      	(warning): Likewise.
      	(warning_at): Likewise.  Add overload that takes a
      	const diagnostic_metadata &.
      	(warning_n): Pass NULL as the metadata in the call to
      	diagnostic_n_impl.
      	(pedwarn): Likewise for diagnostic_impl.
      	(permerror): Likewise.
      	(error): Likewise.
      	(error_n): Likewise.
      	(error_at): Likewise.
      	(sorry): Likewise.
      	(sorry_at): Likewise.
      	(fatal_error): Likewise.
      	(internal_error): Likewise.
      	(internal_error_no_backtrace): Likewise.
      	* diagnostic.h (diagnostic_info::metadata): New field.
      	(diagnostic_context::show_cwe): New field.
      	* doc/invoke.texi (-fno-diagnostics-show-cwe): New option.
      	* opts.c (common_handle_option): Handle OPT_fdiagnostics_show_cwe.
      	* toplev.c (general_init): Initialize global_dc->show_cwe.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic-test-metadata.c: New test.
      	* gcc.dg/plugin/diagnostic_plugin_test_metadata.c: New test plugin.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
      
      From-SVN: r279556
      6d4a35ca
  18. Jan 01, 2019
  19. Nov 30, 2018
    • David Malcolm's avatar
      C++: fix-it hint for missing parentheses · 8ba109ce
      David Malcolm authored
      Consider:
      
        class t1
        {
        public:
          double length () const { return m_length; }
        private:
          double m_length;
        };
      
      missing-parens-fixit.C: In function 'bool test_1(const t1&)':
      missing-parens-fixit.C:14:15: error: invalid use of member function
        'double t1::length() const' (did you forget the '()' ?)
         14 |   return inst.length > 0.0;
            |          ~~~~~^~~~~~
      
      This patch adds a fix-it hint for the case where the member function
      takes no parameters, suggesting the addition of the parentheses:
      
         14 |   return inst.length > 0.0;
            |          ~~~~~^~~~~~
            |                     ()
      
      so that an IDE can potentially apply the fix.
      
      gcc/cp/ChangeLog:
      	* typeck2.c: Include "gcc-rich-location.h".
      	(cxx_incomplete_type_diagnostic): When complaining about possibly
      	missing parens, add a fix-it hint if the member function takes no
      	additional params.
      
      gcc/ChangeLog:
      	* diagnostic-core.h (emit_diagnostic): New decl.
      	* diagnostic.c (emit_diagnostic): New overload, taking a
      	rich_location *.
      
      gcc/testsuite/ChangeLog:
      	* g++.dg/parse/missing-parens-fixit.C: New test.
      
      From-SVN: r266696
      8ba109ce
  20. Sep 11, 2018
    • Andrew Stubbs's avatar
      Add sorry_at diagnostic function. · ad172f72
      Andrew Stubbs authored
      The plain "sorry" diagnostic only gives the "current" location, which is
      typically the last line of the function or translation unit by time we get to
      the back end.
      
      GCN uses "sorry" to report unsupported language features, such as static
      constructors, so it's useful to have a "sorry_at" variant.
      
      This patch implements "sorry_at" according to the pattern of the other "at"
      variants.
      
      2018-09-11  Andrew Stubbs  <ams@codesourcery.com>
      
      	gcc/
      	* diagnostic-core.h (sorry_at): New prototype.
      	* diagnostic.c (sorry_at): New function.
      
      From-SVN: r264204
      ad172f72
  21. Aug 20, 2018
    • David Malcolm's avatar
      Add support for grouping of related diagnostics (PR other/84889) · 097f82ec
      David Malcolm authored
      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
      097f82ec
  22. Feb 27, 2018
    • Martin Sebor's avatar
      PR translation/84207 - Hard coded plural in gimple-fold.c · 1c89478a
      Martin Sebor authored
      gcc/ChangeLog:
      
      	PR translation/84207
      	* diagnostic-core.h (warning_n, error_n, inform_n): Change
      	n argument to unsigned HOST_WIDE_INT.
      	* diagnostic.c (warning_n, error_n, inform_n): Ditto.
      	(diagnostic_n_impl): Ditto.  Handle arguments in excess of LONG_MAX.
      	* gimple-ssa-sprintf.c (format_directive): Simplify inform_n call.
      	* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Use warning_n.
      
      From-SVN: r258044
      1c89478a
  23. Jan 03, 2018
  24. Oct 31, 2017
    • David Malcolm's avatar
      diagnostics: get rid of *_at_rich_loc in favor of overloading · 64a5912c
      David Malcolm authored
      Adding a fix-it hint currently involves changing e.g.:
      
        error_at (token->location,
                  "unknown type name %qE; did you mean %qs?",
                  token->value, hint);
      to:
      
        gcc_rich_location richloc (token->location);
        richloc.add_fixit_replace (hint);
        error_at_rich_loc (&richloc,
                           "unknown type name %qE; did you mean %qs?",
                           token->value, hint);
      
      to make the change from taking a location_t to a rich_location *.
      
      This patch renames the "*_at_rich_loc" diagnostic entrypoints to use
      the same function names for rich_location * as for location_t,
      via overloading, to simplify the above change to just changing from:
      
        error_at (token->location,
                  "unknown type name %qE; did you mean %qs?",
                  token->value, hint);
      to:
      
        gcc_rich_location richloc (token->location);
        richloc.add_fixit_replace (hint);
        error_at (&richloc,
                  "unknown type name %qE; did you mean %qs?",
                  token->value, hint);
      
      thus saving space (and typing) and usually avoiding the need to reindent
      the "error_at" invocation.
      
      With this change, 0 is no longer acceptable as a location_t to these
      entrypoints, as e.g.:
      
      ../../src/gcc/auto-profile.c:855:37: error: call of overloaded
      'inform(int, const char [18])' is ambiguous
             inform (0, "Not expected TAG.");
                                           ^
      In file included from ../../src/gcc/auto-profile.c:35:0:
      ../../src/gcc/diagnostic-core.h:88:13: note: candidate:
      'void inform(location_t, const char*, ...)'
       extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
                   ^~~~~~
      ../../src/gcc/diagnostic-core.h:89:13: note: candidate:
      'void inform(rich_location*, const char*, ...)'
       extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
                   ^~~~~~
      
      Such locations now need to be spelled out as UNKNOWN_LOCATION,
      rather than 0.
      
      I considered making the API take a rich_location & rather than a
      rich_location *, but doing so would mean replacing
        diagnostic_set_info
      and
        diagnostic_set_info_translated
      with a constructor for diagnostic_info, which was a more invasive
      change.  Maybe in the future.
      
      gcc/ChangeLog:
      	* auto-profile.c (autofdo_source_profile::read): Use
      	UNKNOWN_LOCATION rather than 0.
      	* diagnostic-core.h (warning_at_rich_loc): Rename to...
      	(warning_at): ...this overload.
      	(warning_at_rich_loc_n): Rename to...
      	(warning_n): ...this overload.
      	(error_at_rich_loc): Rename to...
      	(error_at): ...this overload.
      	(pedwarn_at_rich_loc): Rename to...
      	(pedwarn): ...this overload.
      	(permerror_at_rich_loc): Rename to...
      	(permerror): ...this overload.
      	(inform_at_rich_loc): Rename to...
      	(inform): ...this overload.
      	* diagnostic.c: (diagnostic_n_impl): Delete location_t-based decl.
      	(diagnostic_n_impl_richloc): Rename to...
      	(diagnostic_n_impl): ...this rich_location *-based decl.
      	(inform_at_rich_loc): Rename to...
      	(inform): ...this, and add an assertion.
      	(inform_n): Update for removal of location_t-based diagnostic_n_impl.
      	(warning_at_rich_loc): Rename to...
      	(warning_at): ...this, and add an assertion.
      	(warning_at_rich_loc_n): Rename to...
      	(warning_n): ...this, and add an assertion.
      	(warning_n): Update location_t-based implementation for removal of
      	location_t-based diagnostic_n_impl.
      	(pedwarn_at_rich_loc): Rename to...
      	(pedwarn): ...this, and add an assertion.
      	(permerror_at_rich_loc): Rename to...
      	(permerror): ...this, and add an assertion.
      	(error_n): Update for removal of location_t-based diagnostic_n_impl.
      	(error_at_rich_loc): Rename to...
      	(error_at): ...this, and add an assertion.
      	* gcc.c (do_spec_1): Use UNKNOWN_LOCATION rather than 0.
      	(driver::do_spec_on_infiles): Likewise.
      	* substring-locations.c (format_warning_va): Update for renaming
      	of inform_at_rich_loc.
      
      gcc/c-family/ChangeLog:
      	* c-common.c (binary_op_error): Update for renaming of
      	error_at_rich_loc.
      	(c_parse_error): Likewise.
      	* c-warn.c (warn_logical_not_parentheses): Likewise for
      	renaming of inform_at_rich_loc.
      	(warn_for_restrict): Likewise for renaming of
      	warning_at_rich_loc_n.
      
      gcc/c/ChangeLog:
      	* c-decl.c (implicit_decl_warning): Update for renaming of
      	pedwarn_at_rich_loc and warning_at_rich_loc.
      	(implicitly_declare): Likewise for renaming of inform_at_rich_loc.
      	(undeclared_variable): Likewise for renaming of error_at_rich_loc.
      	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
      	(c_parser_struct_or_union_specifier): Likewise for renaming of
      	pedwarn_at_rich_loc.
      	(c_parser_parameter_declaration): Likewise for renaming of
      	error_at_rich_loc.
      	* c-typeck.c (build_component_ref): Likewise.
      	(build_unary_op): Likewise for renaming of inform_at_rich_loc.
      	(pop_init_level): Likewise for renaming of warning_at_rich_loc.
      	(set_init_label): Likewise for renaming of error_at_rich_loc.
      
      gcc/cp/ChangeLog:
      	* class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
      	than 0.
      	* name-lookup.c (suggest_alternatives_for): Update for renaming of
      	inform_at_rich_loc.
      	(maybe_suggest_missing_header): Likewise.
      	(suggest_alternative_in_explicit_scope): Likewise.
      	* parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
      	renaming of error_at_rich_loc.
      	(cp_parser_string_literal): Likewise.
      	(cp_parser_nested_name_specifier_opt): Likewise.
      	(cp_parser_cast_expression): Likewise for renaming of
      	warning_at_rich_loc.
      	(cp_parser_decl_specifier_seq): Likewise for renaming of
      	error_at_rich_loc and warning_at_rich_loc.
      	(cp_parser_elaborated_type_specifier): Likewise for renaming of
      	pedwarn_at_rich_loc.
      	(cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
      	error_at_rich_loc.
      	(cp_parser_virt_specifier_seq_opt): Likewise.
      	(cp_parser_class_specifier_1): Likewise.
      	(cp_parser_class_head): Likewise.
      	(cp_parser_member_declaration): Likewise for renaming of
      	pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
      	(cp_parser_enclosed_template_argument_list): Likewise for renaming
      	of error_at_rich_loc.
      	(set_and_check_decl_spec_loc): Likewise.
      	* pt.c (listify): Likewise.
      	* rtti.c (typeid_ok_p): Likewise.
      	* semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
      	than 0.
      	* typeck.c (access_failure_info::maybe_suggest_accessor): Update
      	for renaming of inform_at_rich_loc.
      	(finish_class_member_access_expr): Likewise for renaming of
      	error_at_rich_loc.
      
      gcc/objc/ChangeLog:
      	* objc-gnu-runtime-abi-01.c (objc_gnu_runtime_abi_01_init): Use
      	UNKNOWN_LOCATION rather than 0.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
      	for renaming of error_at_rich_loc and inform_at_rich_loc.
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
      	(test_show_locus): Likewise for renaming of warning_at_rich_loc.
      
      libcpp/ChangeLog:
      	* directives.c (_cpp_handle_directive): Update for renaming of
      	cpp_error_at_richloc to cpp_error_at.
      	* errors.c (cpp_diagnostic_at_richloc): Rename to...
      	(cpp_diagnostic_at): ...this, dropping the location_t-based
      	implementation.
      	(cpp_diagnostic): Update for removal of location_t-based
      	cpp_diagnostic_at.
      	(cpp_error_at): Likewise.
      	(cpp_error_at_richloc): Rename to...
      	(cpp_error_at): ...this, and update for renaming of
      	cpp_diagnostic_at_richloc.
      	* include/cpplib.h (cpp_error_at_richloc): Rename to...
      	(cpp_error_at): ...this.
      
      From-SVN: r254280
      64a5912c
  25. Aug 09, 2017
    • Marek Polacek's avatar
      re PR c/81233 (--Wdiscarded-qualifiers and Wincompatible-pointer-types missing important detail) · 296c53ac
      Marek Polacek authored
      	PR c/81233
      	* c-typeck.c (pedwarn_init): Make the function take a variable list.
      	Call emit_diagnostic_valist instead of pedwarn.
      	(convert_for_assignment): Unroll the PEDWARN_FOR_ASSIGNMENT macro.
      	Print the relevant types in diagnostics.
      
      	* diagnostic-core.h (emit_diagnostic_valist): Add declaration.
      	* diagnostic.c (emit_diagnostic): Add a comment.
      	(emit_diagnostic_valist): New function.
      
      	* gcc.dg/diagnostic-types-1.c: New test.
      	* gcc.dg/assign-warn-1.c: Update warning messages.
      	* gcc.dg/assign-warn-2.c: Likewise.
      	* gcc.dg/c90-const-expr-5.c: Likewise.
      	* gcc.dg/c99-const-expr-5.c: Likewise.
      	* gcc.dg/conv-2.c: Likewise.
      	* gcc.dg/init-bad-7.c: Likewise.
      	* gcc.dg/overflow-warn-1.c: Likewise.
      	* gcc.dg/overflow-warn-2.c: Likewise.
      	* gcc.dg/overflow-warn-3.c: Likewise.
      	* gcc.dg/overflow-warn-4.c: Likewise.
      	* gcc.dg/pointer-array-atomic.c: Likewise.
      	* gcc.dg/pr26865.c: Likewise.
      	* gcc.dg/pr61162-2.c: Likewise.
      	* gcc.dg/pr61162.c: Likewise.
      	* gcc.dg/pr67730-2.c: Likewise.
      	* gcc.dg/pr69156.c: Likewise.
      	* gcc.dg/pr70174.c: Likewise.
      	* objc.dg/proto-lossage-4.m: Likewise.
      
      From-SVN: r250985
      296c53ac
  26. Jan 01, 2017
  27. Oct 08, 2016
    • Prathamesh Kulkarni's avatar
      diagnostic-core.h (warning_at_rich_loc_n): Declare. · a5fb7ad2
      Prathamesh Kulkarni authored
      2016-10-08  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
      
      	* diagnostic-core.h (warning_at_rich_loc_n): Declare.
      	* diagnostic.c (warning_at_rich_loc_n): New function.
      	(diagnostic_n_impl_richloc): Likewise.
      	(diagnostic_n_impl): Move most of the function to
      	diagnostic_n_impl_richloc and call it.
      
      From-SVN: r240891
      a5fb7ad2
  28. Jun 22, 2016
    • David Malcolm's avatar
      C FE: suggest corrections for misspelled identifiers and type names · 1a4f11c8
      David Malcolm authored
      gcc/c-family/ChangeLog:
      	PR c/70339
      	* c-common.h (enum lookup_name_fuzzy_kind): New enum.
      	(lookup_name_fuzzy): New prototype.
      
      gcc/c/ChangeLog:
      	PR c/70339
      	* c-decl.c: Include spellcheck-tree.h and gcc-rich-location.h.
      	(implicit_decl_warning): When issuing warnings for implicit
      	declarations, attempt to provide a suggestion via
      	lookup_name_fuzzy.
      	(undeclared_variable): Likewise when issuing errors.
      	(lookup_name_in_scope): Likewise.
      	(struct edit_distance_traits<cpp_hashnode *>): New struct.
      	(best_macro_match): New typedef.
      	(find_closest_macro_cpp_cb): New function.
      	(lookup_name_fuzzy): New function.
      	* c-parser.c: Include gcc-rich-location.h.
      	(c_token_starts_typename): Split out case CPP_KEYWORD into...
      	(c_keyword_starts_typename): ...this new function.
      	(c_parser_declaration_or_fndef): When issuing errors about
      	missing "struct" etc, add a fixit.  For other kinds of errors,
      	attempt to provide a suggestion via lookup_name_fuzzy.
      	(c_parser_parms_declarator): When looking ahead to detect typos in
      	type names, also reject CPP_KEYWORD.
      	(c_parser_parameter_declaration): When issuing errors about
      	unknown type names, attempt to provide a suggestion via
      	lookup_name_fuzzy.
      	* c-tree.h (c_keyword_starts_typename): New prototype.
      
      gcc/ChangeLog:
      	PR c/70339
      	* diagnostic-core.h (pedwarn_at_rich_loc): New prototype.
      	* diagnostic.c (pedwarn_at_rich_loc): New function.
      	* spellcheck.h (best_match::best_match): Add a
      	"best_distance_so_far" optional parameter.
      	(best_match::set_best_so_far): New method.
      	(best_match::get_best_distance): New accessor.
      	(best_match::get_best_candidate_length): New accessor.
      
      gcc/testsuite/ChangeLog:
      	PR c/70339
      	* c-c++-common/attributes-1.c: Update dg-prune-output to include
      	hint.
      	* gcc.dg/diagnostic-token-ranges.c (undeclared_identifier): Update
      	expected results due to builtin "nanl" now being suggested for
      	"name".
      	* gcc.dg/pr67580.c: Update expected messages.
      	* gcc.dg/spellcheck-identifiers.c: New testcase.
      	* gcc.dg/spellcheck-typenames.c: New testcase.
      
      From-SVN: r237714
      1a4f11c8
  29. Jan 04, 2016
  30. Nov 06, 2015
    • David Malcolm's avatar
      Reimplement diagnostic_show_locus, introducing rich_location classes · 8a645150
      David Malcolm authored
      gcc/ChangeLog:
      	* diagnostic-color.c (color_dict): Eliminate "caret"; add "range1"
      	and "range2".
      	(parse_gcc_colors): Update comment to describe default GCC_COLORS.
      	* diagnostic-core.h (warning_at_rich_loc): New declaration.
      	(error_at_rich_loc): New declaration.
      	(permerror_at_rich_loc): New declaration.
      	(inform_at_rich_loc): New declaration.
      	* diagnostic-show-locus.c (adjust_line): Delete.
      	(struct point_state): New struct.
      	(class colorizer): New class.
      	(class layout_point): New class.
      	(class layout_range): New class.
      	(struct line_bounds): New.
      	(class layout): New class.
      	(colorizer::colorizer): New ctor.
      	(colorizer::~colorizer): New dtor.
      	(layout::layout): New ctor.
      	(layout::print_source_line): New method.
      	(layout::print_annotation_line): New method.
      	(layout::get_state_at_point): New method.
      	(layout::get_x_bound_for_row): New method.
      	(diagnostic_show_locus): Reimplement in terms of class layout.
      	(diagnostic_print_caret_line): Delete.
      	* diagnostic.c (diagnostic_initialize): Replace
      	MAX_LOCATIONS_PER_MESSAGE with rich_location::MAX_RANGES.
      	(diagnostic_set_info_translated): Convert param from location_t
      	to rich_location *.  Eliminate calls to set_location on the
      	message in favor of storing the rich_location ptr there.
      	(diagnostic_set_info): Convert param from location_t to
      	rich_location *.
      	(diagnostic_build_prefix): Break out array into...
      	(diagnostic_kind_color): New variable.
      	(diagnostic_get_color_for_kind): New function.
      	(diagnostic_report_diagnostic): Colorize the option_text
      	using the color for the severity.
      	(diagnostic_append_note): Update for change in signature of
      	diagnostic_set_info.
      	(diagnostic_append_note_at_rich_loc): New function.
      	(emit_diagnostic): Update for change in signature of
      	diagnostic_set_info.
      	(inform): Likewise.
      	(inform_at_rich_loc): New function.
      	(inform_n): Update for change in signature of diagnostic_set_info.
      	(warning): Likewise.
      	(warning_at): Likewise.
      	(warning_at_rich_loc): New function.
      	(warning_n): Update for change in signature of diagnostic_set_info.
      	(pedwarn): Likewise.
      	(permerror): Likewise.
      	(permerror_at_rich_loc): New function.
      	(error): Update for change in signature of diagnostic_set_info.
      	(error_n): Likewise.
      	(error_at): Likewise.
      	(error_at_rich_loc): New function.
      	(sorry): Update for change in signature of diagnostic_set_info.
      	(fatal_error): Likewise.
      	(internal_error): Likewise.
      	(internal_error_no_backtrace): Likewise.
      	(source_range::debug): New function.
      	* diagnostic.h (struct diagnostic_info): Eliminate field
      	"override_column".  Add field "richloc".
      	(struct diagnostic_context): Add field "colorize_source_p".
      	(diagnostic_override_column): Delete.
      	(diagnostic_set_info): Convert param from location_t to
      	rich_location *.
      	(diagnostic_set_info_translated): Likewise.
      	(diagnostic_append_note_at_rich_loc): New function.
      	(diagnostic_num_locations): New function.
      	(diagnostic_expand_location): Get the location from the
      	rich_location.
      	(diagnostic_print_caret_line): Delete.
      	(diagnostic_get_color_for_kind): New declaration.
      	* genmatch.c (linemap_client_expand_location_to_spelling_point): New.
      	(error_cb): Update for change in signature of "error" callback.
      	(fatal_at): Likewise.
      	(warning_at): Likewise.
      	* input.c (linemap_client_expand_location_to_spelling_point): New.
      	* pretty-print.c (text_info::set_range): New method.
      	(text_info::get_location): New method.
      	* pretty-print.h (MAX_LOCATIONS_PER_MESSAGE): Eliminate this macro.
      	(struct text_info): Eliminate "locations" array in favor of
      	"m_richloc", a rich_location *.
      	(textinfo::set_location): Add a "caret_p" param, and reimplement
      	in terms of a call to set_range.
      	(textinfo::get_location): Eliminate inline implementation in favor of
      	an out-of-line reimplementation.
      	(textinfo::set_range): New method.
      	* rtl-error.c (diagnostic_for_asm): Update for change in signature
      	of diagnostic_set_info.
      	* tree-diagnostic.c (default_tree_printer): Update for new
      	"caret_p" param for textinfo::set_location.
      	* tree-pretty-print.c (percent_K_format): Likewise.
      
      gcc/c-family/ChangeLog:
      	* c-common.c (c_cpp_error): Convert parameter from location_t to
      	rich_location *.  Eliminate the "column_override" parameter and
      	the call to diagnostic_override_column.
      	Update the "done_lexing" clause to set range 0
      	on the rich_location, rather than overwriting a location_t.
      	* c-common.h (c_cpp_error): Convert parameter from location_t to
      	rich_location *.  Eliminate the "column_override" parameter.
      
      gcc/c/ChangeLog:
      	* c-decl.c (warn_defaults_to): Update for change in signature
      	of diagnostic_set_info.
      	* c-errors.c (pedwarn_c99): Likewise.
      	(pedwarn_c90): Likewise.
      	* c-objc-common.c (c_tree_printer): Update for new "caret_p" param
      	for textinfo::set_location.
      
      gcc/cp/ChangeLog:
      	* error.c (cp_printer): Update for new "caret_p" param for
      	textinfo::set_location.
      	(pedwarn_cxx98): Update for change in signature of
      	diagnostic_set_info.
      
      gcc/fortran/ChangeLog:
      	* cpp.c (cb_cpp_error): Convert parameter from location_t to
      	rich_location *.  Eliminate the "column_override" parameter.
      	* error.c (gfc_warning): Update for change in signature of
      	diagnostic_set_info.
      	(gfc_format_decoder): Update handling of %C/%L for changes
      	to struct text_info.
      	(gfc_diagnostic_starter): Use richloc when determining whether to
      	print one locus or two.  When handling a location that will
      	involve a call to diagnostic_show_locus, only attempt to print the
      	locus for the primary location, and don't call into
      	diagnostic_print_caret_line.
      	(gfc_warning_now_at): Update for change in signature of
      	diagnostic_set_info.
      	(gfc_warning_now): Likewise.
      	(gfc_error_now): Likewise.
      	(gfc_fatal_error): Likewise.
      	(gfc_error): Likewise.
      	(gfc_internal_error): Likewise.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: New file.
      	* gcc.dg/plugin/diagnostic-test-show-locus-color.c: New file.
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: New file.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above.
      	* lib/gcc-dg.exp: Load multiline.exp.
      
      libcpp/ChangeLog:
      	* errors.c (cpp_diagnostic): Update for change in signature
      	of "error" callback.
      	(cpp_diagnostic_with_line): Likewise, calling override_column
      	on the rich_location.
      	* include/cpplib.h (struct cpp_callbacks): Within "error"
      	callback, convert param from source_location to rich_location *,
      	and drop column_override param.
      	* include/line-map.h (struct source_range): New struct.
      	(struct location_range): New struct.
      	(class rich_location): New class.
      	(linemap_client_expand_location_to_spelling_point): New declaration.
      	* line-map.c (rich_location::rich_location): New ctors.
      	(rich_location::lazily_expand_location): New method.
      	(rich_location::override_column): New method.
      	(rich_location::add_range): New methods.
      	(rich_location::set_range): New method.
      
      From-SVN: r229884
      8a645150
  31. Oct 28, 2015
    • Mikhail Maltsev's avatar
      [PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE · b2b29377
      Mikhail Maltsev authored
      [PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
      gcc/lto/ChangeLog:
      2015-10-27  Mikhail Maltsev  <maltsevm@gmail.com>
      
      	* lto.c (unify_scc): Use flag_checking and remove ENABLE_CHECKING
      	conditionals.
      	(lto_fixup_state): Likewise.
      	(do_whole_program_analysis): Use
      	symtab_node::checking_verify_symtab_nodes and remove ENABLE_CHECKING
      	conditionals.
      
      gcc/ChangeLog:
      
      2015-10-27  Mikhail Maltsev  <maltsevm@gmail.com>
      
      	* attribs.c (check_attribute_tables): New function, broken out from...
      	(init_attributes): Use it.
      	* cfgcleanup.c (try_optimize_cfg): Use flag_checking, CHECKING_P
      	gcc_checking_assert and checking_* functions to eliminate
      	ENABLE_CHECKING conditionals.
      	* cfgexpand.c (expand_goto, expand_debug_expr): Likewise.
      	(pass_expand::execute): Likewise.
      	* cgraphclones.c (symbol_table::materialize_all_clones): Likewise.
      	* cgraphunit.c (mark_functions_to_output): Likewise.
      	(cgraph_node::expand_thunk): Likewise.
      	(symbol_table::compile): Likewise.
      	* ddg.c (add_cross_iteration_register_deps): Likewise.
      	(create_ddg_all_sccs): Likewise.
      	* df-core.c (df_finish_pass, df_analyze): Likewise.
      	* diagnostic-core.h: Likewise.
      	* diagnostic.c (diagnostic_report_diagnostic): Likewise.
      	* dominance.c (calculate_dominance_info): Likewise.
      	* dwarf2out.c (add_AT_die_ref): Likewise.
      	(const_ok_for_output_1, mem_loc_descriptor): Likewise.
      	(loc_list_from_tree, gen_lexical_block_die): Likewise.
      	gen_type_die_with_usage, gen_type_die): Likewise.
      	(dwarf2out_decl): Likewise.
      	* emit-rtl.c (verify_rtx_sharing, reorder_insns_nobb): Likewise.
      	* except.c (duplicate_eh_regions): Likewise.
      	* fwprop.c (register_active_defs, update_df_init): Likewise.
      	(fwprop_init, fwprop_done): Likewise.
      	(update_uses): Likewise.
      	* ggc-page.c (ggc_grow): Likewise.
      	* gimplify.c (gimplify_body): Likewise.
      	(gimplify_hasher::equal): Likewise.
      	* graphite-isl-ast-to-gimple.c (graphite_verify): Likewise.
      	* graphite-scop-detection.c (canonicalize_loop_closed_ssa_form):
      	Likewise.
      	* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Likewise.
      	(rewrite_cross_bb_scalar_deps_out_of_ssa): Likwise.
      	* hash-table.h (::find_empty_slot_for_expand): Likewise.
      	* ifcvt.c (if_convert): Likewise.
      	* ipa-cp.c (ipcp_propagate_stage): Likewise.
      	* ipa-devirt.c (type_in_anonymous_namespace_p): Likewise.
      	(odr_type_p, odr_types_equivalent_p): Likewise.
      	(add_type_duplicate, get_odr_type): Likewise.
      	* ipa-icf.c (sem_item_optimizer::execute): Likewise.
      	(sem_item_optimizer::subdivide_classes_by_equality): Likewise.
      	(sem_item_optimizer::verify_classes): Likewise.
      	(sem_item_optimizer::traverse_congruence_split): Likewise.
      	(sem_item_optimizer::checking_verify_classes): New.
      	* ipa-icf.h (sem_item_optimizer::checking_verify_classes): Add new
      	method.
      	* cfgrtl.c (commit_edge_insertions): Likewise.
      	(fixup_reorder_chain, cfg_layout_finalize): Likewise.
      	(rtl_flow_call_edges_add): Likewise.
      	* cgraph.c (symbol_table::create_edge): Likewise.
      	(cgraph_edge::redirect_call_stmt_to_callee): Likewise.
      	* cgraph.h (symtab_node): Likewise.
      	(symtab_node::checking_verify_symtab_nodes): Define.
      	(cgraph_node::checking_verify_cgraph_nodes): Define.
      	* cfghooks.h (checking_verify_flow_info): Define.
      	* cfgloop.h (checking_verify_loop_structure): Define.
      	* dominance.h (checking_verify_dominators): Define.
      	* et-forest.c: Fix comment.
      	* ipa-inline-analysis.c (compute_inline_parameters): Use flag_checking,
      	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
      	ENABLE_CHECKING conditionals.
      	* ipa-inline-transform.c (save_inline_function_body): Likewise.
      	* ipa-inline.c (inline_small_functions): Likewise.
      	(early_inliner): Likewise.
      	* ipa-inline.h (estimate_edge_growth): Likewise.
      	* ipa-visibility.c (function_and_variable_visibility): Likewise.
      	* ipa.c (symbol_table::remove_unreachable_nodes): Likewise.
      	(ipa_single_use): Likewise.
      	* ira-int.h: Likewise.
      	* ira.c (ira): Likewise.
      	* loop-doloop.c (doloop_optimize_loops): Likewise.
      	* loop-init.c (loop_optimizer_init, fix_loop_structure): Likewise.
      	* loop-invariant.c (move_loop_invariants): Likewise.
      	* lra-assigns.c (lra_assign): Likewise.
      	* lra-constraints.c (lra_constraints): Likewise.
      	* lra-eliminations.c (lra_eliminate): Likewise.
      	* lra-int.h (struct lra_reg): Likewise.
      	* lra-lives.c (check_pseudos_live_through_calls): Likewise.
      	(lra_create_live_ranges_1): Likewise.
      	* lra-remat.c (create_remat_bb_data): Likewise.
      	* lra.c (lra_update_insn_recog_data, restore_scratches): Likewise.
      	(lra): Likewise.
      	(check_rtl): Always define. Remove incorrect guard around
      	extract_constrain_insn call.
      	* lto-cgraph.c (input_cgraph_1: Use flag_checking,
      	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
      	ENABLE_CHECKING conditionals.
      	* lto-streamer-out.c (DFS::DFS): Likewise.
      	(lto_output): Likewise.
      	* lto-streamer.c (lto_streamer_init): Likewise.
      	* omp-low.c (scan_omp_target, expand_omp_taskreg): Likewise.
      	expand_omp_target, execute_expand_omp): Likewise.
      	(lower_omp_target): Likewise.
      	* passes.c (execute_function_todo): Likewise.
      	(execute_todo, execute_one_pass): Likewise.
      	(verify_curr_properties): Always define.
      	* predict.c (tree_estimate_probability: Use flag_checking,
      	CHECKING_P gcc_checking_assert and checking_* functions to eliminate
      	ENABLE_CHECKING conditionals.
      	(propagate_freq): Likewise.
      	* pretty-print.c (pp_format): Likewise.
      	* real.c (real_to_decimal_for_mode): Likewise.
      	* recog.c (split_all_insns): Likewise.
      	* regcprop.c (kill_value_one_regno): Likewise.
      	(copy_value): Likewise.
      	(validate_value_data): Define unconditionally.
      	* reload.c: Fix comment.
      	* timevar.c: Include options.h
      	* tree-ssa.h (checking_verify_ssa): Define.
      	* tree-ssa-loop-manip.h (checking_verify_loop_closed_ssa): Define.
      	* sched-deps.c (CHECK): Remove unused macro.
      	(add_or_update_dep_1, sd_add_dep: Use flag_checking, CHECKING_P
      	gcc_checking_assert and checking_* functions to eliminate
      	ENABLE_CHECKING conditionals.
      	* sel-sched-ir.c (free_regset_pool, tidy_control_flow): Likewise.
      	* sel-sched.c (struct moveop_static_params): Likewise.
      	(find_best_reg_for_expr, move_cond_jump): Likewise.
      	(move_op_orig_expr_not_found): Likewise.
      	(code_motion_process_successors, move_op): Likewise.
      	* ssa-iterators.h (first_readonly_imm_use): Likewise.
      	(next_readonly_imm_use): Likewise.
      	* store-motion.c (compute_store_table): Likewise.
      	* symbol-summary.h (function_summary::function_summary): Likewise.
      	* target.h (cumulative_args_t): Likewise.
      	(get_cumulative_args, pack_cumulative_args): Likewise.
      	* timevar.c: (timer::print): Likewise.
      	* trans-mem.c (ipa_tm_execute): Likewise.
      	* tree-cfg.c (move_stmt_op): Likewise.
      	(move_sese_region_to_fn): Likewise.
      	(gimple_flow_call_edges_add): Likewise.
      	* tree-cfgcleanup.c (cleanup_tree_cfg_noloop, repair_loop_structures):
      	Likewise.
      	* tree-eh.c (remove_unreachable_handlers): Likewise.
      	* tree-if-conv.c (pass_if_conversion::execute): Likewise.
      	* tree-inline.c (expand_call_inline, optimize_inline_calls): Likewise.
      	* tree-into-ssa.c (update_ssa): Likewise.
      	* tree-loop-distribution.c (pass_loop_distribution::execute): Likewise.
      	* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees): Likewise.
      	* tree-parloops.c (pass_parallelize_loops::execute): Likewise.
      	* tree-predcom.c (suitable_component_p): Likewise.
      	* tree-profile.c (gimple_gen_const_delta_profiler): Likewise.
      	* tree-ssa-alias.c (refs_may_alias_p_1): Likewise.
      	* tree-ssa-live.c (verify_live_on_entry): Likewise.
      	* tree-ssa-live.h (register_ssa_partition): Likewise.
      	* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Likewise.
      	* tree-ssa-loop-manip.c (add_exit_phi): Likewise.
      	(tree_transform_and_unroll_loop): Likewise.
      	* tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
      	* tree-ssa-operands.c (get_expr_operands): Likewise.
      	* tree-ssa-propagate.c (replace_exp_1): Likewise.
      	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
      	* tree-ssa-ter.c (free_temp_expr_table): Likewise.
      	* tree-ssa-threadupdate.c (duplicate_thread_path): Likewise.
      	* tree-ssanames.c (release_ssa_name_fn): Likewise.
      	* tree-stdarg.c (expand_ifn_va_arg): Likewise.
      	* tree-vect-loop-manip.c
      	(slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
      	(slpeel_checking_verify_cfg_after_peeling): Likewise.
      	(vect_do_peeling_for_loop_bound): Likewise.
      	(vect_do_peeling_for_alignment): Likewise.
      	* tree-vrp.c (supports_overflow_infinity): Likewise.
      	(set_value_range): Likewise.
      	* tree.c (free_lang_data_in_cgraph): Likewise.
      	* value-prof.c (gimple_remove_histogram_value): Likewise.
      	(free_hist): Likewise.
      	* var-tracking.c (canonicalize_values_star): Likewise.
      	(compute_bb_dataflow, vt_find_locations, vt_emit_notes): Likewise.
      
      From-SVN: r229470
      b2b29377
  32. Jun 17, 2015
    • Andrew MacLeod's avatar
      coretypes.h: Include input.h and as-a.h. · abb226c9
      Andrew MacLeod authored
      2015-06-17  Andrew MacLeod  <amacleod@redhat.com>
      
      	* coretypes.h: Include input.h and as-a.h.
      	* rtl.h: Include input.h and as-a.h for generator files.
      	* hwint.c: Include input.h.
      	* vec.c: Include input.h.
      	* alias.c: Do not include input.h, line-map.h or is-a.h.
      	* asan.c: Likewise.
      	* attribs.c: Likewise.
      	* auto-inc-dec.c: Likewise.
      	* auto-profile.c: Likewise.
      	* bb-reorder.c: Likewise.
      	* bt-load.c: Likewise.
      	* builtins.c: Likewise.
      	* caller-save.c: Likewise.
      	* calls.c: Likewise.
      	* ccmp.c: Likewise.
      	* cfg.c: Likewise.
      	* cfganal.c: Likewise.
      	* cfgbuild.c: Likewise.
      	* cfgcleanup.c: Likewise.
      	* cfgexpand.c: Likewise.
      	* cfghooks.c: Likewise.
      	* cfgloop.c: Likewise.
      	* cfgloop.h: Likewise.
      	* cfgloopanal.c: Likewise.
      	* cfgloopmanip.c: Likewise.
      	* cfgrtl.c: Likewise.
      	* cgraph.c: Likewise.
      	* cgraphbuild.c: Likewise.
      	* cgraphclones.c: Likewise.
      	* cgraphunit.c: Likewise.
      	* cilk-common.c: Likewise.
      	* combine-stack-adj.c: Likewise.
      	* combine.c: Likewise.
      	* compare-elim.c: Likewise.
      	* convert.c: Likewise.
      	* coverage.c: Likewise.
      	* cppbuiltin.c: Likewise.
      	* cprop.c: Likewise.
      	* cse.c: Likewise.
      	* cselib.c: Likewise.
      	* data-streamer-in.c: Likewise.
      	* data-streamer-out.c: Likewise.
      	* data-streamer.c: Likewise.
      	* dbxout.c: Likewise.
      	* dce.c: Likewise.
      	* ddg.c: Likewise.
      	* debug.c: Likewise.
      	* df-core.c: Likewise.
      	* df-problems.c: Likewise.
      	* df-scan.c: Likewise.
      	* df.h: Likewise.
      	* dfp.c: Likewise.
      	* diagnostic-core.h: Likewise.
      	* diagnostic.c: Likewise.
      	* dojump.c: Likewise.
      	* dominance.c: Likewise.
      	* domwalk.c: Likewise.
      	* double-int.c: Likewise.
      	* dse.c: Likewise.
      	* dumpfile.c: Likewise.
      	* dumpfile.h: Likewise.
      	* dwarf2asm.c: Likewise.
      	* dwarf2cfi.c: Likewise.
      	* dwarf2out.c: Likewise.
      	* emit-rtl.c: Likewise.
      	* et-forest.c: Likewise.
      	* except.c: Likewise.
      	* explow.c: Likewise.
      	* expmed.c: Likewise.
      	* expr.c: Likewise.
      	* final.c: Likewise.
      	* fixed-value.c: Likewise.
      	* fold-const.c: Likewise.
      	* function.c: Likewise.
      	* fwprop.c: Likewise.
      	* gcc-plugin.h: Likewise.
      	* gcse.c: Likewise.
      	* generic-match-head.c: Likewise.
      	* ggc-page.c: Likewise.
      	* gimple-builder.c: Likewise.
      	* gimple-expr.c: Likewise.
      	* gimple-fold.c: Likewise.
      	* gimple-iterator.c: Likewise.
      	* gimple-low.c: Likewise.
      	* gimple-match-head.c: Likewise.
      	* gimple-pretty-print.c: Likewise.
      	* gimple-ssa-isolate-paths.c: Likewise.
      	* gimple-ssa-strength-reduction.c: Likewise.
      	* gimple-streamer-in.c: Likewise.
      	* gimple-streamer-out.c: Likewise.
      	* gimple-streamer.h: Likewise.
      	* gimple-walk.c: Likewise.
      	* gimple.c: Likewise.
      	* gimplify-me.c: Likewise.
      	* gimplify.c: Likewise.
      	* godump.c: Likewise.
      	* graph.c: Likewise.
      	* graphite-blocking.c: Likewise.
      	* graphite-dependences.c: Likewise.
      	* graphite-interchange.c: Likewise.
      	* graphite-isl-ast-to-gimple.c: Likewise.
      	* graphite-optimize-isl.c: Likewise.
      	* graphite-poly.c: Likewise.
      	* graphite-scop-detection.c: Likewise.
      	* graphite-sese-to-poly.c: Likewise.
      	* graphite.c: Likewise.
      	* haifa-sched.c: Likewise.
      	* hw-doloop.c: Likewise.
      	* ifcvt.c: Likewise.
      	* init-regs.c: Likewise.
      	* input.c: Likewise.
      	* internal-fn.c: Likewise.
      	* ipa-chkp.c: Likewise.
      	* ipa-comdats.c: Likewise.
      	* ipa-cp.c: Likewise.
      	* ipa-devirt.c: Likewise.
      	* ipa-icf-gimple.c: Likewise.
      	* ipa-icf.c: Likewise.
      	* ipa-inline-analysis.c: Likewise.
      	* ipa-inline-transform.c: Likewise.
      	* ipa-inline.c: Likewise.
      	* ipa-polymorphic-call.c: Likewise.
      	* ipa-profile.c: Likewise.
      	* ipa-prop.c: Likewise.
      	* ipa-pure-const.c: Likewise.
      	* ipa-ref.c: Likewise.
      	* ipa-reference.c: Likewise.
      	* ipa-split.c: Likewise.
      	* ipa-utils.c: Likewise.
      	* ipa-visibility.c: Likewise.
      	* ipa.c: Likewise.
      	* ira-build.c: Likewise.
      	* ira-color.c: Likewise.
      	* ira-conflicts.c: Likewise.
      	* ira-costs.c: Likewise.
      	* ira-emit.c: Likewise.
      	* ira-lives.c: Likewise.
      	* ira.c: Likewise.
      	* jump.c: Likewise.
      	* langhooks.c: Likewise.
      	* lcm.c: Likewise.
      	* loop-doloop.c: Likewise.
      	* loop-init.c: Likewise.
      	* loop-invariant.c: Likewise.
      	* loop-iv.c: Likewise.
      	* loop-unroll.c: Likewise.
      	* lower-subreg.c: Likewise.
      	* lra-assigns.c: Likewise.
      	* lra-coalesce.c: Likewise.
      	* lra-constraints.c: Likewise.
      	* lra-eliminations.c: Likewise.
      	* lra-lives.c: Likewise.
      	* lra-remat.c: Likewise.
      	* lra-spills.c: Likewise.
      	* lra.c: Likewise.
      	* lto-cgraph.c: Likewise.
      	* lto-compress.c: Likewise.
      	* lto-opts.c: Likewise.
      	* lto-section-in.c: Likewise.
      	* lto-section-out.c: Likewise.
      	* lto-streamer-in.c: Likewise.
      	* lto-streamer-out.c: Likewise.
      	* lto-streamer.c: Likewise.
      	* mcf.c: Likewise.
      	* mode-switching.c: Likewise.
      	* modulo-sched.c: Likewise.
      	* omega.c: Likewise.
      	* omp-low.c: Likewise.
      	* optabs.c: Likewise.
      	* opts-global.c: Likewise.
      	* opts.h: Likewise.
      	* passes.c: Likewise.
      	* plugin.c: Likewise.
      	* postreload-gcse.c: Likewise.
      	* postreload.c: Likewise.
      	* predict.c: Likewise.
      	* pretty-print.h: Likewise.
      	* print-rtl.c: Likewise.
      	* print-tree.c: Likewise.
      	* profile.c: Likewise.
      	* real.c: Likewise.
      	* realmpfr.c: Likewise.
      	* recog.c: Likewise.
      	* ree.c: Likewise.
      	* reg-stack.c: Likewise.
      	* regcprop.c: Likewise.
      	* reginfo.c: Likewise.
      	* regrename.c: Likewise.
      	* regstat.c: Likewise.
      	* reload.c: Likewise.
      	* reload1.c: Likewise.
      	* reorg.c: Likewise.
      	* resource.c: Likewise.
      	* rtl-chkp.c: Likewise.
      	* rtl-error.c: Likewise.
      	* rtlanal.c: Likewise.
      	* rtlhooks.c: Likewise.
      	* sanopt.c: Likewise.
      	* sched-deps.c: Likewise.
      	* sched-ebb.c: Likewise.
      	* sched-rgn.c: Likewise.
      	* sched-vis.c: Likewise.
      	* sdbout.c: Likewise.
      	* sel-sched-dump.c: Likewise.
      	* sel-sched-ir.c: Likewise.
      	* sel-sched.c: Likewise.
      	* sese.c: Likewise.
      	* shrink-wrap.c: Likewise.
      	* simplify-rtx.c: Likewise.
      	* stack-ptr-mod.c: Likewise.
      	* statistics.c: Likewise.
      	* stmt.c: Likewise.
      	* stor-layout.c: Likewise.
      	* store-motion.c: Likewise.
      	* streamer-hooks.c: Likewise.
      	* stringpool.c: Likewise.
      	* symtab.c: Likewise.
      	* target-globals.c: Likewise.
      	* targhooks.c: Likewise.
      	* toplev.c: Likewise.
      	* tracer.c: Likewise.
      	* trans-mem.c: Likewise.
      	* tree-affine.c: Likewise.
      	* tree-browser.c: Likewise.
      	* tree-call-cdce.c: Likewise.
      	* tree-cfg.c: Likewise.
      	* tree-cfgcleanup.c: Likewise.
      	* tree-chkp-opt.c: Likewise.
      	* tree-chkp.c: Likewise.
      	* tree-chrec.c: Likewise.
      	* tree-complex.c: Likewise.
      	* tree-data-ref.c: Likewise.
      	* tree-dfa.c: Likewise.
      	* tree-diagnostic.c: Likewise.
      	* tree-dump.c: Likewise.
      	* tree-eh.c: Likewise.
      	* tree-emutls.c: Likewise.
      	* tree-if-conv.c: Likewise.
      	* tree-inline.c: Likewise.
      	* tree-into-ssa.c: Likewise.
      	* tree-iterator.c: Likewise.
      	* tree-loop-distribution.c: Likewise.
      	* tree-nested.c: Likewise.
      	* tree-nrv.c: Likewise.
      	* tree-object-size.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-profile.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-copy.c: Likewise.
      	* tree-ssa-copyrename.c: Likewise.
      	* tree-ssa-dce.c: Likewise.
      	* tree-ssa-dom.c: Likewise.
      	* tree-ssa-dse.c: Likewise.
      	* tree-ssa-forwprop.c: Likewise.
      	* tree-ssa-ifcombine.c: Likewise.
      	* tree-ssa-live.c: Likewise.
      	* tree-ssa-loop-ch.c: 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-loop-unswitch.c: Likewise.
      	* tree-ssa-loop.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-scopedtables.c: Likewise.
      	* tree-ssa-sink.c: Likewise.
      	* tree-ssa-strlen.c: Likewise.
      	* tree-ssa-structalias.c: Likewise.
      	* tree-ssa-tail-merge.c: Likewise.
      	* tree-ssa-ter.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-switch-conversion.c: Likewise.
      	* tree-tailcall.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-vrp.c: Likewise.
      	* tree.c: Likewise.
      	* tsan.c: Likewise.
      	* ubsan.c: Likewise.
      	* valtrack.c: Likewise.
      	* value-prof.c: Likewise.
      	* var-tracking.c: Likewise.
      	* varasm.c: Likewise.
      	* varpool.c: Likewise.
      	* vmsdbgout.c: Likewise.
      	* vtable-verify.c: Likewise.
      	* web.c: Likewise.
      	* wide-int.cc: Likewise.
      	* xcoffout.c: Likewise.
      	* config/aarch64/aarch64-builtins.c: Likewise.
      	* config/aarch64/aarch64.c: Likewise.
      	* config/alpha/alpha.c: Likewise.
      	* config/arc/arc.c: Likewise.
      	* config/arm/aarch-common.c: Likewise.
      	* config/arm/arm-builtins.c: Likewise.
      	* config/arm/arm-c.c: Likewise.
      	* config/arm/arm.c: Likewise.
      	* config/avr/avr-c.c: Likewise.
      	* config/avr/avr-log.c: Likewise.
      	* config/avr/avr.c: Likewise.
      	* config/bfin/bfin.c: Likewise.
      	* config/c6x/c6x.c: Likewise.
      	* config/cr16/cr16.c: Likewise.
      	* config/cris/cris.c: Likewise.
      	* config/darwin-c.c: Likewise.
      	* config/darwin.c: Likewise.
      	* config/default-c.c: Likewise.
      	* config/epiphany/epiphany.c: Likewise.
      	* config/epiphany/mode-switch-use.c: Likewise.
      	* config/epiphany/resolve-sw-modes.c: Likewise.
      	* config/fr30/fr30.c: Likewise.
      	* config/frv/frv.c: Likewise.
      	* config/ft32/ft32.c: Likewise.
      	* config/glibc-c.c: Likewise.
      	* config/h8300/h8300.c: Likewise.
      	* config/i386/i386-c.c: Likewise.
      	* config/i386/i386.c: Likewise.
      	* config/i386/msformat-c.c: Likewise.
      	* config/i386/winnt-cxx.c: Likewise.
      	* config/i386/winnt-stubs.c: Likewise.
      	* config/i386/winnt.c: Likewise.
      	* config/ia64/ia64-c.c: Likewise.
      	* config/ia64/ia64.c: Likewise.
      	* config/iq2000/iq2000.c: Likewise.
      	* config/lm32/lm32.c: Likewise.
      	* config/m32c/m32c-pragma.c: Likewise.
      	* config/m32c/m32c.c: Likewise.
      	* config/m32r/m32r.c: Likewise.
      	* config/m68k/m68k.c: Likewise.
      	* config/mcore/mcore.c: Likewise.
      	* config/mep/mep-pragma.c: Likewise.
      	* config/mep/mep.c: Likewise.
      	* config/microblaze/microblaze-c.c: Likewise.
      	* config/microblaze/microblaze.c: Likewise.
      	* config/mips/mips.c: Likewise.
      	* config/mmix/mmix.c: Likewise.
      	* config/mn10300/mn10300.c: Likewise.
      	* config/moxie/moxie.c: Likewise.
      	* config/msp430/msp430-c.c: Likewise.
      	* config/msp430/msp430.c: Likewise.
      	* config/nds32/nds32-cost.c: Likewise.
      	* config/nds32/nds32-fp-as-gp.c: Likewise.
      	* config/nds32/nds32-intrinsic.c: Likewise.
      	* config/nds32/nds32-isr.c: Likewise.
      	* config/nds32/nds32-md-auxiliary.c: Likewise.
      	* config/nds32/nds32-memory-manipulation.c: Likewise.
      	* config/nds32/nds32-pipelines-auxiliary.c: Likewise.
      	* config/nds32/nds32-predicates.c: Likewise.
      	* config/nds32/nds32.c: Likewise.
      	* config/nios2/nios2.c: Likewise.
      	* config/nvptx/nvptx.c: Likewise.
      	* config/pa/pa.c: Likewise.
      	* config/pdp11/pdp11.c: Likewise.
      	* config/rl78/rl78-c.c: Likewise.
      	* config/rl78/rl78.c: Likewise.
      	* config/rs6000/rs6000-c.c: Likewise.
      	* config/rs6000/rs6000.c: Likewise.
      	* config/rx/rx.c: Likewise.
      	* config/s390/s390-c.c: Likewise.
      	* config/s390/s390.c: Likewise.
      	* config/sh/sh-c.c: Likewise.
      	* config/sh/sh-mem.cc: Likewise.
      	* config/sh/sh.c: Likewise.
      	* config/sh/sh_optimize_sett_clrt.cc: Likewise.
      	* config/sh/sh_treg_combine.cc: Likewise.
      	* config/sol2-c.c: Likewise.
      	* config/sol2-cxx.c: Likewise.
      	* config/sol2-stubs.c: Likewise.
      	* config/sol2.c: Likewise.
      	* config/sparc/sparc-c.c: Likewise.
      	* config/sparc/sparc.c: Likewise.
      	* config/spu/spu-c.c: Likewise.
      	* config/spu/spu.c: Likewise.
      	* config/stormy16/stormy16.c: Likewise.
      	* config/tilegx/mul-tables.c: Likewise.
      	* config/tilegx/tilegx-c.c: Likewise.
      	* config/tilegx/tilegx.c: Likewise.
      	* config/tilepro/mul-tables.c: Likewise.
      	* config/tilepro/tilepro-c.c: Likewise.
      	* config/tilepro/tilepro.c: Likewise.
      	* config/v850/v850-c.c: Likewise.
      	* config/v850/v850.c: Likewise.
      	* config/vax/vax.c: Likewise.
      	* config/visium/visium.c: Likewise.
      	* config/vms/vms-c.c: Likewise.
      	* config/vms/vms.c: Likewise.
      	* config/vxworks.c: Likewise.
      	* config/winnt-c.c: Likewise.
      	* config/xtensa/xtensa.c: Likewise.
      
      ada
      	* ada/gcc-interface/cuintp.c: Do not include input.h, line-map.h or
      	is-a.h.
      	* ada/gcc-interface/decl.c: Likewise.
      	* ada/gcc-interface/misc.c: Likewise.
      	* ada/gcc-interface/targtyps.c: Likewise.
      	* ada/gcc-interface/trans.c: Likewise.
      	* ada/gcc-interface/utils.c: Likewise.
      	* ada/gcc-interface/utils2.c: Likewise.
      
      c
      	* c/c-array-notation.c: Do not include input.h, line-map.h or is-a.h.
      	* c/c-aux-info.c: Likewise.
      	* c/c-convert.c: Likewise.
      	* c/c-decl.c: Likewise.
      	* c/c-errors.c: Likewise.
      	* c/c-lang.c: Likewise.
      	* c/c-objc-common.c: Likewise.
      	* c/c-parser.c: Likewise.
      	* c/c-typeck.c: Likewise.
      
      c-family
      	* c-family/array-notation-common.c: Do not include input.h, line-map.h
      	or is-a.h.
      	* c-family/c-ada-spec.c: Likewise.
      	* c-family/c-cilkplus.c: Likewise.
      	* c-family/c-common.c: Likewise.
      	* c-family/c-common.h: Likewise.
      	* c-family/c-cppbuiltin.c: Likewise.
      	* c-family/c-dump.c: Likewise.
      	* c-family/c-format.c: Likewise.
      	* c-family/c-gimplify.c: Likewise.
      	* c-family/c-indentation.c: Likewise.
      	* c-family/c-lex.c: Likewise.
      	* c-family/c-omp.c: Likewise.
      	* c-family/c-opts.c: Likewise.
      	* c-family/c-pch.c: Likewise.
      	* c-family/c-ppoutput.c: Likewise.
      	* c-family/c-pragma.c: Likewise.
      	* c-family/c-pretty-print.c: Likewise.
      	* c-family/c-semantics.c: Likewise.
      	* c-family/c-ubsan.c: Likewise.
      	* c-family/cilk.c: Likewise.
      	* c-family/stub-objc.c: Likewise.
      
      common
      	* common/common-target.h: Do not include input.h, line-map.h or is-a.h.
      	* common/common-targhooks.c: Likewise.
      
      cp
      	* cp/call.c: Do not include input.h, line-map.h or is-a.h.
      	* cp/class.c: Likewise.
      	* cp/constexpr.c: Likewise.
      	* cp/cp-array-notation.c: Likewise.
      	* cp/cp-gimplify.c: Likewise.
      	* cp/cp-lang.c: Likewise.
      	* cp/cp-objcp-common.c: Likewise.
      	* cp/cp-tree.h: Likewise.
      	* cp/cp-ubsan.c: Likewise.
      	* cp/cvt.c: Likewise.
      	* cp/decl.c: Likewise.
      	* cp/decl2.c: Likewise.
      	* cp/dump.c: Likewise.
      	* cp/error.c: Likewise.
      	* cp/except.c: Likewise.
      	* cp/expr.c: Likewise.
      	* cp/friend.c: Likewise.
      	* cp/init.c: Likewise.
      	* cp/lambda.c: Likewise.
      	* cp/lex.c: Likewise.
      	* cp/mangle.c: Likewise.
      	* cp/method.c: Likewise.
      	* cp/name-lookup.c: Likewise.
      	* cp/optimize.c: Likewise.
      	* cp/parser.c: Likewise.
      	* cp/pt.c: Likewise.
      	* cp/ptree.c: Likewise.
      	* cp/repo.c: Likewise.
      	* cp/rtti.c: Likewise.
      	* cp/search.c: Likewise.
      	* cp/semantics.c: Likewise.
      	* cp/tree.c: Likewise.
      	* cp/typeck.c: Likewise.
      	* cp/typeck2.c: Likewise.
      	* cp/vtable-class-hierarchy.c: Likewise.
      
      fortran
      	* fortran/convert.c: Do not include input.h, line-map.h or is-a.h.
      	* fortran/cpp.c: Likewise.
      	* fortran/decl.c: Likewise.
      	* fortran/f95-lang.c: Likewise.
      	* fortran/gfortran.h: Likewise.
      	* fortran/iresolve.c: Likewise.
      	* fortran/match.c: Likewise.
      	* fortran/module.c: Likewise.
      	* fortran/options.c: Likewise.
      	* fortran/target-memory.c: Likewise.
      	* fortran/trans-array.c: Likewise.
      	* fortran/trans-common.c: Likewise.
      	* fortran/trans-const.c: Likewise.
      	* fortran/trans-decl.c: Likewise.
      	* fortran/trans-expr.c: Likewise.
      	* fortran/trans-intrinsic.c: Likewise.
      	* fortran/trans-io.c: Likewise.
      	* fortran/trans-openmp.c: Likewise.
      	* fortran/trans-stmt.c: Likewise.
      	* fortran/trans-types.c: Likewise.
      	* fortran/trans.c: Likewise.
      
      go
      	* go/go-backend.c: Do not include input.h, line-map.h or is-a.h.
      	* go/go-gcc.cc: Likewise.
      	* go/go-lang.c: Likewise.
      	* go/go-system.h: Likewise.
      
      java
      	* java/boehm.c: Do not include input.h, line-map.h or is-a.h.
      	* java/builtins.c: Likewise.
      	* java/class.c: Likewise.
      	* java/constants.c: Likewise.
      	* java/decl.c: Likewise.
      	* java/except.c: Likewise.
      	* java/expr.c: Likewise.
      	* java/java-gimplify.c: Likewise.
      	* java/jcf-dump.c: Likewise.
      	* java/jcf-io.c: Likewise.
      	* java/jcf-parse.c: Likewise.
      	* java/jvgenmain.c: Likewise.
      	* java/lang.c: Likewise.
      	* java/mangle.c: Likewise.
      	* java/mangle_name.c: Likewise.
      	* java/resource.c: Likewise.
      	* java/typeck.c: Likewise.
      	* java/verify-glue.c: Likewise.
      	* java/verify-impl.c: Likewise.
      
      jit
      	* jit/dummy-frontend.c: Do not include input.h, line-map.h or is-a.h.
      	* jit/jit-common.h: Likewise.
      	* jit/jit-playback.c: Likewise.
      
      lto
      	* lto/lto-lang.c: Do not include input.h, line-map.h or is-a.h.
      	* lto/lto-object.c: Likewise.
      	* lto/lto-partition.c: Likewise.
      	* lto/lto-symtab.c: Likewise.
      	* lto/lto.c: Likewise.
      
      objc
      	* objc/objc-act.c: Do not include input.h, line-map.h or is-a.h.
      	* objc/objc-encoding.c: Likewise.
      	* objc/objc-gnu-runtime-abi-01.c: Likewise.
      	* objc/objc-lang.c: Likewise.
      	* objc/objc-map.c: Likewise.
      	* objc/objc-next-runtime-abi-01.c: Likewise.
      	* objc/objc-next-runtime-abi-02.c: Likewise.
      	* objc/objc-runtime-shared-support.c: Likewise.
      
      objcp
      	* objcp/objcp-decl.c: Do not include input.h, line-map.h or is-a.h.
      	* objcp/objcp-lang.c: Likewise.
      
      From-SVN: r224562
      abb226c9
  33. Jan 30, 2015
    • Joseph Myers's avatar
      Always pass explicit location to fatal_error. · 40fecdd6
      Joseph Myers authored
      The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html>
      adding an overload for fatal_error that passes an explicit location
      broke gcc.pot regeneration because xgettext cannot handle function
      overloads with the diagnostic string argument in different positions.
      
      As the desired direction is for all diagnostics to have explicit
      locations, this patch addresses the regression by removing the version
      of fatal_error that does not pass a location, passing explicit
      input_location everywhere (in the hope that those will incrementally
      be changed to other locations, much as with the addition of a location
      argument to pedwarn some time ago - a lot of cases aren't meaningfully
      associated with a source file so UNKNOWN_LOCATION may be better).
      
      Note that this patch does not attempt to fix any existing issues with
      these diagnostics (such as wrongly starting with capital letters or
      ending with '.' or '\n'); it just adds the input_location argument.
      
      Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go
      excluded).
      
      gcc:
      	* diagnostic.c (fatal_error (const char *, ...)): Remove function.
      	* diagnostic-core.h (fatal_error (const char *, ...)): Remove
      	prototype.
      	* toplev.h (init_asm_output): Update comment on use of
      	UNKNOWN_LOCATION with fatal_error.
      	* cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c,
      	config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h,
      	config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c,
      	config/i386/intelmic-mkoffload.c, config/nios2/nios2.c,
      	config/nvptx/mkoffload.c, config/nvptx/nvptx.h,
      	config/rs6000/host-darwin.c, config/rs6000/rs6000.c,
      	config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c,
      	ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c,
      	lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c,
      	lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c,
      	tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of
      	fatal_error changed to pass input_location as first argument.
      
      gcc/c-family:
      	* c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed
      	to pass input_location as first argument.
      
      gcc/cp:
      	* class.c, except.c, parser.c, pt.c: All callers of fatal_error
      	changed to pass input_location as first argument.
      
      gcc/fortran:
      	* f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All
      	callers of fatal_error changed to pass input_location as first
      	argument.
      
      gcc/java:
      	* class.c, expr.c, jcf-parse.c, jvspec.c: All callers of
      	fatal_error changed to pass input_location as first argument.
      
      gcc/lto:
      	* lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
      	changed to pass input_location as first argument.
      
      libcc1:
      	* plugin.cc: All callers of fatal_error changed to pass
      	input_location as first argument.
      
      From-SVN: r220293
      40fecdd6
  34. Jan 23, 2015
    • Jakub Jelinek's avatar
      diagnostic-core.h (internal_error_no_backtrace): New prototype. · b55f40c1
      Jakub Jelinek authored
      	* diagnostic-core.h (internal_error_no_backtrace): New prototype.
      	* diagnostic.def (DK_ICE_NOBT): New kind.
      	* diagnostic.c (diagnostic_action_after_output): Handle DK_ICE_NOBT
      	like DK_ICE, but never print backtrace.
      	(diagnostic_report_diagnostic): Handle DK_ICE_NOBT like DK_ICE.
      	(internal_error_no_backtrace): New function.
      	* gcc.c (execute): Use internal_error_no_backtrace instead of
      	internal_error.
      fortran/
      	* gfc-diagnostic.def (DK_ICE_NOBT): New kind.
      
      From-SVN: r220030
      b55f40c1
  35. Jan 05, 2015
  36. Nov 11, 2014
    • Anthony Brandon's avatar
      re PR driver/36312 (should refuse to overwrite input file with output file) · 3d00119c
      Anthony Brandon authored
      
      gcc/testsuite/ChangeLog:
      
      2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
      	    Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	PR driver/36312
      	* gcc.misc-tests/output.exp: New test case for identical input and
      	output files.
      
      include/ChangeLog:
      
      2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
      	    Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	PR driver/36312
      	* filenames.h: Add prototype for canonical_filename_eq.
      
      gcc/ChangeLog:
      
      2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
      	    Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	PR driver/36312
      	* diagnostic-core.h: Add prototype for fatal_error.
      	* diagnostic.c (fatal_error): New function fatal_error.
      	* gcc.c (store_arg): Remove have_o_argbuf_index.
      	(process_command): Check if input and output files are the same.
      	* toplev.c (init_asm_output): Check if input and output files are
      	the same.
      
      libiberty/ChangeLog:
      
      2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
      	    Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	PR driver/36312
      	* filename_cmp.c (canonical_filename_eq): New function to check if
      	file names are the same.
      	* functions.texi: Updated with documentation for new function.
      
      Co-Authored-By: default avatarManuel López-Ibáñez <manu@gcc.gnu.org>
      
      From-SVN: r217391
      3d00119c
  37. Nov 05, 2014
    • Manuel López-Ibáñez's avatar
      Revert revision 217149 because it breaks Ada: · 10a24138
      Manuel López-Ibáñez authored
      gcc/testsuite/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
              PR driver/36312
              * gcc.misc-tests/output.exp: New test case for identical input and
              output files.
      
      include/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
              PR driver/36312
              * filenames.h: Add prototype for canonical_filename_eq.
      
      gcc/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
              PR driver/36312
              * diagnostic-core.h: Add prototype for fatal_error.
              * diagnostic.c (fatal_error): New function fatal_error.
              * gcc.c (store_arg): Remove have_o_argbuf_index.
              (process_command): Check if input and output files are the same.
              * toplev.c (init_asm_output): Check if input and output files are
              the same.
      
      libiberty/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
              PR driver/36312
              * filename_cmp.c (canonical_filename_eq): New function to check if
              file names are the same.
              * functions.texi: Updated with documentation for new function.
      
      From-SVN: r217159
      10a24138
    • Anthony Brandon's avatar
      re PR driver/36312 (should refuse to overwrite input file with output file) · 9c7a77fc
      Anthony Brandon authored
      gcc/testsuite/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
      	PR driver/36312
      	* gcc.misc-tests/output.exp: New test case for identical input and
      	output files.
      
      include/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
      	PR driver/36312
      	* filenames.h: Add prototype for canonical_filename_eq.
      
      gcc/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
      	PR driver/36312
      	* diagnostic-core.h: Add prototype for fatal_error.
      	* diagnostic.c (fatal_error): New function fatal_error.
      	* gcc.c (store_arg): Remove have_o_argbuf_index.
      	(process_command): Check if input and output files are the same.
      	* toplev.c (init_asm_output): Check if input and output files are
      	the same.
      
      libiberty/ChangeLog:
      
      2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>
      
      	PR driver/36312
      	* filename_cmp.c (canonical_filename_eq): New function to check if
      	file names are the same.
      	* functions.texi: Updated with documentation for new function.
      
      From-SVN: r217149
      9c7a77fc
  38. Sep 20, 2014
    • Jan Hubicka's avatar
      diagnostic.c (warning_n): New function. · 26e82579
      Jan Hubicka authored
      	* diagnostic.c (warning_n): New function.
      	* diagnostic-core.h (warning_n): Declare.
      	* ipa-devirt.c (ipa_devirt): Handle singulars correctly;
      	output dynamic counts when available.
      
      From-SVN: r215416
      26e82579
  39. Jan 02, 2014
Loading