aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer
AgeCommit message (Collapse)AuthorFilesLines
4 hoursDaily bump.HEADtrunkmasterGCC Administrator1-0/+38
10 hoursdiagnostics: add support for directed graphs; use them for state graphsDavid Malcolm10-455/+415
In r16-1631-g2334d30cd8feac I added support for capturing state information from -fanalyzer in XML form, and adding a way to visualize these states in HTML output. The data was optionally captured in SARIF output (with "xml-state=yes"), stashing the XML in string form in a property bag. This worked, but there was no way to round-trip the stored data back from SARIF without adding an XML parser to GCC, which I don't want to do. SARIF supports capturing directed graphs, so this patch: (a) adds a new namespace diagnostics::digraphs, with classes digraph, node, and edge, representing directed graphs in a form similar to what SARIF can serialize (b) adds support to GCC's diagnostic subsystem for reporting graphs, either "globally" or as part of a diagnostic. An example in a testsuite plugin emits an error that has a couple of dummy graphs associated with it, and captures the optimization passes as a digraph "globally". Graphs are ignored by text sinks, but are captured by sarif sinks, and the "experimental-html" sink gains SVG-based rendering of any graphs using dot. This HTML output is rather crude; an example can be seen here: https://dmalcolm.fedorapeople.org/gcc/2025-07-10/diagnostic-test-graphs-html.c.html (c) adds support to libgdiagnostics for the above (d) adds support to sarif-replay for the above (round-tripping any graph information) (e) replaces the XML representation of state with a representation based on the above directed graphs, using property bags to stash additional information (e.g. "this is an on-stack buffer") (f) implements round-tripping of this information in sarif-replay To summarize: - previously we could generate HTML diagrams for debugging -fanalyzer directly from gcc, but not from stored .sarif output. - with this patch, we can generate such HTML diagrams both directly *and* from stored .sarif output (provided the SARIF sink was created with "state-graphs=yes") Examples of HTML output can be seen here: https://dmalcolm.fedorapeople.org/gcc/2025-07-10/ where as before j/k can be used to cycle through the events. which is almost identical to the output from the old XML-based implementation seen at: https://dmalcolm.fedorapeople.org/gcc/2025-06-23/ gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Add diagnostic-digraphs.o and diagnostic-state-graphs.o. gcc/ChangeLog: * diagnostic-format-html.cc: Include "diagnostic-format-sarif.h", Replace include of "diagnostic-state.h" with includes of "diagnostic-digraphs.h" and "diagnostic-state-graphs.h". (html_generation_options::html_generation_options): Update for field renaming. (html_builder::m_body_element): New field. (html_builder::html_builder): Initialize m_body_element. (html_builder::maybe_make_state_diagram): Port from XML implementation to state graph implementation. (html_builder::make_element_for_diagnostic): Add any per-diagnostic graphs. (html_builder::add_graph): New. (html_builder::emit_global_graph): New. (html_output_format::report_global_digraph): New. * diagnostic-format-html.h (html_generation_options::m_show_state_diagram_xml): Replace with... (html_generation_options::m_show_state_diagrams_sarif): ...this. (html_generation_options::m_show_state_diagram_dot_src): Rename to... (html_generation_options::m_show_state_diagrams_dot_src): ...this. * diagnostic-format-sarif.cc: Include "diagnostic-digraphs.h" and "diagnostic-state-graphs.h". (sarif_builder::m_run_graphs): New field. (sarif_result::on_nested_diagnostic): Update call to make_location_object to pass arg by pointer. (sarif_builder::sarif_builder): Initialize m_run_graphs. (sarif_builder::report_global_digraph): New. (sarif_builder::make_result_object): Add any graphs to the result object. (sarif_builder::make_locations_arr): Update call to make_location_object to pass arg by pointer. (sarif_builder::make_location_object): Pass param "loc_mgr" by pointer rather than by reference so that it can be null, and handle this case. (copy_any_property_bag): New. (make_sarif_graph): New. (make_sarif_node): New. (make_sarif_edge): New. (sarif_property_bag::set_graph): New. (populate_thread_flow_location_object): Port from XML implementation to state graph implementation. (make_run_object): Store any graphs. (sarif_output_format::report_global_digraph): New. (sarif_generation_options::sarif_generation_options): Rename m_xml_state to m_state_graph. (selftest::test_make_location_object): Update for change to make_location_object. * diagnostic-format-sarif.h: (sarif_generation_options::m_xml_state): Replace with... (sarif_generation_options::m_state_graph): ...this. (class sarif_location_manager): Add forward decl. (diagnostics::digraphs::digraph): New forward decl. (diagnostics::digraphs::node): New forward decl. (diagnostics::digraphs::edge): New forward decl. (sarif_property_bag::set_graph): New decl. (class sarif_graph): New. (class sarif_node): New. (class sarif_edge): New. (make_sarif_graph): New decl. (make_sarif_node): New decl. (make_sarif_edge): New decl. * diagnostic-format-text.h (diagnostic_text_output_format::report_global_digraph): New. * diagnostic-format.h (diagnostic_output_format::report_global_digraph): New vfunc. * diagnostic-digraphs.cc: New file. * diagnostic-digraphs.h: New file. * diagnostic-metadata.h (diagnostics::digraphs::lazy_digraphs): New forward decl. (diagnostic_metadata::diagnostic_metadata): Initialize m_lazy_digraphs. (diagnostic_metadata::set_lazy_digraphs): New. (diagnostic_metadata::get_lazy_digraphs): New. (diagnostic_metadata::m_lazy_digraphs): New field. * diagnostic-output-spec.cc (sarif_scheme_handler::make_sink): Update for XML to state graph changes. (sarif_scheme_handler::make_sarif_gen_opts): Likewise. (html_scheme_handler::make_sink): Rename "show-state-diagram-xml" to "show-state-diagrams-sarif" and use pluralization consistently. * diagnostic-path.cc: Replace include of "xml.h" with "diagnostic-state-graphs.h". (diagnostic_event::maybe_make_xml_state): Replace with... (diagnostic_event::maybe_make_diagnostic_state_graph): ...this. * diagnostic-path.h (diagnostics::digraphs::digraph): New forward decl. (diagnostic_event::maybe_make_xml_state): Replace with... (diagnostic_event::maybe_make_diagnostic_state_graph): ...this. * diagnostic-state-graphs.cc: New file. * diagnostic-state-graphs.h: New file. * diagnostic-state-to-dot.cc: Port implementation from XML to state graphs. * diagnostic-state.h: Deleted file. * diagnostic.cc (diagnostic_context::report_global_digraph): New. * diagnostic.h (diagnostics::digraphs::lazy_digraph): New forward decl. (diagnostic_context::report_global_digraph): New decl. * doc/analyzer.texi (Debugging the Analyzer): Update to reflect change from XML to state graphs. * doc/invoke.texi ("sarif" diagnostics sink): Replace "xml-state" with "state-graphs". ("experimental-html" diagnostics sink): Replace "show-state-diagrams-xml" with "show-state-diagrams-sarif" * doc/libgdiagnostics/topics/compatibility.rst (LIBGDIAGNOSTICS_ABI_3): New. * doc/libgdiagnostics/topics/graphs.rst: New file. * doc/libgdiagnostics/topics/index.rst: Add graphs.rst. * graphviz.h (node_id::operator=): New. * json.h (json::value::dyn_cast_string): New. (json::object::get_num_keys): New accessor. (json::object::get_key): New accessor. (json::string::dyn_cast_string): New. * libgdiagnostics++.h (class libgdiagnostics::graph): New. (class libgdiagnostics::node): New. (class libgdiagnostics::edge): New. (class libgdiagnostics::diagnostic::take_graph): New. (class libgdiagnostics::manager::take_global_graph): New. (class libgdiagnostics::graph::set_description): New. (class libgdiagnostics::graph::get_node_by_id): New. (class libgdiagnostics::graph::get_edge_by_id): New. (class libgdiagnostics::graph::add_edge): New. (class libgdiagnostics::node::set_label): New. (class libgdiagnostics::node::set_location): New. (class libgdiagnostics::node::set_logical_location): New. * libgdiagnostics-private.h: New file. * libgdiagnostics.cc: Define INCLUDE_STRING. Include "diagnostic-digraphs.h", "diagnostic-state-graphs.h", and "libgdiagnostics-private.h". (struct diagnostic_graph): New. (struct diagnostic_node): New. (struct diagnostic_edge): New. (libgdiagnostics_path_event::libgdiagnostics_path_event): Add state_graph param. (libgdiagnostics_path_event::maybe_make_diagnostic_state_graph): New. (libgdiagnostics_path_event::m_state_graph): New field. (diagnostic_execution_path::add_event_va): Add state_graph param. (class prebuilt_digraphs): New. (diagnostic::diagnostic): Use m_graphs in m_metadata. (diagnostic::take_graph): New. (diagnostic::get_graphs): New accessor. (diagnostic::m_graphs): New field. (diagnostic_manager::take_global_graph): New. (diagnostic_execution_path_add_event): Update for new param to add_event_va. (diagnostic_execution_path_add_event_va): Likewise. (diagnostic_graph::add_node_with_id): New public entrypoint. (diagnostic_graph::add_edge_with_label): New public entrypoint. (diagnostic_manager_new_graph): New public entrypoint. (diagnostic_manager_take_global_graph): New public entrypoint. (diagnostic_take_graph): New public entrypoint. (diagnostic_graph_release): New public entrypoint. (diagnostic_graph_set_description): New public entrypoint. (diagnostic_graph_add_node): New public entrypoint. (diagnostic_graph_add_edge): New public entrypoint. (diagnostic_graph_get_node_by_id): New public entrypoint. (diagnostic_graph_get_edge_by_id): New public entrypoint. (diagnostic_node_set_location): New public entrypoint. (diagnostic_node_set_label): New public entrypoint. (diagnostic_node_set_logical_location): New public entrypoint. (private_diagnostic_execution_path_add_event_2): New private entrypoint. (private_diagnostic_graph_set_property_bag): New private entrypoint. (private_diagnostic_node_set_property_bag): New private entrypoint. (private_diagnostic_edge_set_property_bag): New private entrypoint. * libgdiagnostics.h (diagnostic_graph): New typedef. (diagnostic_node): New typedef. (diagnostic_edge): New typedef. (diagnostic_manager_new_graph): New decl. (diagnostic_manager_take_global_graph): New decl. (diagnostic_take_graph): New decl. (diagnostic_graph_release): New decl. (diagnostic_graph_set_description): New decl. (diagnostic_graph_add_node): New decl. (diagnostic_graph_add_edge): New decl. (diagnostic_graph_get_node_by_id): New decl. (diagnostic_graph_get_edge_by_id): New decl. (diagnostic_node_set_label): New decl. (diagnostic_node_set_location): New decl. (diagnostic_node_set_logical_location): New decl. * libgdiagnostics.map (LIBGDIAGNOSTICS_ABI_3): New. * libsarifreplay.cc: Include "libgdiagnostics-private.h". (id_map): New "using". (sarif_replayer::report_invalid_sarif): Update for change to report_problem params. (sarif_replayer::report_unhandled_sarif): Likewise. (sarif_replayer::report_note): New. (sarif_replayer::report_problem): Pass param "ref" by pointer rather than reference and handle it being null. (sarif_replayer::maybe_get_property_bag): New. (sarif_replayer::maybe_get_property_bag_value): New. (sarif_replayer::handle_run_obj): Handle run-level "graphs" as per §3.14.20. (sarif_replayer::handle_result_obj): Handle result-level "graphs" as per §3.27.19. (handle_thread_flow_location_object): Optionally handle graphs stored in property "gcc/diagnostic_event/state_graph" as state graphs. (sarif_replayer::handle_graph_object): New. (sarif_replayer::handle_node_object): New. (sarif_replayer::handle_edge_object): New. (sarif_replayer::get_graph_node_by_id_property): New. * selftest-run-tests.cc (selftest::run_tests): Call selftest::diagnostic_graph_cc_tests and selftest::diagnostic_state_graph_cc_tests. * selftest.h (selftest::diagnostic_graph_cc_tests): New decl. (selftest::diagnostic_state_graph_cc_tests): New decl. gcc/analyzer/ChangeLog: * ana-state-to-diagnostic-state.cc: Reimplement, replacing XML-based implementation with one based on state graphs. * ana-state-to-diagnostic-state.h: Likewise. * checker-event.cc: Replace include of "xml.h" with include of "diagnostic-state-graphs.h". (checker_event::maybe_make_xml_state): Replace with... (checker_event::maybe_make_diagnostic_state_graph): ...this. * checker-event.h: Add include of "diagnostic-digraphs.h". (checker_event::maybe_make_xml_state): Replace decl with... (checker_event::maybe_make_diagnostic_state_graph): ...this. * engine.cc (exploded_node::on_stmt_pre): Replace "_analyzer_dump_xml" with "__analyzer_dump_sarif". * program-state.cc: Replace include of "diagnostic-state.h" with "diagnostic-state-graphs.h". (program_state::dump_dot): Port from XML to state graphs. * program-state.h: Drop reduntant forward decl of xml::document. (program_state::make_xml): Replace decl with... (program_state::make_diagnostic_state_graph): ...this. (program_state::dump_xml_to_pp): Drop decl. (program_state::dump_xml_to_file): Drop decl. (program_state::dump_xml): Drop decl. (program_state::dump_dump_sarif): New decl. * sm-malloc.cc (get_dynalloc_state_for_state): New. (malloc_state_machine::add_state_to_xml): Replace with... (malloc_state_machine::add_state_to_state_graph): ...this. * sm.cc (state_machine::add_state_to_xml): Replace with... (state_machine::add_state_to_state_graph): ...this. (state_machine::add_global_state_to_xml): Replace with... (state_machine::add_global_state_to_state_graph): ...this. * sm.h (class xml_state): Drop forward decl. (class analyzer_state_graph): New forward decl. (state_machine::add_state_to_xml): Replace decl with... (state_machine::add_state_to_state_graph): ...this. (state_machine::add_global_state_to_xml): Replace decl with... (state_machine::add_global_state_to_state_graph): ...this. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/state-diagram-1-sarif.py (test_xml_state): Rename to... (test_state_graph): ...this. Port from XML to SARIF graphs. * gcc.dg/analyzer/state-diagram-1.c: Update sink option from "sarif:xml-state=yes" to "sarif:state-graphs=yes". * gcc.dg/analyzer/state-diagram-5-sarif.c: Likewise. * gcc.dg/analyzer/state-diagram-5-sarif.py: Drop import of ET. (test_nested_types_in_xml_state): Rename to... (test_nested_types_in_state_graph): ...this. Port from XML to SARIF graphs. * gcc.dg/plugin/diagnostic-test-graphs-html.c: New test. * gcc.dg/plugin/diagnostic-test-graphs-html.py: New test script. * gcc.dg/plugin/diagnostic-test-graphs-sarif.c: New test. * gcc.dg/plugin/diagnostic-test-graphs-sarif.py: New test script. * gcc.dg/plugin/diagnostic-test-graphs.c: New test. * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: New test plugin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. * lib/sarif.py (get_xml_state): Delete. (get_state_graph): New. (def get_state_node_attr): New. (get_state_node_kind): New. (get_state_node_name): New. (get_state_node_type): New. (get_state_node_value): New. * sarif-replay.dg/2.1.0-invalid/3.40.2-duplicate-node-id.sarif: New test. * sarif-replay.dg/2.1.0-invalid/3.41.4-unrecognized-node-id.sarif: New test. * sarif-replay.dg/2.1.0-valid/graphs-check-html.py: New test script. * sarif-replay.dg/2.1.0-valid/graphs-check-sarif-roundtrip.py: New test script. * sarif-replay.dg/2.1.0-valid/graphs.sarif: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
11 daysDaily bump.GCC Administrator1-0/+88
11 daysanalyzer: use nullptr rather than NULLDavid Malcolm53-846/+855
Modernization; no functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc: Use nullptr rather than NULL where appropriate. * analyzer-language.cc: Likewise. * analyzer-language.h: Likewise. * analyzer-logging.h: Likewise. * analyzer-pass.cc: Likewise. * analyzer.cc: Likewise. * bounds-checking.cc: Likewise. * call-details.cc: Likewise. * call-string.cc: Likewise. * call-string.h: Likewise. * call-summary.cc: Likewise. * checker-event.cc: Likewise. * common.h: Likewise. * constraint-manager.cc: Likewise. * constraint-manager.h: Likewise. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * exploded-graph.h: Likewise. * function-set.cc: Likewise * infinite-recursion.cc: Likewise * inlining-iterator.h: Likewise * kf.cc: Likewise * known-function-manager.cc: Likewise * pending-diagnostic.cc: Likewise * program-point.cc: Likewise * program-point.h: Likewise * program-state.cc: Likewise * program-state.h: Likewise * record-layout.cc: Likewise * region-model-asm.cc: Likewise * region-model-manager.cc: Likewise * region-model-manager.h: Likewise * region-model-reachability.cc: Likewise * region-model.cc: Likewise * region-model.h: Likewise * region.cc: Likewise * region.h: Likewise * sm-fd.cc: Likewise * sm-malloc.cc: Likewise * sm-pattern-test.cc: Likewise * sm-signal.cc: Likewise * sm-taint.cc: Likewise * sm.cc: Likewise * sm.h: Likewise * state-purge.cc: Likewise * state-purge.h: Likewise * store.cc: Likewise * store.h: Likewise * supergraph.cc: Likewise * supergraph.h: Likewise * svalue.cc: Likewise * svalue.h: Likewise * varargs.cc: Likewise Signed-off-by: David Malcolm <dmalcolm@redhat.com>
11 daysdiagnostics: convert diagnostic_event::meaning enums to enum classDavid Malcolm7-29/+29
Modernization; no functional change intended. gcc/analyzer/ChangeLog: * checker-event.cc (function_entry_event::get_meaning): Convert diagnostic_event::meaning enums to enum class. (cfg_edge_event::get_meaning): Likewise. (call_event::get_meaning): Likewise. (return_event::get_meaning): Likewise. (start_consolidated_cfg_edges_event::get_meaning): Likewise. (inlined_call_event::get_meaning): Likewise. (warning_event::get_meaning): Likewise. * sm-fd.cc (fd_diagnostic::get_meaning_for_state_change): Likewise. * sm-file.cc (file_diagnostic::get_meaning_for_state_change): Likewise. * sm-malloc.cc (malloc_diagnostic::get_meaning_for_state_change): Likewise. * sm-sensitive.cc (exposure_through_output_file::get_meaning_for_state_change): Likewise. * sm-taint.cc (taint_diagnostic::get_meaning_for_state_change): Likewise. * varargs.cc (va_list_sm_diagnostic::get_meaning_for_state_change): Likewise. gcc/ChangeLog: * diagnostic-format-sarif.cc (sarif_builder::maybe_make_kinds_array): Convert diagnostic_event::meaning enums to enum class. * diagnostic-path-output.cc (path_label::get_text): Likewise. * diagnostic-path.cc (diagnostic_event::meaning::maybe_get_verb_str): Likewise. (diagnostic_event::meaning::maybe_get_noun_str): Likewise. (diagnostic_event::meaning::maybe_get_property_str): Likewise. * diagnostic-path.h (diagnostic_event::verb): Likewise. (diagnostic_event::noun): Likewise. (diagnostic_event::property): Likewise. (diagnostic_event::meaning): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.cc (gil_diagnostic::get_meaning_for_state_change): Convert diagnostic_event::meaning enums to enum class. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
12 daysExtend nonnull_if_nonzero attribute [PR120520]Jakub Jelinek1-4/+12
C2Y voted in the https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3466.pdf paper, which clarifies some of the conditional nonnull cases. For strncat/__strncat_chk no changes are necessary, we already use __attribute__((nonnull (1), nonnull_if_nonzero (2, 3))) attributes on the builtin and glibc can do the same too, meaning that first argument must be nonnull always and second must be nonnull if the third one is nonzero. The problem is with the fread/fwrite changes, where the paper adds: If size or nmemb is zero, +ptr may be a null pointer, fread returns zero and the contents of the array and the state of the stream remain unchanged. and ditto for fwrite, so the two argument nonnull_if_nonzero attribute isn't usable to express that, because whether the pointer can be null depends on 2 integral arguments rather than one. The following patch extends the nonnull_if_nonzero attribute, so that instead of requiring 2 arguments it allows 2 or 3, the first one is still the pointer argument index which sometimes must not be null and the other one or two are integral arguments, if there are 2, the invalid case is only if pointer is null and both the integral arguments are nonzero. 2025-06-30 Jakub Jelinek <jakub@redhat.com> PR c/120520 PR c/117023 gcc/ * builtin-attrs.def (DEF_LIST_INT_INT_INT): Define it and use for 1,2,3. (ATTR_NONNULL_IF123_LIST): New DEF_ATTR_TREE_LIST. (ATTR_NONNULL_4_IF123_LIST): Likewise. * builtins.def (BUILT_IN_FWRITE): Use ATTR_NONNULL_4_IF123_LIST instead of ATTR_NONNULL_LIST. (BUILT_IN_FWRITE_UNLOCKED): Likewise. * gimple.h (infer_nonnull_range_by_attribute): Add another optional tree * argument defaulted to NULL. * gimple.cc (infer_nonnull_range_by_attribute): Add OP3 argument, handle 3 argument nonnull_if_nonzero attribute. * builtins.cc (validate_arglist): Handle 3 argument nonnull_if_nonzero attribute. * tree-ssa-ccp.cc (pass_post_ipa_warn::execute): Likewise. * ubsan.cc (instrument_nonnull_arg): Adjust infer_nonnull_range_by_attribute caller, handle 3 argument nonnull_if_nonzero attribute. * gimple-range-infer.cc (gimple_infer_range::gimple_infer_range): Handle 3 argument nonnull_if_nonzero attribute. * doc/extend.texi (nonnull_if_nonzero): Document 3 argument version of the attribute. gcc/c-family/ * c-attribs.cc (c_common_gnu_attributes): Allow 2 or 3 arguments for nonnull_if_nonzero attribute instead of only 2. (handle_nonnull_if_nonzero_attribute): Handle 3 argument nonnull_if_nonzero. * c-common.cc (struct nonnull_arg_ctx): Rename other member to other1, add other2 member. (check_function_nonnull): Clear a if nonnull attribute has an argument. Adjust for nonnull_arg_ctx changes. Handle 3 argument nonnull_if_nonzero attribute. (check_nonnull_arg): Adjust for nonnull_arg_ctx changes, emit different diagnostics for 3 argument nonnull_if_nonzero attributes. (check_function_arguments): Adjust ctx var initialization. gcc/analyzer/ * sm-malloc.cc (malloc_state_machine::on_stmt): Handle 3 argument nonnull_if_nonzero attribute. gcc/testsuite/ * gcc.dg/nonnull-9.c: Tweak for 3 argument nonnull_if_nonzero attribute support, add further tests. * gcc.dg/nonnull-12.c: New test. * gcc.dg/nonnull-13.c: New test. * gcc.dg/nonnull-14.c: New test. * c-c++-common/ubsan/nonnull-8.c: New test. * c-c++-common/ubsan/nonnull-9.c: New test.
2025-06-24Daily bump.GCC Administrator1-0/+132
2025-06-23analyzer: fix missing "final override"David Malcolm1-1/+1
No functional change intended. gcc/analyzer/ChangeLog: * region-model.cc (exception_thrown_from_unrecognized_call::print): Add "final override" to vfunc. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-06-23diagnostics: add state diagrams to analyzer experimental-html output [PR116792]David Malcolm26-49/+1264
This patch adds various support for debugging diagnostic paths and events, intended initially for myself to help with debugging -fanalyzer. It adds the optional ability for a diagnostic_event to supply a description of the predicted state of the program at that point along the diagnostic_path. To isolate the diagnostic subsystem from the analyzer, this representation is currently an xml::document with custom elements. The XML representation is similar to the analyzer's internal state but can be easier to read - for example, rather than storing the contents of memory via byte offsets, it uses fields for structs and element indexes for arrays, recursively. These states are handled by the HTML and SARIF diagnostic sinks. The SARIF sink simply embeds the XML as a string in a property bag of the threadFlowLocation object (SARIF v2.1.0 section 3.38). For HTML output, the "experimental-html" sink gains a new "show-state-diagrams=yes" option i.e.: -fdiagnostics-add-output=experimental-html:show-state-diagrams=yes which converts the state XML into SVG diagrams visualizing the state of memory at each event, inspired by the "ddd" debugger. These can be seen by pressing 'j' and 'k' to single-step forward and backward through events, making it *much* easier to debug -fanalyzer. An example of output can be seen here: https://dmalcolm.fedorapeople.org/gcc/2025-06-23/state-diagram-1.c.html showing an issue in a singly-linked list; there are various other examples in the parent directory. Generating the SVG diagrams requires an invocation of "dot" per event, so it noticeable slows down diagnostic emission, hence the opt-in command-line flag. However, I'm already finding bugs in -fanalyzer with this that I hadn't seen before. Given that the UI is rather clunky and there is lots of room for improvement to the visualizations, for now this feature is marked as being for GCC developers, not end-users. The patch also adds a dot::ast_node class hierarachy to make it easy to create GraphViz dot files with the correct escaping, and adds a C++ wrapper around pex adding some syntactic sugar for invoking subprocesses. gcc/ChangeLog: PR other/116792 * Makefile.in (ANALYZER_OBJS): Add analyzer/ana-state-to-diagnostic-state.o. (OBJS): Move graphviz.o to... (OBJS-libcommon): ...here. Add diagnostic-state-to-dot.o and pex.o. * diagnostic-format-html.cc: Include "diagnostic-state.h" and "graphviz.h". (html_generation_options::html_generation_options): Initialize the new flags. (HTML_SCRIPT): Add function "get_any_state_diagram". Use it when changing current focus id to update the visibility of the pertinent diagram, if any. (print_pre_source): New. (html_builder::maybe_make_state_diagram): New. (html_path_label_writer::html_path_label_writer): Add "path" param. Initialize m_path and m_curr_event_id. (html_path_label_writer::begin_label): Store current event id. (html_path_label_writer::end_label): Attempt to make a state diagram and add it if successful. (html_path_label_writer::get_element_id): New. (html_path_label_writer::m_path): New field. (html_path_label_writer::m_curr_event_id): New field. (html_builder::make_element_for_diagnostic): Pass path to label writer. * diagnostic-format-html.h (html_generation_options::m_show_state_diagrams): New field. (html_generation_options::m_show_state_diagram_xml): New field. (html_generation_options::m_show_state_diagram_dot_src): New field. * diagnostic-format-sarif.cc: Include "xml.h". (populate_thread_flow_location_object): If requested, attempt to generate xml state and add it to the proeprty bag as "gcc/diagnostic_event/xml_state" in xml source form. (sarif_generation_options::sarif_generation_options): Initialize m_xml_state. * diagnostic-format-sarif.h (sarif_generation_options::m_xml_state): New field. * diagnostic-path.cc: Define INCLUDE_MAP. Include "xml.h". (diagnostic_event::maybe_make_xml_state): New. * diagnostic-path.h (class xml::document): New forward decl. (diagnostic_event::maybe_make_xml_state): New vfunc decl. * diagnostic-state-to-dot.cc: New file. * diagnostic-state.h: New file. * digraph.cc: Define INCLUDE_STRING and INCLUDE_VECTOR. * doc/analyzer.texi: Document state diagrams in html output. (__analyzer_dump_dot): New. (__analyzer_dump_xml): New. * doc/invoke.texi (sarif): Add "xml-state" key. (experimental-html): Add keys "show-state-diagrams", "show-state-diagrams-dot-src" and "show-state-diagrams-xml". * graphviz.cc: Define INCLUDE_MAP, INCLUDE_STRING, and INCLUDE_VECTOR. Include "xml.h", "xml-printer.h", "pex.h" and "selftest.h". (graphviz_out::graphviz_out): Extract... (dot::writer::writer): ...this. (graphviz_out::write_indent): Convert to... (dot::writer::write_indent): ...this. (graphviz_out::print): Use get_pp. (graphviz_out::println): Likewise. (graphviz_out::begin_tr): Likewise. (graphviz_out::end_tr): Likewise. (graphviz_out::begin_td): Likewise. (graphviz_out::end_td): Likewise. (graphviz_out::begin_trtd): Likewise. (graphviz_out::end_tdtr): Likewise. (dot::ast_node::dump): New. (dot::id::id): New. (dot::id::print): New. (dot::id::is_identifier_p): New. (dot::kv_pair::print): New. (dot::attr_list::print): New. (dot::stmt_list::print): New. (dot::stmt_list::add_edge): New. (dot::stmt_list::add_attr): New. (dot::graph::print): New. (dot::stmt_with_attr_list::set_label): New. (dot::node_stmt::print): New. (dot::attr_stmt::print): New. (dot::kv_stmt::print): New. (dot::node_id::print): New. (dot::port::print): New. (dot::edge_stmt::print): New. (dot::subgraph::print): New. (dot::make_svg_document_buffer_from_graph): New. (dot::make_svg_from_graph): New. (selftest:test_ids): New. (selftest:test_trivial_graph): New. (selftest:test_layout_example): New. (selftest:graphviz_cc_tests): New. * graphviz.h (xml::node): New forward decl. (class graphviz_out): Split out into... (class dot::writer): ...this new class (struct dot::ast_node): New. (struct dot::id): New. (struct dot::kv_pair): New. (struct dot::attr_list): New. (struct dot::stmt_list): New. (struct dot::graph): New. (struct dot::stmt): New. (struct dot::stmt_with_attr_list): New. (struct dot::node_stmt): New. (struct dot::attr_stmt): New. (struct dot::kv_stmt): New. (enum class dot::compass_pt): New. (struct dot::port): New. (struct dot::node_id): New. (struct dot::edge_stmt): New. (struct dot::subgraph): New. (dot::make_svg_from_graph): New. * opts-diagnostic.cc (sarif_scheme_handler::make_sink): Add "xml-state" flag. (html_scheme_handler::make_sink): Add flags "show-state-diagrams", "show-state-diagram-dot-src", and "show-state-diagram-xml". * pex.cc: New file. * pex.h: New file. * selftest-run-tests.cc (selftest::run_tests): Call graphviz_cc_tests. * selftest.h (selftest::graphviz_cc_tests): New decl. * xml.cc (xml::node_with_children::add_comment): New. (xml::node_with_children::find_child_element): New. (xml::element::get_attr): New. (xml::comment::write_as_xml): New. (selftest::test_printer): Add coverage of find_child_element and get_attr. (selftest::test_comment): New. (selftest::xml_cc_tests): Call test_comment. * xml.h: New forward decls. (xml::node::dyn_cast_text): Use nullptr. (xml::node::dyn_cast_element): New vfunc. (xml::node_with_children::add_comment): New decl. (xml::node_with_children::find_child_element): New decl. (xml::element::dyn_cast_element): New vfunc impl. (xml::element::get_attr): New decl. (struct xml::comment): New xml::node subclass. gcc/analyzer/ChangeLog: PR other/116792 * ana-state-to-diagnostic-state.cc: New file. * ana-state-to-diagnostic-state.h: New file. * checker-event.cc: Include "xml.h". (checker_event::checker_event): Initialize m_path. (checker_event::prepare_for_emission): Store the path pointer into m_path. (checker_event::maybe_make_xml_state): New. (function_entry_event::function_entry_event): Add "state" param and use it to initialize m_state. (superedge_event::get_program_state): New. (call_event::get_program_state): New. (warning_event::get_program_state): New. * checker-event.h (checker_event::get_program_state): New vfunc. (checker_event::maybe_make_xml_state): New decl. (checker_event::m_path): New field. (statement_event::get_program_state): New vfunc impl. (function_entry_event::function_entry_event): Add "state" param. (function_entry_event::get_program_state): New vfunc impl. (function_entry_event::m_state): New field. (state_change_event::get_program_state): New vfunc impl. (superedge_event::get_program_state): New vfunc decl. (warning_event::warning_event): Add "program_state_" param and copy it. (warning_event::get_program_state): New vfunc decl. (warning_event::m_program_state): New field. * checker-path.h (checker_path::checker_path): Add ext_state param. (checker_path::get_ext_state): New accessor. (checker_path::m_ext_state): New field. * common.h: Define INCLUDE_MAP and INCLUDE_STRING. * diagnostic-manager.cc (saved_diagnostic::operator==): Don't deduplicate dump_path_diagnostic instances. (diagnostic_manager::emit_saved_diagnostic): Pass ext_state to checker_path ctor. * engine.cc: (impl_region_model_context::on_state_leak): Pass old and new state to state_machine::on_leak. (exploded_node::on_stmt_pre): Implement __analyzer_dump_xml and __analyzer_dump_dot. * exploded-graph.h (impl_region_model_context::get_state): New. * infinite-recursion.cc (recursive_function_entry_event::recursive_function_entry_event): Add "dst_state" param and pass to function_entry_event ctor. (infinite_recursion_diagnostic::add_function_entry_event): Pass state to event ctor. * kf-analyzer.cc: Include "analyzer/program-state.h" (dump_path_diagnostic::dump_path_diagnostic): Add "state" param. (dump_path_diagnostic::get_final_state): New. (dump_path_diagnostic::m_state): New field. (kf_analyzer_dump_path::impl_call_pre): Pass state to warning. * pending-diagnostic.cc (pending_diagnostic::add_function_entry_event): Pass state to function_entry_event. (pending_diagnostic::add_final_event): Likewise to warning_event. * pending-diagnostic.h (pending_diagnostic::get_final_state): New vfunc decl. * program-state.cc: Include "diagnostic-state.h", "graphviz.h" and "analyzer/ana-state-to-diagnostic-state.h". (program_state::dump_dot): New. * program-state.h: Include "text-art/tree-widget.h" and "analyzer/store.h". (class xml::document): New forward decl. (make_xml): New. (dump_xml_to_pp): New. (dump_xml_to_file): New. (dump_xml): New. (dump_dot): New. * record-layout.cc (record_layout::record_layout): Make param const_tree. * record-layout.h (item::item): Likewise. (item::m_field): Likewise. (record_layout::record_layout): Likewise. (record_layout::begin): New. (record_layout::end): New. * region-model.cc (exposure_through_uninit_copy::complain_about_fully_uninit_item): Use const_tree. (exposure_through_uninit_copy::complain_about_partially_uninit_item): Likewise. * region-model.h (region_model_context::get_state): New vfunc. (noop_region_model_context::get_state): New. (region_model_context_decorator::get_state): New. * sm-fd.cc (fd_leak::fd_leak): Add "final_state" param and capture it if present. (fd_leak::get_final_state): New. (fd_leak::m_final_state): New. (fd_state_machine::on_open): Pass nullptr for new "final_state" param. (fd_state_machine::on_creat): Likewise. (fd_state_machine::on_socket): Likewise. (fd_state_machine::on_accept): Likewise. (fd_state_machine::on_leak): Add state params and pass new state as final state to fd_leak ctor. * sm-file.cc: Include "analyzer/program-state.h". (file_leak::file_leak): Add "final_state" param and capture it if present. (file_leak::get_final_state): New. (file_leak::m_final_state): New. (fileptr_state_machine::on_leak): Add state params and pass new state as final state to fd_leak ctor. * sm-malloc.cc: Include "analyzer/ana-state-to-diagnostic-state.h". (malloc_leak::malloc_leak): Add "final_state" param and use it. (malloc_leak::get_final_state): New vfunc impl. (malloc_leak::m_final_state): New field. (malloc_state_machine::on_leak): Add state params; capture final state. (malloc_state_machine::add_state_to_xml): New. * sm.cc (state_machine::on_leak): Add "old_state" and "new_state" params. Use nullptr. (state_machine::add_state_to_xml): New. (state_machine::add_global_state_to_xml): New. * sm.h (class xml_state): New forward decl. (state_machine::on_leak): Add state params. (state_machine::add_state_to_xml): New vfunc decl. (state_machine::add_global_state_to_xml): New vfunc decl. * store.h (bit_range::operator<): New. * varargs.cc (va_list_leak::va_list_leak): Add final_state param and capture it if non-null. (va_list_leak::get_final_state): New. (va_list_leak::m_final_state): New. (va_list_state_machine::on_leak): Add state params and pass final state to va_list_leak ctor. gcc/testsuite/ChangeLog: PR other/116792 * g++.dg/analyzer/state-diagram.C: New test. * gcc.dg/analyzer/analyzer-decls.h (__analyzer_dump_dot): New decl. (__analyzer_dump_xml): New decl. * gcc.dg/analyzer/state-diagram-1-sarif.py: New test script. * gcc.dg/analyzer/state-diagram-1.c: New test. * gcc.dg/analyzer/state-diagram-2.c: New test. * gcc.dg/analyzer/state-diagram-3.c: New test. * gcc.dg/analyzer/state-diagram-4.c: New test. * gcc.dg/analyzer/state-diagram-5-html.py: New test script. * gcc.dg/analyzer/state-diagram-5-sarif.py: New test script. * gcc.dg/analyzer/state-diagram-5.c: New test. * gcc.dg/plugin/analyzer_cpython_plugin.cc: Define INCLUDE_STRING. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * lib/htmltest.py (ns): Add SVG namespace. * lib/sarif.py (get_result_by_index): New. (get_xml_state): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-06-19Daily bump.GCC Administrator1-0/+17
2025-06-18analyzer: make checker_event::m_kind privateDavid Malcolm3-16/+19
No functional change intended. gcc/analyzer/ChangeLog: * checker-event.h (checker_event::get_kind): New accessor. (checker_event::m_kind): Make private. * checker-path.cc (checker_path::maybe_log): Use accessor for checker_event::m_kind. (checker_path::add_event): Likewise. (checker_path::debug): Likewise. (checker_path::cfg_edge_pair_at_p): Likewise. (checker_path::inject_any_inlined_call_events): Likewise. * diagnostic-manager.cc (diagnostic_manager::prune_for_sm_diagnostic): Likewise. (diagnostic_manager::prune_for_sm_diagnostic): Likewise. (diagnostic_manager::consolidate_conditions): Likewise. (diagnostic_manager::consolidate_unwind_events): Likewise. (diagnostic_manager::finish_pruning): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-05-07Daily bump.GCC Administrator1-0/+26
2025-05-06diagnostics: add logical_location_manager; reimplement logical_locationDavid Malcolm5-22/+38
Previously we used an abstract base class logical_location with concrete subclasses to separate the diagnostics subsystem from implementation details of "tree" and of libgdiagnostics. This approach required allocating implementation objects on the heap whenever working with logical locations, and made comparing logical locations awkward. This patch reworks things so that the type "logical_location" becomes a boxed pointer (const void *), and client code provides a single object implementing a new logical_location_manager abstract base class. The manager class has responsibility for providing meaning to the boxed pointers. Within the compiler we use a manager in which they are "tree" pointers, whereas within libgdiagnostics we use a manager in which they are pointers to instances of libgdiagnostics' "struct diagnostic_logical_location". Other kinds of manager could be implemented. gcc/analyzer/ChangeLog: * checker-event.cc (checker_event::checker_event): Update initialization of m_logical_loc. (checker_event::maybe_add_sarif_properties): Add "builder" param. Replace call to make_sarif_logical_location_object with call to sarif_property_bag::set_logical_location. (superedge_event::maybe_add_sarif_properties): Add "builder" param. * checker-event.h (checker_event::get_logical_location): Reimplement. (checker_event::maybe_add_sarif_properties): Add "builder" param. (checker_event::maybe_add_sarif_properties): Add "builder" param. (checker_event::m_logical_loc): Convert from tree_logical_location to logical_location. (superedge_event::maybe_add_sarif_properties): Add sarif_builder param. * checker-path.h (checker_path::checker_path): Add logical_loc_mgr param. * diagnostic-manager.cc (diagnostic_manager::emit_saved_diagnostic): Pass logical location manager to emission_path ctor. (diagnostic_manager::get_logical_location_manager): New. * diagnostic-manager.h (diagnostic_manager::get_logical_location_manager): New decl. gcc/ChangeLog: * diagnostic-client-data-hooks.h: Include "logical-location.h". (diagnostic_client_data_hooks::get_logical_location_manager): New. (diagnostic_client_data_hooks::get_current_logical_location): Convert return type from const logical_location * to logical_location. * diagnostic-format-json.cc: Include "diagnostic-client-data-hooks.h". (make_json_for_path): Update to use logical_location_manager from the context. * diagnostic-format-sarif.cc (sarif_builder::get_logical_location_manager): New. (sarif_builder::make_location_object): Update type of logical_loc from "const logical_location *" to "logical_location". (sarif_builder::set_any_logical_locs_arr): Likewise. (sarif_builder::m_logical_loc_mgr): New field. (sarif_result::on_nested_diagnostic): Use logical_location default ctor rather than nullptr. (sarif_builder::sarif_builder): Initialize m_logical_loc_mgr from context's client data hooks. (sarif_builder::make_locations_arr): Convert type of logical_loc from from "const logical_location *" to "logical_location". (sarif_builder::set_any_logical_locs_arr): Likewise. Pass manager to make_sarif_logical_location_object. (sarif_builder::make_location_object): Likewise. (sarif_property_bag::set_logical_location): New. (make_sarif_logical_location_object): Update for introduction of logical_location_manager. (populate_thread_flow_location_object): Pass builder to ev.maybe_add_sarif_properties. (selftest::test_make_location_object): Use logical_location default ctor rather than nullptr. * diagnostic-format-sarif.h (class logical_location): Replace forward decl with include of "logical-location.h". (class sarif_builder): New forward decl. (sarif_property_bag::set_logical_location): New. (make_sarif_logical_location_object): Add "mgr" param. * diagnostic-path.cc (diagnostic_path::get_first_event_in_a_function): Update for change of logical_location type. (per_thread_summary::per_thread_summary): Pass in "logical_loc_mgr". (per_thread_summary::m_logical_loc_mgr): New field. (event_range::m_logical_loc): Update for change of logical_location type. (path_summary::get_logical_location_manager): New accessor. (path_summary::m_logical_loc_mgr): New field. (path_summary::get_or_create_events_for_thread_id): Pass m_logical_loc_mgr to per_thread_summary ctor. (path_summary::path_summary): Initialize m_logical_loc_mgr. (thread_event_printer::print_swimlane_for_event_range): Add param "logical_loc_mgr". Update for change in logical_loc type. (print_path_summary_as_text): Pass manager to thread_event_printer::print_swimlane_for_event_range. (diagnostic_text_output_format::print_path): Update for introduction of logical_location_manager. * diagnostic-path.h: Include "logical-location.h". (class sarif_builder): New forward decl. (diagnostic_event::get_logical_location): Convert return type from "const logical_location *" to "logical_location". (diagnostic_event::maybe_add_sarif_properties): Add sarif_builder param. (diagnostic_path::get_logical_location_manager): New accessor. (diagnostic_path::diagnostic_path): New ctor, taking manager. (diagnostic_path::m_logical_loc_mgr): New field. * diagnostic.cc (diagnostic_context::get_logical_location_manager): New. (logical_location::function_p): Convert to... (logical_location_manager::function_p): ...this. * diagnostic.h (class logical_location): Replace forward decl with... (class logical_location_manager): ...this. (diagnostic_context::get_logical_location_manager): New decl. * lazy-diagnostic-path.cc (selftest::test_lazy_path::test_lazy_path): Pass m_logical_loc_mgr to path ctor. (selftest::test_lazy_path::make_inner_path): Likewise. (selftest::test_lazy_path::m_logical_loc_mgr): New field. * lazy-diagnostic-path.h (lazy_diagnostic_path::lazy_diagnostic_path): New ctor. * libgdiagnostics.cc (struct diagnostic_logical_location): Convert from subclass of logical_location to a plain struct, dropping accessors. (class impl_logical_location_manager): New. (impl_diagnostic_client_data_hooks::get_logical_location_manager): New (impl_diagnostic_client_data_hooks::m_logical_location_manager): New field. (diagnostic_manager::get_logical_location_manager): New. (libgdiagnostics_path_event::get_logical_location): Reimplement. (diagnostic_execution_path::diagnostic_execution_path): Add logical_loc_mgr and pass to base class. (diagnostic_execution_path::same_function_p): Update for change to logical_location type. (diagnostic::add_execution_path): Pass logical_loc_mgr to path ctor. (impl_diagnostic_client_data_hooks::get_current_logical_location): Reimplement. (diagnostic_text_sink::text_starter): Reimplement printing of logical location. (diagnostic_manager::new_execution_path): Pass mgr to path ctor. (diagnostic_manager_debug_dump_logical_location): Update for changes to diagnostic_logical_location. (diagnostic_logical_location_get_kind): Likewise. (diagnostic_logical_location_get_parent): Likewise. (diagnostic_logical_location_get_short_name): Likewise. (diagnostic_logical_location_get_fully_qualified_name): Likewise. (diagnostic_logical_location_get_decorated_name): Likewise. * logical-location.h (class logical_location_manager): New. (class logical_location): Convert to typedef of logical_location_manager::key. * selftest-diagnostic-path.cc (selftest::test_diagnostic_path::test_diagnostic_path): Pass m_test_logical_loc_mgr to base ctor. (selftest::test_diagnostic_path::same_function_p): Use pointer comparison. (selftest::test_diagnostic_path::add_event): Use logical_location_from_funcname. (selftest::test_diagnostic_path::add_thread_event): Likewise. (selftest::test_diagnostic_path::logical_location_from_funcname): New. (selftest::test_diagnostic_event::test_diagnostic_event): Fix indentation. Pass logical_location rather than const char *. * selftest-diagnostic-path.h (selftest::test_diagnostic_event::test_diagnostic_event): Likewise. (selftest::test_diagnostic_event::get_logical_location): Update for change to logical_location type. (selftest::test_diagnostic_event::get_function_name): Drop. (selftest::test_diagnostic_event::m_logical_loc): Convert from test_logical_location to logical_location. (selftest::test_diagnostic_path::logical_location_from_funcname): New. (selftest::test_diagnostic_path::m_test_logical_loc_mgr): New field. * selftest-logical-location.cc: Include "selftest.h". (selftest::test_logical_location::test_logical_location): Drop. (selftest::test_logical_location_manager::~test_logical_location_manager): New. (selftest::test_logical_location::get_short_name): Replace with... (selftest::test_logical_location_manager::get_short_name): ...this. (selftest::test_logical_location::get_name_with_scope): Replace with... (selftest::test_logical_location_manager::get_name_with_scope): ...this. (selftest::test_logical_location::get_internal_name): Replace with... (selftest::test_logical_location_manager::get_internal_name): ...this. (selftest::test_logical_location::get_kind): Replace with... (selftest::test_logical_location_manager::get_kind): ...this. (selftest::test_logical_location::get_name_for_path_output): Replace with... (selftest::test_logical_location_manager::get_name_for_path_output): ...this. (selftest::test_logical_location_manager::logical_location_from_funcname): New. (selftest::test_logical_location_manager::item_from_funcname): New. (selftest::selftest_logical_location_cc_tests): New. * selftest-logical-location.h (class test_logical_location): Replace with... (class test_logical_location_manager): ...this. * selftest-run-tests.cc (selftest::run_tests): Call selftest_logical_location_cc_tests. * selftest.h (selftest::selftest_logical_location_cc_tests): New decl. * simple-diagnostic-path.cc (simple_diagnostic_path::simple_diagnostic_path): Add "logical_loc_mgr" param and pass it to base ctor. (simple_diagnostic_event::simple_diagnostic_event): Update init of m_logical_loc. (selftest::test_intraprocedural_path): Update for changes to logical locations. * simple-diagnostic-path.h: Likewise. * tree-diagnostic-client-data-hooks.cc (compiler_data_hooks::get_logical_location_manger): New. (compiler_data_hooks::get_current_logical_location): Update. (compiler_data_hooks::m_current_fndecl_logical_loc): Replace with... (compiler_data_hooks::m_logical_location_manager): ...this. * tree-logical-location.cc (compiler_logical_location::get_short_name_for_tree): Replace with... (tree_logical_location_manager::get_short_name): ...this. (compiler_logical_location::get_name_with_scope_for_tree): Replace with... (tree_logical_location_manager::get_name_with_scope): ...this. (compiler_logical_location::get_internal_name_for_tree): Replace with... (tree_logical_location_manager::get_internal_name): ...this. (compiler_logical_location::get_kind_for_tree): Replace with... (tree_logical_location_manager::get_kind): ...this. (compiler_logical_location::get_name_for_tree_for_path_output): Replace with... (tree_logical_location_manager::get_name_for_path_output): ...this. (tree_logical_location::get_short_name): Drop. (tree_logical_location::get_name_with_scope): Drop. (tree_logical_location::get_internal_name): Drop. (tree_logical_location::get_kind): Drop. (tree_logical_location::get_name_for_path_output): Drop. (current_fndecl_logical_location::get_short_name): Drop. (current_fndecl_logical_location::get_name_with_scope): Drop. (current_fndecl_logical_location::get_internal_name): Drop. (current_fndecl_logical_location::get_kind): Drop. (current_fndecl_logical_location::get_name_for_path_output): Drop. * tree-logical-location.h (class compiler_logical_location): Drop. (class tree_logical_location): Drop. (class current_fndecl_logical_location): Drop. (class tree_logical_location_manager): New. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Update for changes to simple_diagnostic_path. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-05-01Daily bump.GCC Administrator1-0/+6
2025-04-30analyzer: avoid saying "'0' is NULL"David Malcolm1-2/+7
gcc/analyzer/ChangeLog: * sm-malloc.cc (malloc_diagnostic::describe_state_change): Tweak the "EXPR is NULL" message for the case where EXPR is a null pointer. gcc/testsuite/ChangeLog: * c-c++-common/analyzer/data-model-path-1.c: Check for "using NULL here" message. * c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c: Likewise. Check for "return of NULL" message. * c-c++-common/analyzer/null-deref-pr108400-SoftEtherVPN-WebUi.c: Likewise. * gcc.dg/analyzer/data-model-5.c: Likewise. * gcc.dg/analyzer/data-model-5b.c: Likewise. * gcc.dg/analyzer/data-model-5c.c: Likewise. * gcc.dg/analyzer/torture/pr93647.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-30Daily bump.GCC Administrator1-0/+6
2025-04-29analyzer: fix for older version of GCCMarc Poulhiès2-7/+7
Having both an enum and a variable with the same name triggers an error with gcc 5. exploded-graph.h:351:29: error: ‘status’ is not a class, namespace, or enumeration gcc/analyzer/ChangeLog: * exploded-graph.h (set_status): Rename parameter. * constraint-manager.cc (bound::ensure_closed): Likewise. (range::add_bound): Likewise. Signed-off-by: Marc Poulhiès <dkm@kataplop.net> Reviewed-by: David Malcolm <dmalcolm@redhat.com> Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-04-29Daily bump.GCC Administrator1-0/+419
2025-04-28analyzer: handle NRVO and DECL_BY_REFERENCE [PR111536]David Malcolm7-28/+88
The analyzer was issuing false warnings about uninitialized variables in C++ in places where NRVO was marking DECL_RESULT with DECL_BY_REFERENCE. Fixed thusly. gcc/analyzer/ChangeLog: PR analyzer/111536 * engine.cc (maybe_update_for_edge): Update for new call_stmt param to region_model::push_frame. * program-state.cc (program_state::push_frame): Likewise. * region-model.cc (region_model::update_for_gcall): Likewise. (region_model::push_frame): Add "call_stmt" param. Handle DECL_RESULT with DECL_BY_REFERENCE set on it by stashing the region of the lhs of the call_stmt in the caller frame, and writing a reference to it within the "result" in the callee frame. (region_model::pop_frame): Don't write back to the LHS for DECL_BY_REFERENCE results. (selftest::test_stack_frames): Update for new call_stmt param to region_model::push_frame. (selftest::test_get_representative_path_var): Likewise. (selftest::test_state_merging): Likewise. (selftest::test_alloca): Likewise. * region-model.h (region_model::push_frame): Add "call_stmt" param. * region.cc: Include "tree-ssa.h". (region::can_have_initial_svalue_p): Use ssa_defined_default_def_p for ssa names, rather than special-casing it for just parameters. This should now also cover DECL_RESULT with DECL_BY_REFERENCE and hard registers. * sm-signal.cc (update_model_for_signal_handler): Update for new call_stmt param to region_model::push_frame. * state-purge.cc (state_purge_per_decl::process_worklists): Likewise. gcc/testsuite/ChangeLog: PR analyzer/111536 * c-c++-common/analyzer/hard-reg-1.c: New test. * g++.dg/analyzer/nrvo-1.C: New test. * g++.dg/analyzer/nrvo-2.C: New test. * g++.dg/analyzer/nrvo-pr111536-1.C: New test. * g++.dg/analyzer/nrvo-pr111536-1b.C: New test. * g++.dg/analyzer/nrvo-pr111536-2.C: New test. * g++.dg/analyzer/nrvo-pr111536-2b.C: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: fix null deref false negative on std::unique_ptr [PR109366]David Malcolm1-0/+6
gcc/analyzer/ChangeLog: PR analyzer/109366 * region-model-manager.cc (region_model_manager::maybe_fold_sub_svalue): Sub-values of zero constants are zero. gcc/testsuite/ChangeLog: PR analyzer/109366 * g++.dg/analyzer/unique_ptr-1.C: New test. * g++.dg/analyzer/unique_ptr-2.C: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: initial implementation of exception handling [PR97111]David Malcolm20-62/+1908
This patch adds initial support for exception-handling to -fanalyzer, handling eh_dispatch for regions of type ERT_TRY and ERT_ALLOWED_EXCEPTIONS. I haven't managed yet seen eh_dispatch for regions of type ERT_CLEANUP and ERT_MUST_NOT_THROW in the analyzer; with this patch it will ICE if it sees those. Additionally, this patch only checks for exact matches of exception types, rather than supporting subclasses and references. I'm deferring fixing this for now whilst figuring out how best to interact with the C++ type system; I'm tracking it as PR analyzer/119697. The patch adds event classes for throwing and catching exceptions, and seems to generate readable warnings for the kinds of leak that might occur due to trying to manage resources manually and forgetting about exceptions; for example: exception-leak-1.C: In function ‘int test()’: exception-leak-1.C:7:9: warning: leak of ‘ptr’ [CWE-401] [-Wanalyzer-malloc-leak] 7 | throw 42; | ^~ ‘int test()’: events 1-3 5 | void *ptr = __builtin_malloc (1024); | ~~~~~~~~~~~~~~~~~^~~~~~ | | | (1) allocated here 6 | 7 | throw 42; | ~~ | | | (2) throwing exception of type ‘int’ here... | (3) ⚠️ ‘ptr’ leaks here; was allocated at (1) Although dynamic exception specifications are only available in C++14 and earlier, the need to support them meant it seemed relatively easy to add a warning to check them, hence the patch adds a new warning for code paths that throw an exception that doesn't match a dynamic exception specification: -Wanalyzer-throw-of-unexpected-type. gcc/analyzer/ChangeLog: PR analyzer/97111 * analyzer.cc (is_cxa_throw_p): New. (is_cxa_rethrow_p): New. * analyzer.opt (Wanalyzer-throw-of-unexpected-type): New. * analyzer.opt.urls: Regenerate. * call-info.cc (custom_edge_info::create_enode): New. * call-info.h (call_info::print): Drop "final". (call_info::add_events_to_path): Likewise. * checker-event.cc (event_kind_to_string): Add cases for event_kind::catch_, event_kind::throw_, and event_kind::unwind. (explicit_throw_event::print_desc): New. (throw_from_call_to_external_fn_event::print_desc): New. (unwind_event::print_desc): New. * checker-event.h (enum class event_kind): Add catch_, throw_, and unwind. (class catch_cfg_edge_event): New. (class throw_event): New. (class explicit_throw_event): New. (class throw_from_call_to_external_fn_event): New. (class unwind_event): New. * common.h (class eh_dispatch_cfg_superedge): New forward decl. (class eh_dispatch_try_cfg_superedge): New forward decl. (class eh_dispatch_allowed_cfg_superedge): New forward decl. (custom_edge_info::create_enode): New vfunc decl. (is_cxa_throw_p): New decl. (is_cxa_rethrow_p): New decl. * diagnostic-manager.cc (diagnostic_manager::add_events_for_superedge): Special-case edges for eh_dispach_try. (diagnostic_manager::prune_path): Call consolidate_unwind_events. (diagnostic_manager::prune_for_sm_diagnostic): Don't filter the new event_kinds. (diagnostic_manager::consolidate_unwind_events): New. * diagnostic-manager.h (diagnostic_manager::consolidate_unwind_events): New decl. * engine.cc (exploded_node::on_stmt_pre): Handle "__cxa_throw", "__cxa_rethrow", and resx statements. (class throw_custom_edge): New. (class unwind_custom_edge): New. (get_eh_outedge): New. (exploded_graph::unwind_from_exception): New. (exploded_node::on_throw): New. (exploded_node::on_resx): New. (exploded_graph::get_or_create_node): Add "add_to_worklist" param and use it. (exploded_graph::process_node): Use edge_info's create_enode vfunc to create enodes, rather than calling get_or_create_node directly. Ignore CFG edges in the sgraph flagged with EH whilst we're exploring the egraph. (exploded_graph_annotator::print_enode): Handle case exploded_node::status::special. * exploded-graph.h (exploded_node::status): Add value "special". (exploded_node::on_throw): New decl. (exploded_node::on_resx): New decl. (exploded_graph::get_or_create_node): Add optional "add_to_worklist" param. (exploded_graph::unwind_from_exception): New decl. * kf-lang-cp.cc (class kf_cxa_allocate_exception): New. (class kf_cxa_begin_catch): New. (class kf_cxa_end_catch): New. (class throw_of_unexpected_type): New. (class kf_cxa_call_unexpected): New. (register_known_functions_lang_cp): Register known functions "__cxa_allocate_exception", "__cxa_begin_catch", "__cxa_end_catch", and "__cxa_call_unexpected". * kf.cc (class kf_eh_pointer): New. (register_known_functions): Register it for BUILT_IN_EH_POINTER. * region-model.cc: Include "analyzer/function-set.h". (exception_node::operator==): New. (exception_node::dump_to_pp): New. (exception_node::dump): New. (exception_node::to_json): New. (exception_node::make_dump_widget): New. (exception_node::maybe_get_type): New. (exception_node::add_to_reachable_regions): New. (region_model::region_model): Initialize m_thrown_exceptions_stack and m_caught_exceptions_stack. (region_model::operator=): Likewise. (region_model::operator==): Compare them. (region_model::dump_to_pp): Dump exception stacks. (region_model::to_json): Add exception stacks. (region_model::make_dump_widget): Likewise. (class exception_thrown_from_unrecognized_call): New. (get_fns_assumed_not_to_throw): New. (can_throw_p): New. (region_model::check_for_throw_inside_call): New. (region_model::on_call_pre): Call check_for_throw_inside_call on unknown fns or those we don't have a body for. (region_model::maybe_update_for_edge): Handle eh_dispatch_stmt statements. Drop old code that called apply_constraints_for_exception on EDGE_EH edges. (class rejected_eh_dispatch): New. (exception_matches_type_p): New. (matches_any_exception_type_p): New. (region_model::apply_constraints_for_eh_dispatch): New. (region_model::apply_constraints_for_eh_dispatch_try): New. (region_model::apply_constraints_for_eh_dispatch_allowed): New. (region_model::apply_constraints_for_exception): Delete. (region_model::can_merge_with_p): Don't merge models with non-equal exception stacks. (region_model::get_referenced_base_regions): Add regions from exception stacks. * region-model.h (struct exception_node): New. (region_model::push_thrown_exception): New. (region_model::get_current_thrown_exception): New. (region_model::pop_thrown_exception): New. (region_model::push_caught_exception): New. (region_model::get_current_caught_exception): New. (region_model::pop_caught_exception): New. (region_model::apply_constraints_for_eh_dispatch_try): New decl. (region_model::apply_constraints_for_eh_dispatch_allowed) New decl. (region_model::apply_constraints_for_exception): Delete. (region_model::apply_constraints_for_eh_dispatch): New decl. (region_model::check_for_throw_inside_call): New decl. (region_model::m_thrown_exceptions_stack): New field. (region_model::m_caught_exceptions_stack): New field. * supergraph.cc: Include "except.h" and "analyzer/region-model.h". (supergraph::add_cfg_edge): Special-case eh_dispatch edges. (superedge::get_description): Use default_tree_printer. (get_catch): New. (eh_dispatch_cfg_superedge::make): New. (eh_dispatch_cfg_superedge::eh_dispatch_cfg_superedge): New. (eh_dispatch_cfg_superedge::get_eh_status): New. (eh_dispatch_try_cfg_superedge::dump_label_to_pp): New. (eh_dispatch_try_cfg_superedge::apply_constraints): New. (eh_dispatch_allowed_cfg_superedge::eh_dispatch_allowed_cfg_superedge): New. (eh_dispatch_allowed_cfg_superedge::dump_label_to_pp): New. (eh_dispatch_allowed_cfg_superedge::apply_constraints): New. * supergraph.h: Include "except.h". (superedge::dyn_cast_eh_dispatch_cfg_superedge): New vfunc. (superedge::dyn_cast_eh_dispatch_try_cfg_superedge): New vfunc. (superedge::dyn_cast_eh_dispatch_allowed_cfg_superedge): New vfunc. (class eh_dispatch_cfg_superedge): New. (is_a_helper <const eh_dispatch_cfg_superedge *>::test): New. (class eh_dispatch_try_cfg_superedge): New. (is_a_helper <const eh_dispatch_try_cfg_superedge *>::test): New. (class eh_dispatch_allowed_cfg_superedge): New. (is_a_helper <const eh_dispatch_allowed_cfg_superedge *>::test): New. * svalue.cc (svalue::maybe_get_type_from_typeinfo): New. * svalue.h (svalue::maybe_get_type_from_typeinfo): New decl. gcc/ChangeLog: PR analyzer/97111 * doc/invoke.texi: Add -Wanalyzer-throw-of-unexpected-type. * gimple.h (gimple_call_nothrow_p): Make arg const. gcc/testsuite/ChangeLog: PR analyzer/97111 * c-c++-common/analyzer/analyzer-verbosity-2a.c: Add -fno-exceptions. * c-c++-common/analyzer/analyzer-verbosity-3a.c: Likewise. * c-c++-common/analyzer/attr-const-2.c: Add __attribute__((nothrow)). * c-c++-common/analyzer/attr-malloc-4.c: Likewise. * c-c++-common/analyzer/attr-malloc-5.c: Likewise. * c-c++-common/analyzer/attr-malloc-6.c: Add -fno-exceptions. * c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c: Likewise. * c-c++-common/analyzer/attr-malloc-exception.c: New test. * c-c++-common/analyzer/call-summaries-pr107158-2.c: Add -fno-exceptions. * c-c++-common/analyzer/call-summaries-pr107158.c: Likewise. * c-c++-common/analyzer/capacity-2.c: Likewise. * c-c++-common/analyzer/coreutils-sum-pr108666.c: Likewise. * c-c++-common/analyzer/data-model-22.c: Likewise. * c-c++-common/analyzer/data-model-5d.c: Likewise. * c-c++-common/analyzer/deref-before-check-pr108455-git-pack-revindex.c: Likewise. * c-c++-common/analyzer/deref-before-check-pr108475-haproxy-tcpcheck.c: Likewise. * c-c++-common/analyzer/edges-2.c: Likewise. * c-c++-common/analyzer/fd-2.c: Likewise. * c-c++-common/analyzer/fd-3.c: Likewise. * c-c++-common/analyzer/fd-meaning.c: Likewise. * c-c++-common/analyzer/file-1.c: Likewise. * c-c++-common/analyzer/file-3.c: Likewise. * c-c++-common/analyzer/file-meaning-1.c: Likewise. * c-c++-common/analyzer/infinite-recursion.c: Likewise. * c-c++-common/analyzer/leak-3.c: Likewise. * c-c++-common/analyzer/malloc-dedupe-1.c: Likewise. * c-c++-common/analyzer/malloc-in-loop.c: Likewise. * c-c++-common/analyzer/malloc-many-paths-3.c: Likewise. * c-c++-common/analyzer/malloc-paths-5.c: Likewise. * c-c++-common/analyzer/malloc-paths-7.c: Likewise. * c-c++-common/analyzer/malloc-paths-8.c: Likewise. * c-c++-common/analyzer/malloc-vs-local-1a.c: Likewise. * c-c++-common/analyzer/malloc-vs-local-2.c: Likewise. * c-c++-common/analyzer/malloc-vs-local-3.c: Likewise. * c-c++-common/analyzer/paths-7.c: Likewise. * c-c++-common/analyzer/pr110830.c: Likewise. * c-c++-common/analyzer/pr93032-mztools-simplified.c: Likewise. * c-c++-common/analyzer/pr93355-localealias-feasibility-3.c: Likewise. * c-c++-common/analyzer/pr93355-localealias-simplified.c: Likewise. * c-c++-common/analyzer/pr96650-1-trans.c: Likewise. * c-c++-common/analyzer/pr97072.c: Add __attribute__((nothrow)). * c-c++-common/analyzer/pr98575-1.c: Likewise. * c-c++-common/analyzer/pr99716-1.c: Add -fno-exceptions. * c-c++-common/analyzer/pr99716-2.c: Likewise. * c-c++-common/analyzer/pr99716-3.c: Likewise. * c-c++-common/analyzer/pragma-2.c: Likewise. * c-c++-common/analyzer/rhbz1878600.c: Likewise. * c-c++-common/analyzer/strndup-1.c: Likewise. * c-c++-common/analyzer/write-to-string-literal-4-disabled.c: Likewise. * c-c++-common/analyzer/write-to-string-literal-4.c: Likewise. * c-c++-common/analyzer/write-to-string-literal-5.c: Likewise. * c-c++-common/analyzer/zlib-5.c: Likewise. * g++.dg/analyzer/exception-could-throw-1.C: New test. * g++.dg/analyzer/exception-could-throw-2.C: New test. * g++.dg/analyzer/exception-dynamic-spec.C: New test. * g++.dg/analyzer/exception-leak-1.C: New test. * g++.dg/analyzer/exception-leak-2.C: New test. * g++.dg/analyzer/exception-leak-3.C: New test. * g++.dg/analyzer/exception-leak-4.C: New test. * g++.dg/analyzer/exception-leak-5.C: New test. * g++.dg/analyzer/exception-leak-6.C: New test. * g++.dg/analyzer/exception-nothrow.C: New test. * g++.dg/analyzer/exception-path-1.C: New test. * g++.dg/analyzer/exception-path-catch-all-1.C: New test. * g++.dg/analyzer/exception-path-catch-all-2.C: New test. * g++.dg/analyzer/exception-path-unwind-multiple-2.C: New test. * g++.dg/analyzer/exception-path-unwind-multiple.C: New test. * g++.dg/analyzer/exception-path-unwind-single.C: New test. * g++.dg/analyzer/exception-path-with-cleanups.C: New test. * g++.dg/analyzer/exception-rethrow-1.C: New test. * g++.dg/analyzer/exception-rethrow-2.C: New test. * g++.dg/analyzer/exception-stack-1.C: New test. * g++.dg/analyzer/exception-stack-2.C: New test. * g++.dg/analyzer/exception-subclass-1.C: New test. * g++.dg/analyzer/exception-subclass-2.C: New test. * g++.dg/analyzer/exception-value-1.C: New test. * g++.dg/analyzer/exception-value-2.C: New test. * g++.dg/analyzer/fno-exception.C: New test. * g++.dg/analyzer/pr94028.C: Drop xfail. * g++.dg/analyzer/std-unexpected.C: New test. * g++.dg/coroutines/pr105287.C: Drop dg-excess-errors. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28Eliminate make-unique.h and ::make_uniqueDavid Malcolm34-689/+740
C++11 does not provide a std::make_unique so in r13-3627-g00d7c8ff16e683 I added a make-unique.h declaring a ::make_unique. As of r15-4719-ga9ec1bc06bd3cc we can use C++14, so make-unique.h is no longer needed: we can use simply use std::make_unique instead. This patch removes make-unique.h and updates every place using it to use std::make_unique. No functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc: Replace uses of ::make_unique with std::make_unique. * analyzer.cc: Likewise. * bounds-checking.cc: Likewise. * call-details.cc: Likewise. * call-info.cc: Likewise. * call-string.cc: Likewise. * checker-path.cc: Likewise. * common.h: Drop include of "make-unique.h". * constraint-manager.cc: Replace uses of ::make_unique with std::make_unique. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * infinite-loop.cc: Likewise. * infinite-recursion.cc: Likewise. * kf-analyzer.cc: Likewise. * kf-lang-cp.cc: Likewise. * kf.cc: Likewise. * pending-diagnostic.cc: Likewise. * program-point.cc: Likewise; drop #include. * program-state.cc: Likewise. * ranges.cc: Likewise. * region-model.cc: Likewise. * region.cc: Likewise; drop #include. * sm-fd.cc: Likewise. * 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. * sm.cc: Likewise. * store.cc: Likewise. * supergraph.cc: Likewise. * svalue.cc: Likewise; drop #include. * varargs.cc: Likewise. gcc/c-family/ChangeLog: * c-pretty-print.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. gcc/c/ChangeLog: * c-decl.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * c-objc-common.cc: Likewise. * c-parser.cc: Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * error.cc: Likewise. * name-lookup.cc: Likewise. * parser.cc: Likewise. gcc/ChangeLog: * diagnostic-format-json.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * diagnostic-format-sarif.cc: Likewise. * diagnostic-format-text.cc: Likewise. * diagnostic.cc: Likewise. * dumpfile.cc: Likewise. * gcc-attribute-urlifier.cc: Likewise. * gcc-urlifier.cc: Likewise. * json-parsing.cc: Likewise. * json.cc: Likewise. * lazy-diagnostic-path.cc: Likewise. * libgdiagnostics.cc: Likewise. * libsarifreplay.cc: Likewise. * lto-wrapper.cc: Likewise. * make-unique.h: Delete. * opts-diagnostic.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * pretty-print.cc: Likewise. * text-art/style.cc: Likewise. * text-art/styled-string.cc: Likewise. * text-art/table.cc: Likewise. * text-art/tree-widget.cc: Likewise. * text-art/widget.cc: Likewise. * timevar.cc: Likewise. * toplev.cc: Likewise. * tree-diagnostic-client-data-hooks.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Drop include of "make-unique.h". Replace uses of ::make_unique with std::make_unique. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: use unique_ptr for state_machine instancesDavid Malcolm13-101/+108
gcc/analyzer/ChangeLog: * engine.cc (class plugin_analyzer_init_impl): Convert "m_checkers" to use std::vector of std::unique_ptr. Convert "m_known_fn_mgr" to a reference. (impl_run_checkers): Convert "checkers" to use std::vector of std::unique_ptr and move it into the extrinsic_state. * program-state.cc (extrinsic_state::dump_to_pp): Update for changes to m_checkers. (extrinsic_state::to_json): Likewise. (extrinsic_state::get_sm_idx_by_name): Likewise. (selftest::test_sm_state_map): Update to use std::unique_ptr for state machines. (selftest::test_program_state_1): Likewise. (selftest::test_program_state_2): Likewise. (selftest::test_program_state_merging): Likewise. (selftest::test_program_state_merging_2): Likewise. * program-state.h (class extrinsic_state): Convert "m_checkers" to use std::vector of std::unique_ptr and to be owned by this object, rather than a reference. Add ctor for use in selftests. * sm-fd.cc (make_fd_state_machine): Update to use std::unique_ptr. * sm-file.cc (make_fileptr_state_machine): Likewise. * sm-malloc.cc (make_malloc_state_machine): Likewise. * sm-pattern-test.cc (make_pattern_test_state_machine): Likewise. * sm-sensitive.cc (make_sensitive_state_machine): Likewise. * sm-signal.cc (make_signal_state_machine): Likewise. * sm-taint.cc (make_taint_state_machine): Likewise. * sm.cc: Define INCLUDE_LIST. (make_checkers): Return the vector directly, rather than pass it in by reference. Update to use std::unique_ptr throughout. Use an intermediate list, and use that to filter with flag_analyzer_checker, fixing memory leak for this case. * sm.h: (make_checkers): Return the vector directly, rather than pass it in by reference, and use std::vector of std::unique_ptr. (make_malloc_state_machine): Convert return type to use std::unique_ptr. (make_fileptr_state_machine): Likewise. (make_taint_state_machine): Likewise. (make_sensitive_state_machine): Likewise. (make_signal_state_machine): Likewise. (make_pattern_test_state_machine): Likewise. (make_va_list_state_machine): Likewise. (make_fd_state_machine): Likewise. * varargs.cc (make_va_list_state_machine): Update to use std::unique_ptr. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: convert various call_summary * to call_summary &David Malcolm4-16/+18
No functional change intended. gcc/analyzer/ChangeLog: * call-summary.cc (call_summary_replay::call_summary_replay): Convert "summary" from call_summary * to call_summary &. (call_summary_replay::dump_to_pp): Likewise for m_summary. * call-summary.h (call_summary_replay::call_summary_replay): Likewise for "summary". (call_summary_replay::m_summary): Likewise. * engine.cc (call_summary_edge_info::call_summary_edge_info): Likewise. (call_summary_edge_info::update_state): Likewise. (call_summary_edge_info::update_model): Likewise. (call_summary_edge_info::print_desc): Likewise for m_summary. (call_summary_edge_info::m_summary): Likewise. (exploded_node::replay_call_summaries): Update for change to replay_call_summary. (exploded_node::replay_call_summary): Convert "summary" from call_summary * to call_summary &. * exploded-graph.h (exploded_node::replay_call_summary): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: convert gcall * to gcall & in many placesDavid Malcolm33-371/+368
No functional change intended. gcc/analyzer/ChangeLog: * analyzer.cc: Convert gcall * to gcall & where we know the pointer must be non-null. * call-details.cc: Likewise. * call-details.h: Likewise. * call-info.cc: Likewise. * call-info.h: Likewise. * call-summary.h: Likewise. * checker-event.cc: Likewise. * checker-event.h: Likewise. * common.h: Likewise. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * exploded-graph.h: Likewise. * kf-analyzer.cc: Likewise. * kf-lang-cp.cc: Likewise. * kf.cc: Likewise. * known-function-manager.cc: Likewise. * program-state.cc: Likewise. * program-state.h: Likewise. * region-model.cc: Likewise. * region-model.h: Likewise. * sm-fd.cc: Likewise. * sm-file.cc: Likewise. * sm-malloc.cc: Likewise. * sm-sensitive.cc: Likewise. * sm-signal.cc: Likewise. * sm-taint.cc: Likewise. * sm.h: Likewise. * store.cc: Likewise. * store.h: Likewise. * supergraph.cc: Likewise. * supergraph.h: Likewise. * svalue.h: Likewise. * varargs.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_gil_plugin.cc: Convert gcall * to gcall & where we know the pointer must be non-null. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: convert various enums to "enum class"David Malcolm18-241/+241
Modernization; no functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc: Convert enum access_direction to "enum class". * bounds-checking.cc: Likewise. * checker-event.cc: Convert enum event_kind to "enum class". * checker-event.h: Likewise. * checker-path.cc: Likewise. * common.h: Convert enum access_direction to "enum class". * constraint-manager.cc: Convert enum bound_kind to "enum class". * constraint-manager.h: Likewise. * diagnostic-manager.cc: Convert enum event_kind to "enum class". * engine.cc: Convert enum status to "enum class". * exploded-graph.h: Likewise. * infinite-loop.cc: Likewise. * kf-lang-cp.cc: Convert enum poison_kind to "enum class". * kf.cc: Likewise. * region-model-manager.cc: Likewise. * region-model.cc: Likewise; also for enum access_direction. * svalue.cc: Likewise. * svalue.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Convert enum poison_kind to "enum class". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: use analyzer/common.h as a common headerDavid Malcolm51-888/+321
Our headers are a major pain to work with: many require certain other headers to be included in a particular (undocumented) order in order to be includable. Simplify includes in the analyzer by renaming analyzer/analyzer.h to analyzer/common.h and have it include all the common headers needed throughout the analyzer, thus encapsulating the rules about e.g. being able to include "gimple.h" in one place in the analyzer subdirectory. Doing so also makes it easier to e.g. define INCLUDE_SET in one place, rather than in many source files. gcc/analyzer/ChangeLog: * analyzer.h: Rename to... * common.h: ...this. Add define of INCLUDE_VECTOR, includes of "config.h", "system.h", "coretypes.h", "make-unique.h", "tree.h", "function.h", "basic-block.h", "gimple.h", "options.h", "bitmap.h", "diagnostic-core.h", and "diagnostic-path.h". * access-diagram.h: Don't include "analyzer/analyzer.h". * access-diagram.cc: Reorganize includes to #include "analyzer/common.h" first, then group by subsystem, dropping redundant headers. * analysis-plan.cc: Likewise. * analyzer-language.cc: Likewise. * analyzer-pass.cc: Likewise. * analyzer-selftests.cc: Likewise. * analyzer.cc: Likewise. * bounds-checking.cc: Likewise. * call-details.cc: Likewise. * call-info.cc: Likewise. * call-string.cc: Likewise. * call-summary.cc: Likewise. * checker-event.cc: Likewise. * checker-path.cc: Likewise. * complexity.cc: Likewise. * constraint-manager.cc: Likewise. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * feasible-graph.cc: Likewise. * infinite-loop.cc: Likewise. * infinite-recursion.cc: Likewise. * kf-analyzer.cc: Likewise. * kf-lang-cp.cc: Likewise. * kf.cc: Likewise. * known-function-manager.cc: Likewise. * pending-diagnostic.cc: Likewise. * program-point.cc: Likewise. * program-state.cc: Likewise. * ranges.cc: Likewise. * record-layout.cc: Likewise. * region-model-asm.cc: Likewise. * region-model-manager.cc: Likewise. * region-model-reachability.cc: Likewise. * region-model.cc: Likewise. * region.cc: Likewise. * sm-fd.cc: Likewise. * 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. * sm.cc: Likewise. * state-purge.cc: Likewise. * store.cc: Likewise. * supergraph.cc: Likewise. * svalue.cc: Likewise. * symbol.cc: Likewise. * trimmed-graph.cc: Likewise. * varargs.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: Update for renaming of analyzer/analyzer.h to analyzer/common.h. * gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: fail if we see unexpected gimple stmt codesDavid Malcolm1-7/+16
gcc/analyzer/ChangeLog: * region-model.cc (region_model::on_stmt_pre): Use internal_error if we see an unexpected gimple stmt code. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-04-28analyzer: add a call_details::dump (using text_art)David Malcolm2-0/+63
Add a new function to help debugging -fanalyzer. No functional change intended. gcc/analyzer/ChangeLog: * call-details.cc (call_details::dump): New overload. (call_details::make_dump_widget): New. * call-details.h (call_details::dump): Declare new overload. (call_details::make_dump_widget): New decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-03-15Daily bump.GCC Administrator1-0/+7
2025-03-14analyzer: Fix ICE in cmp_csts_same_type on RAW_DATA_CST [PR119278]Jakub Jelinek1-2/+15
The following testcase ICEs in cmp_csts_same_type because RAW_DATA_CST isn't handled there. As TREE_TYPE (cst1) in that case is INTEGER_TYPE, e.g. char/signed char/unsigned char, the type itself doesn't imply the size, so the length is compared first, followed by comparing the data. While at it, I've noticed STRING_CST handling is wrong, because STRING_CST can represent even string literals with embedded nul characters. We shouldn't stop at those, hence memcmp. While for STRING_CST TREE_TYPE should likely already imply the length and so same type should imply same TREE_STRING_LENGTH, I've repeated the comparisons in there just in case. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR analyzer/119278 * svalue.cc (cmp_csts_same_type): For STRING_CST, compare TREE_STRING_LENGTH first just in case and use memcmp rather than strcmp. Handle RAW_DATA_CST. * c-c++-common/analyzer/pr119278.c: New test.
2025-03-14Daily bump.GCC Administrator1-0/+20
2025-03-12analyzer: support RAW_DATA_CST [PR117262]David Malcolm4-6/+87
gcc/analyzer/ChangeLog: PR analyzer/117262 * region-model-manager.cc (region_model_manager::get_or_create_constant_svalue): Use NULL_TREE for the types of constant_svalue for RAW_DATA_CST. (region_model_manager::maybe_fold_sub_svalue): Generalize STRING_CST logic to also handle RAW_DATA_CST. (region_model_manager::maybe_get_char_from_cst): New. (region_model_manager::maybe_get_char_from_raw_data_cst): New. * region-model-manager.h (region_model_manager::maybe_get_char_from_cst): New decl. (region_model_manager::maybe_get_char_from_raw_data_cst): New decl. * region-model.cc (region_model::get_rvalue_1): Handle RAW_DATA_CST. * store.cc (get_subregion_within_ctor_for_ctor_pair): New. (binding_map::apply_ctor_pair_to_child_region): Call get_subregion_within_ctor_for_ctor_pair so that we handle RAW_DATA_CST. gcc/testsuite/ChangeLog: PR analyzer/117262 * c-c++-common/analyzer/raw-data-cst-pr117262-1.c: New test. * c-c++-common/analyzer/raw-data-cst-pr117262-2.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-02-25Daily bump.GCC Administrator1-0/+8
2025-02-24analyzer: Handle nonnull_if_nonzero attribute [PR117023]Jakub Jelinek1-28/+71
On top of the https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668554.html patch which introduces the nonnull_if_nonzero attribute (because C2Y is allowing NULL arguments on various calls like memcpy, memset, strncpy etc. as long as the count is 0) the following patch adds just limited handling of the attribute in the analyzer. For nonnull attribute(s) we have the get_nonnull_args helper which returns a bitmap, for nonnull_if_nonzero a function would need to return a hash_map or something similar, I think it is better to handle the attributes one by one. This patch just handles the non-zero INTEGER_CST (integer_nonzerop) count arguments, in other places the above patch uses ranger to some extent, but I'm not familiar enough with the analyzer to know if one can use the ranger, or should somehow explain in data structures the conditional nature of the nonnull property, the argument is nonnull only if some other argument is nonzero. Also, analyzer uses get_nonnull_args in another spot when entering a frame, not sure if anything can be done there (note the conditional nonnull somehow, pass from callers if the argument is nonzero, ...). Note, the testsuite changes aren't strictly necessary with just the above and this patch, but will be with a patch I'm going to post soon. 2025-02-24 Jakub Jelinek <jakub@redhat.com> PR c/117023 gcc/analyzer/ * sm-malloc.cc (malloc_state_machine::handle_nonnull): New private method. (malloc_state_machine::on_stmt): Use it for nonnull attribute arguments. Handle also nonnull_if_nonzero attributes. gcc/testsuite/ * c-c++-common/analyzer/call-summaries-malloc.c (test_use_without_check): Pass 4 rather than sz to memset. * c-c++-common/analyzer/strncpy-1.c (test_null_dst, test_null_src): Pass 42 rather than count to strncpy.
2025-02-20Daily bump.GCC Administrator1-0/+10
2025-02-19analyzer: handle more IFN_UBSAN_* as no-ops [PR118300]David Malcolm1-6/+16
Previously the analyzer treated IFN_UBSAN_BOUNDS as a no-op, but the other IFN_UBSAN_* were unrecognized and conservatively treated as having arbitrary behavior. Treat IFN_UBSAN_NULL and IFN_UBSAN_PTR also as no-ops, which should make -fanalyzer behave better with -fsanitize=undefined. gcc/analyzer/ChangeLog: PR analyzer/118300 * kf.cc (class kf_ubsan_bounds): Replace this with... (class kf_ubsan_noop): ...this. (register_sanitizer_builtins): Use it to handle IFN_UBSAN_NULL, IFN_UBSAN_BOUNDS, and IFN_UBSAN_PTR as nop-ops. (register_known_functions): Drop handling of IFN_UBSAN_BOUNDS here, as it's now handled by register_sanitizer_builtins above. gcc/testsuite/ChangeLog: PR analyzer/118300 * gcc.dg/analyzer/ubsan-pr118300.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-02-19Daily bump.GCC Administrator1-0/+10
2025-02-18analyzer: add more properties to sarif outputDavid Malcolm2-1/+38
Add some more properties to the analyzer's sarif output, to help with debugging -fanalyzer. gcc/analyzer/ChangeLog: * diagnostic-manager.cc (saved_diagnostic::maybe_add_sarif_properties): Add various properties for debugging, for m_stmt, m_var, and m_duplicates. Remove stray 'if' statement. Capture the kind of the pending_diagnostic. * region-model.cc (poisoned_value_diagnostic::maybe_add_sarif_properties): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-01-02Update copyright years.Jakub Jelinek95-95/+95
2025-01-02Update Copyright year in ChangeLog filesJakub Jelinek1-2/+1
2024 -> 2025
2024-12-07Daily bump.GCC Administrator1-0/+7
2024-12-06diagnostics: UX: add doc URLs for attributes (v2)David Malcolm2-0/+4
This is v2 of the patch; v1 was here: https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655541.html Changed in v2: * added a new TARGET_DOCUMENTATION_NAME hook for figuring out which documentation URL to use when there are multiple per-target docs, such as for __attribute__((interrupt)); implemented this for all targets that have target-specific attributes * moved attribute_urlifier and its support code to a new gcc-attribute-urlifier.cc since it needs to use targetm for the above; gcc-urlifier.o is used by the driver. * fixed extend.texi so that some attributes that failed to appear in attr-urls.def now do so (affected nvptx "kernel" and "shared" attrs) * regenerated attr-urls.def for the above fix, and bringing in attributes added since v1 of the patch In r14-5118-gc5db4d8ba5f3de I added a mechanism to automatically add documentation URLs to quoted strings in diagnostics. In r14-6920-g9e49746da303b8 I added a mechanism to generate URLs for mentions of command-line options in quoted strings in diagnostics. This patch does a similar thing for attributes. It adds a new Python 3 script to scrape the generated HTML looking for documentation of attributes, and uses this to (re)generate a new gcc/attr-urls.def file. Running "make regenerate-attr-urls" after rebuilding the HTML docs will regenerate gcc/attr-urls.def in the source directory. The patch uses this to optionally add doc URLs for attributes in any diagnostic emitted during the lifetime of a auto_urlify_attributes instance, and adds such instances everywhere that a diagnostic refers to a diagnostic within quotes (based on grepping the source tree for references to attributes in strings and in code). For example, given: $ ./xgcc -B. -S ../../src/gcc/testsuite/gcc.dg/attr-access-2.c ../../src/gcc/testsuite/gcc.dg/attr-access-2.c:14:16: warning: attribute ‘access(read_write, 2, 3)’ positional argument 2 conflicts with previous designation by argument 1 [-Wattributes] with this patch the quoted text `access(read_write, 2, 3)' automatically gains the URL for our docs for "access": https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-access-function-attribute in a sufficiently modern terminal. Like r14-6920-g9e49746da303b8 this avoids the Makefile target depending on the generated HTML, since a missing URL is a minor problem, whereas requiring all users to build HTML docs seems more involved. Doing so also avoids Python 3 as a build requirement for everyone, but instead just for developers addding attributes. Like the options, we could add a CI test for this. The patch gathers both general and target-specific attributes. For example, the function attribute "interrupt" has 19 URLs within our docs: one common, and 18 target-specific ones. The patch adds a new target hook used when selecting the most appropriate one. Signed-off-by: David Malcolm <dmalcolm@redhat.com> gcc/ChangeLog: * Makefile.in (OBJS): Add -attribute-urlifier.o. (ATTR_URLS_HTML_DEPS): New. (regenerate-attr-urls): New. (regenerate-attr-urls-unit-test): New. * attr-urls.def: New file. * attribs.cc: Include "gcc-urlifier.h". (decl_attributes): Use auto_urlify_attributes. * config/aarch64/aarch64.cc (TARGET_DOCUMENTATION_NAME): New. * config/arc/arc.cc (TARGET_DOCUMENTATION_NAME): New. * config/arm/arm.cc (TARGET_DOCUMENTATION_NAME): New. * config/bfin/bfin.cc (TARGET_DOCUMENTATION_NAME): New. * config/bpf/bpf.cc (TARGET_DOCUMENTATION_NAME): New. * config/epiphany/epiphany.cc (TARGET_DOCUMENTATION_NAME): New. * config/gcn/gcn.cc (TARGET_DOCUMENTATION_NAME): New. * config/h8300/h8300.cc (TARGET_DOCUMENTATION_NAME): New. * config/i386/i386.cc (TARGET_DOCUMENTATION_NAME): New. * config/ia64/ia64.cc (TARGET_DOCUMENTATION_NAME): New. * config/m32c/m32c.cc (TARGET_DOCUMENTATION_NAME): New. * config/m32r/m32r.cc (TARGET_DOCUMENTATION_NAME): New. * config/m68k/m68k.cc (TARGET_DOCUMENTATION_NAME): New. * config/mcore/mcore.cc (TARGET_DOCUMENTATION_NAME): New. * config/microblaze/microblaze.cc (TARGET_DOCUMENTATION_NAME): New. * config/mips/mips.cc (TARGET_DOCUMENTATION_NAME): New. * config/msp430/msp430.cc (TARGET_DOCUMENTATION_NAME): New. * config/nds32/nds32.cc (TARGET_DOCUMENTATION_NAME): New. * config/nvptx/nvptx.cc (TARGET_DOCUMENTATION_NAME): New. * config/riscv/riscv.cc (TARGET_DOCUMENTATION_NAME): New. * config/rl78/rl78.cc (TARGET_DOCUMENTATION_NAME): New. * config/rs6000/rs6000.cc (TARGET_DOCUMENTATION_NAME): New. * config/rx/rx.cc (TARGET_DOCUMENTATION_NAME): New. * config/s390/s390.cc (TARGET_DOCUMENTATION_NAME): New. * config/sh/sh.cc (TARGET_DOCUMENTATION_NAME): New. * config/stormy16/stormy16.cc (TARGET_DOCUMENTATION_NAME): New. * config/v850/v850.cc (TARGET_DOCUMENTATION_NAME): New. * config/visium/visium.cc (TARGET_DOCUMENTATION_NAME): New. gcc/analyzer/ChangeLog: * region-model.cc: Include "gcc-urlifier.h". (reason_attr_access::emit): Use auto_urlify_attributes. * sm-taint.cc: Include "gcc-urlifier.h". (tainted_access_attrib_size::emit): Use auto_urlify_attributes. gcc/c-family/ChangeLog: * c-attribs.cc: Include "gcc-urlifier.h". (positional_argument): Use auto_urlify_attributes. * c-common.cc: Include "gcc-urlifier.h". (parse_optimize_options): Use auto_urlify_attributes with OPT_Wattributes. (attribute_fallthrough_p): Use auto_urlify_attributes. * c-warn.cc: Include "gcc-urlifier.h". (diagnose_mismatched_attributes): Use auto_urlify_attributes. gcc/c/ChangeLog: * c-decl.cc: Include "gcc-urlifier.h". (start_decl): Use auto_urlify_attributes with OPT_Wattributes. (start_function): Likewise. * c-parser.cc: Include "gcc-urlifier.h". (c_parser_statement_after_labels): Use auto_urlify_attributes with OPT_Wattributes. * c-typeck.cc: Include "gcc-urlifier.h". (maybe_warn_nodiscard): Use auto_urlify_attributes with OPT_Wunused_result. gcc/cp/ChangeLog: * cp-gimplify.cc: Include "gcc-urlifier.h". (process_stmt_hotness_attribute): Use auto_urlify_attributes with OPT_Wattributes. * cvt.cc: Include "gcc-urlifier.h". (maybe_warn_nodiscard): Use auto_urlify_attributes with OPT_Wunused_result. * decl.cc: Include "gcc-urlifier.h". (start_decl): Use auto_urlify_attributes. (start_preparsed_function): Likewise. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::override_urlifier): New. * diagnostic.h (diagnostic_context::override_urlifier): New decl. * doc/extend.texi (Nvidia PTX Function Attributes): Update @cindex to specify that "kernel" is a function attribute and "shared" is a variable attribute, so that these entries are recognized by the regex in regenerate-attr-urls.py. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_DOCUMENTATION_NAME): New. * gcc-attribute-urlifier.cc: New file. * gcc-urlifier.cc: Include diagnostic.h. (gcc_urlifier::make_doc): Convert to... (make_doc_url): ...this. (auto_override_urlifier::auto_override_urlifier): New. (auto_override_urlifier::~auto_override_urlifier): New. (selftest::gcc_urlifier_cc_tests): Split out body into... (selftest::test_gcc_urlifier): ...this. * gcc-urlifier.h: Include "pretty-print-urlifier.h" and "label-text.h". (make_doc_url): New decl. (class auto_override_urlifier): New. (class attribute_urlifier): New. (class auto_urlify_attributes): New. * gimple-ssa-warn-access.cc: Include "gcc-urlifier.h". (pass_waccess::execute): Use auto_urlify_attributes. * gimplify.cc: Include "gcc-urlifier.h". (expand_FALLTHROUGH): Use auto_urlify_attributes. * internal-fn.cc: Define INCLUDE_MEMORY and include "gcc-urlifier.h. (expand_FALLTHROUGH): Use auto_urlify_attributes. * ipa-pure-const.cc: Include "gcc-urlifier.h. (suggest_attribute): Use auto_urlify_attributes. * ipa-strub.cc: Include "gcc-urlifier.h. (can_strub_p): Use auto_urlify_attributes. * regenerate-attr-urls.py: New file. * selftest-run-tests.cc (selftest::run_tests): Call gcc_attribute_urlifier_cc_tests. * selftest.h (selftest::gcc_attribute_urlifier_cc_tests): New decl. * target.def (documentation_name): New DEFHOOKPOD. * tree-cfg.cc: Include "gcc-urlifier.h. (do_warn_unused_result): Use auto_urlify_attributes. * tree-ssa-uninit.cc: Include "gcc-urlifier.h. (maybe_warn_read_write_only): Use auto_urlify_attributes. (maybe_warn_pass_by_reference): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-29Daily bump.GCC Administrator1-0/+15
2024-11-27analyzer,timevar: avoid naked "new" in JSON-handlingDavid Malcolm4-15/+9
Now that <memory> is always included, use std::unique_ptr in a few more places to avoid naked "new". No functional change intended. gcc/analyzer/ChangeLog: * engine.cc (strongly_connected_components::to_json): Avoid naked "new". * infinite-loop.cc (infinite_loop::to_json): Convert return type to unique_ptr. Avoid naked "new". * sm-signal.cc (signal_delivery_edge_info_t::to_json): Delete unused function. * supergraph.cc (supernode::to_json): Avoid naked "new". gcc/ChangeLog: * timevar.cc: Include "make-unique.h". (timer::named_items::make_json): Convert return type to unique_ptr. Avoid naked "new". (make_json_for_timevar_time_def): Likewise. (timer::timevar_def::make_json): Likewise. (timer::make_json): Likewise. * timevar.h (timer::make_json): Likewise. (timer::timevar_def::make_json): Likewise. * tree-diagnostic-client-data-hooks.cc: Update for above changes. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-27diagnostics: replace %<%s%> with %qs [PR104896]David Malcolm1-7/+7
No functional change intended. gcc/analyzer/ChangeLog: PR c/104896 * sm-malloc.cc: Replace "%<%s%>" with "%qs" in message wording. gcc/c-family/ChangeLog: PR c/104896 * c-lex.cc (c_common_lex_availability_macro): Replace "%<%s%>" with "%qs" in message wording. * c-opts.cc (c_common_handle_option): Likewise. * c-warn.cc (warn_parm_array_mismatch): Likewise. gcc/ChangeLog: PR c/104896 * common/config/ia64/ia64-common.cc (ia64_handle_option): Replace "%<%s%>" with "%qs" in message wording. * common/config/rs6000/rs6000-common.cc (rs6000_handle_option): Likewise. * config/aarch64/aarch64.cc (aarch64_validate_sls_mitigation): Likewise. (aarch64_override_options): Likewise. (aarch64_process_target_attr): Likewise. * config/arm/aarch-common.cc (aarch_validate_mbranch_protection): Likewise. * config/pru/pru.cc (pru_insert_attributes): Likewise. * config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::parse_arch): Likewise. * omp-general.cc (oacc_verify_routine_clauses): Likewise. * tree-ssa-uninit.cc (maybe_warn_read_write_only): Likewise. (maybe_warn_pass_by_reference): Likewise. gcc/cp/ChangeLog: PR c/104896 * cvt.cc (maybe_warn_nodiscard): Replace "%<%s%>" with "%qs" in message wording. gcc/fortran/ChangeLog: PR c/104896 * resolve.cc (resolve_operator): Replace "%<%s%>" with "%qs" in message wording. gcc/go/ChangeLog: PR c/104896 * gofrontend/embed.cc (Gogo::initializer_for_embeds): Replace "%<%s%>" with "%qs" in message wording. * gofrontend/expressions.cc (Selector_expression::lower_method_expression): Likewise. * gofrontend/gogo.cc (Gogo::set_package_name): Likewise. (Named_object::export_named_object): Likewise. * gofrontend/parse.cc (Parse::struct_type): Likewise. (Parse::parameter_list): Likewise. gcc/rust/ChangeLog: PR c/104896 * backend/rust-compile-expr.cc (CompileExpr::compile_integer_literal): Replace "%<%s%>" with "%qs" in message wording. (CompileExpr::compile_float_literal): Likewise. * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise. * backend/rust-tree.cc (maybe_warn_nodiscard): Likewise. * checks/lints/rust-lint-scan-deadcode.h: Likewise. * lex/rust-lex.cc (Lexer::parse_partial_unicode_escape): Likewise. (Lexer::parse_raw_byte_string): Likewise. * lex/rust-token.cc (Token::get_str): Likewise. * metadata/rust-export-metadata.cc (PublicInterface::write_to_path): Likewise. * parse/rust-parse.cc (peculiar_fragment_match_compatible_fragment): Likewise. (peculiar_fragment_match_compatible): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. * rust-session-manager.cc (validate_crate_name): Likewise. (Session::load_extern_crate): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_fn_trait_call): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::validate_trait_impl_block): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. * typecheck/rust-tyty.cc (BaseType::bounds_compatible): Likewise. * typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. libcpp/ChangeLog: PR c/104896 * pch.cc (cpp_valid_state): Replace "%<%s%>" with "%qs" in message wording. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-11-24Daily bump.GCC Administrator1-0/+7
2024-11-23Support for 64-bit location_t: Analyzer partsLewis Hyatt2-4/+5
The analyzer occasionally prints internal location_t values for debugging; adjust those parts so they will work if location_t is 64-bit. For simplicity, to avoid hassling with the printf format string, just convert to (unsigned long long) in either case. gcc/analyzer/ChangeLog: * checker-event.cc (checker_event::dump): Support printing either 32- or 64-bit location_t values. * checker-path.cc (checker_path::inject_any_inlined_call_events): Likewise.
2024-11-23Daily bump.GCC Administrator1-0/+55
2024-11-22build: Remove INCLUDE_MEMORY [PR117737]Andrew Pinski51-51/+0
Since diagnostic.h is included in over half of the sources, requiring to `#define INCLUDE_MEMORY` does not make sense. Instead lets unconditionally include memory in system.h. The majority of this patch is just removing `#define INCLUDE_MEMORY` from the sources which currently have it. This should also fix the mingw build issue but I have not tried it. Bootstrapped and tested on x86_64-linux-gnu. PR bootstrap/117737 gcc/ada/ChangeLog: * gcc-interface/misc.cc (INCLUDE_MEMORY): Remove. * gcc-interface/trans.cc (INCLUDE_MEMORY): Remove. * gcc-interface/utils.cc (INCLUDE_MEMORY): Remove. gcc/analyzer/ChangeLog: * access-diagram.cc (INCLUDE_MEMORY): Remove. * analysis-plan.cc (INCLUDE_MEMORY): Remove. * analyzer-language.cc (INCLUDE_MEMORY): Remove. * analyzer-logging.cc (INCLUDE_MEMORY): Remove. * analyzer-pass.cc (INCLUDE_MEMORY): Remove. * analyzer-selftests.cc (INCLUDE_MEMORY): Remove. * analyzer.cc (INCLUDE_MEMORY): Remove. * bar-chart.cc (INCLUDE_MEMORY): Remove. * bounds-checking.cc (INCLUDE_MEMORY): Remove. * call-details.cc (INCLUDE_MEMORY): Remove. * call-info.cc (INCLUDE_MEMORY): Remove. * call-string.cc (INCLUDE_MEMORY): Remove. * call-summary.cc (INCLUDE_MEMORY): Remove. * checker-event.cc (INCLUDE_MEMORY): Remove. * checker-path.cc (INCLUDE_MEMORY): Remove. * complexity.cc (INCLUDE_MEMORY): Remove. * constraint-manager.cc (INCLUDE_MEMORY): Remove. * diagnostic-manager.cc (INCLUDE_MEMORY): Remove. * engine.cc (INCLUDE_MEMORY): Remove. * feasible-graph.cc (INCLUDE_MEMORY): Remove. * infinite-loop.cc (INCLUDE_MEMORY): Remove. * infinite-recursion.cc (INCLUDE_MEMORY): Remove. * kf-analyzer.cc (INCLUDE_MEMORY): Remove. * kf-lang-cp.cc (INCLUDE_MEMORY): Remove. * kf.cc (INCLUDE_MEMORY): Remove. * known-function-manager.cc (INCLUDE_MEMORY): Remove. * pending-diagnostic.cc (INCLUDE_MEMORY): Remove. * program-point.cc (INCLUDE_MEMORY): Remove. * program-state.cc (INCLUDE_MEMORY): Remove. * ranges.cc (INCLUDE_MEMORY): Remove. * record-layout.cc (INCLUDE_MEMORY): Remove. * region-model-asm.cc (INCLUDE_MEMORY): Remove. * region-model-manager.cc (INCLUDE_MEMORY): Remove. * region-model-reachability.cc (INCLUDE_MEMORY): Remove. * region-model.cc (INCLUDE_MEMORY): Remove. * region.cc (INCLUDE_MEMORY): Remove. * sm-fd.cc (INCLUDE_MEMORY): Remove. * sm-file.cc (INCLUDE_MEMORY): Remove. * sm-malloc.cc (INCLUDE_MEMORY): Remove. * sm-pattern-test.cc (INCLUDE_MEMORY): Remove. * sm-sensitive.cc (INCLUDE_MEMORY): Remove. * sm-signal.cc (INCLUDE_MEMORY): Remove. * sm-taint.cc (INCLUDE_MEMORY): Remove. * sm.cc (INCLUDE_MEMORY): Remove. * state-purge.cc (INCLUDE_MEMORY): Remove. * store.cc (INCLUDE_MEMORY): Remove. * supergraph.cc (INCLUDE_MEMORY): Remove. * svalue.cc (INCLUDE_MEMORY): Remove. * symbol.cc (INCLUDE_MEMORY): Remove. * trimmed-graph.cc (INCLUDE_MEMORY): Remove. * varargs.cc (INCLUDE_MEMORY): Remove. gcc/ChangeLog: * asan.cc (INCLUDE_MEMORY): Remove. * attribs.cc (INCLUDE_MEMORY): Remove. * auto-profile.cc (INCLUDE_MEMORY): Remove. * calls.cc (INCLUDE_MEMORY): Remove. * cfganal.cc (INCLUDE_MEMORY): Remove. * cfgexpand.cc (INCLUDE_MEMORY): Remove. * cfghooks.cc (INCLUDE_MEMORY): Remove. * cfgloop.cc (INCLUDE_MEMORY): Remove. * cgraph.cc (INCLUDE_MEMORY): Remove. * cgraphclones.cc (INCLUDE_MEMORY): Remove. * cgraphunit.cc (INCLUDE_MEMORY): Remove. * collect-utils.cc (INCLUDE_MEMORY): Remove. * collect2.cc (INCLUDE_MEMORY): Remove. * common/config/aarch64/aarch64-common.cc (INCLUDE_MEMORY): Remove. * common/config/arm/arm-common.cc (INCLUDE_MEMORY): Remove. * common/config/avr/avr-common.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-cc-fusion.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-early-ra.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64-sve-builtins.cc (INCLUDE_MEMORY): Remove. * config/aarch64/aarch64.cc (INCLUDE_MEMORY): Remove. * config/arc/arc.cc (INCLUDE_MEMORY): Remove. * config/arm/aarch-common.cc (INCLUDE_MEMORY) Remove.: * config/arm/arm-mve-builtins.cc (INCLUDE_MEMORY): Remove. * config/arm/arm.cc (INCLUDE_MEMORY): Remove. * config/avr/avr-devices.cc (INCLUDE_MEMORY): Remove. * config/avr/driver-avr.cc (INCLUDE_MEMORY): Remove. * config/bpf/bpf.cc (INCLUDE_MEMORY): Remove. * config/bpf/btfext-out.cc (INCLUDE_MEMORY): Remove. * config/bpf/core-builtins.cc (INCLUDE_MEMORY): Remove. * config/darwin.cc (INCLUDE_MEMORY): Remove. * config/gcn/mkoffload.cc (INCLUDE_MEMORY): Remove. * config/i386/driver-i386.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-builtins.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-expand.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-features.cc (INCLUDE_MEMORY): Remove. * config/i386/i386-options.cc (INCLUDE_MEMORY): Remove. * config/i386/i386.cc (INCLUDE_MEMORY): Remove. * config/loongarch/loongarch-builtins.cc (INCLUDE_MEMORY): Remove. * config/loongarch/loongarch.cc (INCLUDE_MEMORY): Remove. * config/mingw/winnt-cxx.cc (INCLUDE_MEMORY): Remove. * config/mingw/winnt.cc (INCLUDE_MEMORY): Remove. * config/mips/mips.cc (INCLUDE_MEMORY): Remove. * config/msp430/driver-msp430.cc (INCLUDE_MEMORY): Remove. * config/nvptx/mkoffload.cc (INCLUDE_MEMORY): Remove. * config/nvptx/nvptx.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-avlprop.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-target-attr.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vector-builtins.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vector-costs.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv-vsetvl.cc (INCLUDE_MEMORY): Remove. * config/riscv/riscv.cc (INCLUDE_MEMORY): Remove. * config/rs6000/driver-rs6000.cc (INCLUDE_MEMORY): Remove. * config/rs6000/host-darwin.cc (INCLUDE_MEMORY): Remove. * config/rs6000/rs6000-c.cc (INCLUDE_MEMORY): Remove. * config/rs6000/rs6000.cc (INCLUDE_MEMORY): Remove. * config/s390/s390-c.cc (INCLUDE_MEMORY): Remove. * config/s390/s390.cc (INCLUDE_MEMORY): Remove. * config/sol2-cxx.cc (INCLUDE_MEMORY): Remove. * config/vms/vms-c.cc (INCLUDE_MEMORY): Remove. * config/xtensa/xtensa-dynconfig.cc (INCLUDE_MEMORY): Remove. * coroutine-passes.cc (INCLUDE_MEMORY): Remove. * coverage.cc (INCLUDE_MEMORY): Remove. * data-streamer-in.cc (INCLUDE_MEMORY): Remove. * data-streamer-out.cc (INCLUDE_MEMORY): Remove. * data-streamer.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-json.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-sarif.cc (INCLUDE_MEMORY): Remove. * diagnostic-format-text.cc (INCLUDE_MEMORY): Remove. * diagnostic-global-context.cc (INCLUDE_MEMORY): Remove. * diagnostic-macro-unwinding.cc (INCLUDE_MEMORY): Remove. * diagnostic-path.cc (INCLUDE_MEMORY): Remove. * diagnostic-show-locus.cc (INCLUDE_MEMORY): Remove. * diagnostic-spec.cc (INCLUDE_MEMORY): Remove. * diagnostic.cc (INCLUDE_MEMORY): Remove. * diagnostic.h: Remove check for INCLUDE_MEMORY. * digraph.cc (INCLUDE_MEMORY): Remove. * dumpfile.cc (INCLUDE_MEMORY): Remove. * dwarf2out.cc (INCLUDE_MEMORY): Remove. * edit-context.cc (INCLUDE_MEMORY): Remove. * except.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * file-prefix-map.cc (INCLUDE_MEMORY): Remove. * final.cc (INCLUDE_MEMORY): Remove. * fwprop.cc (INCLUDE_MEMORY): Remove. * gcc-plugin.h (INCLUDE_MEMORY): Remove. * gcc-rich-location.cc (INCLUDE_MEMORY): Remove. * gcc-urlifier.cc (INCLUDE_MEMORY): Remove. * gcc.cc (INCLUDE_MEMORY): Remove. * gcov-dump.cc (INCLUDE_MEMORY): Remove. * gcov-tool.cc (INCLUDE_MEMORY): Remove. * gcov.cc (INCLUDE_MEMORY): Remove. * gengtype.cc (open_base_files): Don't print `#define INCLUDE_MEMORY`. * genmatch.cc (INCLUDE_MEMORY): Remove. * gimple-fold.cc (INCLUDE_MEMORY): Remove. * gimple-harden-conditionals.cc (INCLUDE_MEMORY): Remove. * gimple-harden-control-flow.cc (INCLUDE_MEMORY): Remove. * gimple-if-to-switch.cc (INCLUDE_MEMORY): Remove. * gimple-loop-interchange.cc (INCLUDE_MEMORY): Remove. * gimple-loop-jam.cc (INCLUDE_MEMORY): Remove. * gimple-loop-versioning.cc (INCLUDE_MEMORY): Remove. * gimple-lower-bitint.cc (INCLUDE_MEMORY): Remove. * gimple-predicate-analysis.cc (INCLUDE_MEMORY): Remove. * gimple-pretty-print.cc (INCLUDE_MEMORY): Remove. * gimple-range-cache.cc (INCLUDE_MEMORY): Remove. * gimple-range-edge.cc (INCLUDE_MEMORY): Remove. * gimple-range-fold.cc (INCLUDE_MEMORY): Remove. * gimple-range-gori.cc (INCLUDE_MEMORY): Remove. * gimple-range-infer.cc (INCLUDE_MEMORY): Remove. * gimple-range-op.cc (INCLUDE_MEMORY): Remove. * gimple-range-path.cc (INCLUDE_MEMORY): Remove. * gimple-range-phi.cc (INCLUDE_MEMORY): Remove. * gimple-range-trace.cc (INCLUDE_MEMORY): Remove. * gimple-range.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-backprop.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-sprintf.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-store-merging.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-strength-reduction.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-access.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-alloca.cc (INCLUDE_MEMORY): Remove. * gimple-ssa-warn-restrict.cc (INCLUDE_MEMORY): Remove. * gimple-streamer-in.cc (INCLUDE_MEMORY): Remove. * gimple-streamer-out.cc (INCLUDE_MEMORY): Remove. * gimple.cc (INCLUDE_MEMORY): Remove. * gimplify.cc (INCLUDE_MEMORY): Remove. * graph.cc (INCLUDE_MEMORY): Remove. * graphite-dependences.cc (INCLUDE_MEMORY): Remove. * graphite-isl-ast-to-gimple.cc (INCLUDE_MEMORY): Remove. * graphite-optimize-isl.cc (INCLUDE_MEMORY): Remove. * graphite-poly.cc (INCLUDE_MEMORY): Remove. * graphite-scop-detection.cc (INCLUDE_MEMORY): Remove. * graphite-sese-to-poly.cc (INCLUDE_MEMORY): Remove. * graphite.cc (INCLUDE_MEMORY): Remove. * graphviz.cc (INCLUDE_MEMORY): Remove. * input.cc (INCLUDE_MEMORY): Remove. * ipa-cp.cc (INCLUDE_MEMORY): Remove. * ipa-devirt.cc (INCLUDE_MEMORY): Remove. * ipa-fnsummary.cc (INCLUDE_MEMORY): Remove. * ipa-free-lang-data.cc (INCLUDE_MEMORY): Remove. * ipa-icf-gimple.cc (INCLUDE_MEMORY): Remove. * ipa-icf.cc (INCLUDE_MEMORY): Remove. * ipa-inline-analysis.cc (INCLUDE_MEMORY): Remove. * ipa-inline.cc (INCLUDE_MEMORY): Remove. * ipa-modref-tree.cc (INCLUDE_MEMORY): Remove. * ipa-modref.cc (INCLUDE_MEMORY): Remove. * ipa-param-manipulation.cc (INCLUDE_MEMORY): Remove. * ipa-polymorphic-call.cc (INCLUDE_MEMORY): Remove. * ipa-predicate.cc (INCLUDE_MEMORY): Remove. * ipa-profile.cc (INCLUDE_MEMORY): Remove. * ipa-prop.cc (INCLUDE_MEMORY): Remove. * ipa-pure-const.cc (INCLUDE_MEMORY): Remove. * ipa-reference.cc (INCLUDE_MEMORY): Remove. * ipa-split.cc (INCLUDE_MEMORY): Remove. * ipa-sra.cc (INCLUDE_MEMORY): Remove. * ipa-strub.cc (INCLUDE_MEMORY): Remove. * ipa-utils.cc (INCLUDE_MEMORY): Remove. * json-parsing.cc (INCLUDE_MEMORY): Remove. * json.cc (INCLUDE_MEMORY): Remove. * json.h: Don't check INCLUDE_MEMORY. * langhooks.cc (INCLUDE_MEMORY): Remove. * late-combine.cc (INCLUDE_MEMORY): Remove. * lazy-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * libdiagnostics.cc (INCLUDE_MEMORY): Remove. * libsarifreplay.cc (INCLUDE_MEMORY): Remove. * lto-cgraph.cc (INCLUDE_MEMORY): Remove. * lto-compress.cc (INCLUDE_MEMORY): Remove. * lto-opts.cc (INCLUDE_MEMORY): Remove. * lto-section-in.cc (INCLUDE_MEMORY): Remove. * lto-section-out.cc (INCLUDE_MEMORY): Remove. * lto-streamer-in.cc (INCLUDE_MEMORY): Remove. * lto-streamer-out.cc (INCLUDE_MEMORY): Remove. * lto-streamer.cc (INCLUDE_MEMORY): Remove. * lto-wrapper.cc (INCLUDE_MEMORY): Remove. * make-unique.h (GCC_MAKE_UNIQUE): Remove. * multiple_target.cc (INCLUDE_MEMORY): Remove. * omp-expand.cc (INCLUDE_MEMORY): Remove. * omp-general.cc (INCLUDE_MEMORY): Remove. * omp-low.cc (INCLUDE_MEMORY): Remove. * omp-oacc-neuter-broadcast.cc (INCLUDE_MEMORY): Remove. * omp-offload.cc (INCLUDE_MEMORY): Remove. * omp-simd-clone.cc (INCLUDE_MEMORY): Remove. * opt-problem.cc (INCLUDE_MEMORY): Remove. * optinfo-emit-json.cc (INCLUDE_MEMORY): Remove. * optinfo.cc (INCLUDE_MEMORY): Remove. * optinfo.h: Don't check INCLUDE_MEMORY. * opts-common.cc (INCLUDE_MEMORY): Remove. * opts-diagnostic.cc (INCLUDE_MEMORY): Remove. * opts-global.cc (INCLUDE_MEMORY): Remove. * opts.cc (INCLUDE_MEMORY): Remove. * pair-fusion.cc (INCLUDE_MEMORY): Remove. * passes.cc (INCLUDE_MEMORY): Remove. * pointer-query.cc (INCLUDE_MEMORY): Remove. * predict.cc (INCLUDE_MEMORY): Remove. * pretty-print.cc (INCLUDE_MEMORY): Remove. * pretty-print.h: Don't check INCLUDE_MEMORY. * print-rtl.cc (INCLUDE_MEMORY): Remove. * print-tree.cc (INCLUDE_MEMORY): Remove. * profile-count.cc (INCLUDE_MEMORY): Remove. * range-op-float.cc (INCLUDE_MEMORY): Remove. * range-op-ptr.cc (INCLUDE_MEMORY): Remove. * range-op.cc (INCLUDE_MEMORY): Remove. * range.cc (INCLUDE_MEMORY): Remove. * read-rtl-function.cc (INCLUDE_MEMORY): Remove. * rtl-error.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/accesses.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/blocks.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/changes.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/functions.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/insns.cc (INCLUDE_MEMORY): Remove. * rtl-ssa/movement.cc (INCLUDE_MEMORY): Remove. * rtl-tests.cc (INCLUDE_MEMORY): Remove. * sanopt.cc (INCLUDE_MEMORY): Remove. * sched-rgn.cc (INCLUDE_MEMORY): Remove. * selftest-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * selftest-diagnostic.cc (INCLUDE_MEMORY): Remove. * selftest-json.cc (INCLUDE_MEMORY): Remove. * sese.cc (INCLUDE_MEMORY): Remove. * simple-diagnostic-path.cc (INCLUDE_MEMORY): Remove. * splay-tree-utils.cc (INCLUDE_MEMORY): Remove. * sreal.cc (INCLUDE_MEMORY): Remove. * stmt.cc (INCLUDE_MEMORY): Remove. * substring-locations.cc (INCLUDE_MEMORY): Remove. * symtab-clones.cc (INCLUDE_MEMORY): Remove. * symtab-thunks.cc (INCLUDE_MEMORY): Remove. * symtab.cc (INCLUDE_MEMORY): Remove. * system.h: Include memory unconditionally for C++. Also remove support for INCLUDE_MEMORY. * targhooks.cc (INCLUDE_MEMORY): Remove. * text-art/box-drawing.cc (INCLUDE_MEMORY): Remove. * text-art/canvas.cc (INCLUDE_MEMORY): Remove. * text-art/ruler.cc (INCLUDE_MEMORY): Remove. * text-art/selftests.cc (INCLUDE_MEMORY): Remove. * text-art/style.cc (INCLUDE_MEMORY): Remove. * text-art/styled-string.cc (INCLUDE_MEMORY): Remove. * text-art/table.cc (INCLUDE_MEMORY): Remove. * text-art/theme.cc (INCLUDE_MEMORY): Remove. * text-art/tree-widget.cc (INCLUDE_MEMORY): Remove. * text-art/widget.cc (INCLUDE_MEMORY): Remove. * timevar.cc (INCLUDE_MEMORY): Remove. * toplev.cc (INCLUDE_MEMORY): Remove. * trans-mem.cc (INCLUDE_MEMORY): Remove. * tree-affine.cc (INCLUDE_MEMORY): Remove. * tree-assume.cc (INCLUDE_MEMORY): Remove. * tree-call-cdce.cc (INCLUDE_MEMORY): Remove. * tree-cfg.cc (INCLUDE_MEMORY): Remove. * tree-chrec.cc (INCLUDE_MEMORY): Remove. * tree-data-ref.cc (INCLUDE_MEMORY): Remove. * tree-dfa.cc (INCLUDE_MEMORY): Remove. * tree-diagnostic-client-data-hooks.cc (INCLUDE_MEMORY): Remove. * tree-diagnostic.cc (INCLUDE_MEMORY): Remove. * tree-dump.cc (INCLUDE_MEMORY): Remove. * tree-if-conv.cc (INCLUDE_MEMORY): Remove. * tree-inline.cc (INCLUDE_MEMORY): Remove. * tree-into-ssa.cc (INCLUDE_MEMORY): Remove. * tree-logical-location.cc (INCLUDE_MEMORY): Remove. * tree-loop-distribution.cc (INCLUDE_MEMORY): Remove. * tree-nested.cc (INCLUDE_MEMORY): Remove. * tree-nrv.cc (INCLUDE_MEMORY): Remove. * tree-object-size.cc (INCLUDE_MEMORY): Remove. * tree-outof-ssa.cc (INCLUDE_MEMORY): Remove. * tree-parloops.cc (INCLUDE_MEMORY): Remove. * tree-predcom.cc (INCLUDE_MEMORY): Remove. * tree-pretty-print.cc (INCLUDE_MEMORY): Remove. * tree-profile.cc (INCLUDE_MEMORY): Remove. * tree-scalar-evolution.cc (INCLUDE_MEMORY): Remove. * tree-sra.cc (INCLUDE_MEMORY): Remove. * tree-ssa-address.cc (INCLUDE_MEMORY): Remove. * tree-ssa-alias.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ccp.cc (INCLUDE_MEMORY): Remove. * tree-ssa-coalesce.cc (INCLUDE_MEMORY): Remove. * tree-ssa-copy.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dce.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dom.cc (INCLUDE_MEMORY): Remove. * tree-ssa-dse.cc (INCLUDE_MEMORY): Remove. * tree-ssa-forwprop.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ifcombine.cc (INCLUDE_MEMORY): Remove. * tree-ssa-live.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-im.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ivcanon.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-ivopts.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-manip.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-niter.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-prefetch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-split.cc (INCLUDE_MEMORY): Remove. * tree-ssa-loop-unswitch.cc (INCLUDE_MEMORY): Remove. * tree-ssa-math-opts.cc (INCLUDE_MEMORY): Remove. * tree-ssa-operands.cc (INCLUDE_MEMORY): Remove. * tree-ssa-phiopt.cc (INCLUDE_MEMORY): Remove. * tree-ssa-phiprop.cc (INCLUDE_MEMORY): Remove. * tree-ssa-pre.cc (INCLUDE_MEMORY): Remove. * tree-ssa-propagate.cc (INCLUDE_MEMORY): Remove. * tree-ssa-reassoc.cc (INCLUDE_MEMORY): Remove. * tree-ssa-sccvn.cc (INCLUDE_MEMORY): Remove. * tree-ssa-scopedtables.cc (INCLUDE_MEMORY): Remove. * tree-ssa-sink.cc (INCLUDE_MEMORY): Remove. * tree-ssa-strlen.cc (INCLUDE_MEMORY): Remove. * tree-ssa-structalias.cc (INCLUDE_MEMORY): Remove. * tree-ssa-ter.cc (INCLUDE_MEMORY): Remove. * tree-ssa-threadbackward.cc (INCLUDE_MEMORY): Remove. * tree-ssa-threadupdate.cc (INCLUDE_MEMORY): Remove. * tree-ssa-uninit.cc (INCLUDE_MEMORY): Remove. * tree-ssa.cc (INCLUDE_MEMORY): Remove. * tree-ssanames.cc (INCLUDE_MEMORY): Remove. * tree-stdarg.cc (INCLUDE_MEMORY): Remove. * tree-streamer-in.cc (INCLUDE_MEMORY): Remove. * tree-streamer-out.cc (INCLUDE_MEMORY): Remove. * tree-streamer.cc (INCLUDE_MEMORY): Remove. * tree-switch-conversion.cc (INCLUDE_MEMORY): Remove. * tree-tailcall.cc (INCLUDE_MEMORY): Remove. * tree-vect-data-refs.cc (INCLUDE_MEMORY): Remove. * tree-vect-generic.cc (INCLUDE_MEMORY): Remove. * tree-vect-loop-manip.cc (INCLUDE_MEMORY): Remove. * tree-vect-loop.cc (INCLUDE_MEMORY): Remove. * tree-vect-patterns.cc (INCLUDE_MEMORY): Remove. * tree-vect-slp-patterns.cc (INCLUDE_MEMORY): Remove. * tree-vect-slp.cc (INCLUDE_MEMORY): Remove. * tree-vect-stmts.cc (INCLUDE_MEMORY): Remove. * tree-vectorizer.cc (INCLUDE_MEMORY): Remove. * tree-vrp.cc (INCLUDE_MEMORY): Remove. * tree.cc (INCLUDE_MEMORY): Remove. * ubsan.cc (INCLUDE_MEMORY): Remove. * value-pointer-equiv.cc (INCLUDE_MEMORY): Remove. * value-prof.cc (INCLUDE_MEMORY): Remove. * value-query.cc (INCLUDE_MEMORY): Remove. * value-range-pretty-print.cc (INCLUDE_MEMORY): Remove. * value-range-storage.cc (INCLUDE_MEMORY): Remove. * value-range.cc (INCLUDE_MEMORY): Remove. * value-relation.cc (INCLUDE_MEMORY): Remove. * var-tracking.cc (INCLUDE_MEMORY): Remove. * varpool.cc (INCLUDE_MEMORY): Remove. * vr-values.cc (INCLUDE_MEMORY): Remove. * wide-int-print.cc (INCLUDE_MEMORY): Remove. gcc/c-family/ChangeLog: * c-ada-spec.cc (INCLUDE_MEMORY): Remove. * c-attribs.cc (INCLUDE_MEMORY): Remove. * c-common.cc (INCLUDE_MEMORY): Remove. * c-format.cc (INCLUDE_MEMORY): Remove. * c-gimplify.cc (INCLUDE_MEMORY): Remove. * c-indentation.cc (INCLUDE_MEMORY): Remove. * c-opts.cc (INCLUDE_MEMORY): Remove. * c-pch.cc (INCLUDE_MEMORY): Remove. * c-pragma.cc (INCLUDE_MEMORY): Remove. * c-pretty-print.cc (INCLUDE_MEMORY): Remove. * c-type-mismatch.cc (INCLUDE_MEMORY): Remove. * c-warn.cc (INCLUDE_MEMORY): Remove. * known-headers.cc (INCLUDE_MEMORY): Remove. * name-hint.h: Remove check of INCLUDE_MEMORY. gcc/c/ChangeLog: * c-aux-info.cc (INCLUDE_MEMORY): Remove. * c-convert.cc (INCLUDE_MEMORY): Remove. * c-decl.cc (INCLUDE_MEMORY): Remove. * c-errors.cc (INCLUDE_MEMORY): Remove. * c-fold.cc (INCLUDE_MEMORY): Remove. * c-lang.cc (INCLUDE_MEMORY): Remove. * c-objc-common.cc (INCLUDE_MEMORY): Remove. * c-parser.cc (INCLUDE_MEMORY): Remove. * c-typeck.cc (INCLUDE_MEMORY): Remove. * gimple-parser.cc (INCLUDE_MEMORY): Remove. gcc/cp/ChangeLog: * call.cc (INCLUDE_MEMORY): Remove. * class.cc (INCLUDE_MEMORY): Remove. * constexpr.cc (INCLUDE_MEMORY): Remove. * constraint.cc (INCLUDE_MEMORY): Remove. * contracts.cc (INCLUDE_MEMORY): Remove. * coroutines.cc (INCLUDE_MEMORY): Remove. * cp-gimplify.cc (INCLUDE_MEMORY): Remove. * cp-lang.cc (INCLUDE_MEMORY): Remove. * cp-objcp-common.cc (INCLUDE_MEMORY): Remove. * cp-ubsan.cc (INCLUDE_MEMORY): Remove. * cvt.cc (INCLUDE_MEMORY): Remove. * cxx-pretty-print.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * decl2.cc (INCLUDE_MEMORY): Remove. * dump.cc (INCLUDE_MEMORY): Remove. * error.cc (INCLUDE_MEMORY): Remove. * except.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * friend.cc (INCLUDE_MEMORY): Remove. * init.cc (INCLUDE_MEMORY): Remove. * lambda.cc (INCLUDE_MEMORY): Remove. * lex.cc (INCLUDE_MEMORY): Remove. * logic.cc (INCLUDE_MEMORY): Remove. * mangle.cc (INCLUDE_MEMORY): Remove. * mapper-client.cc (INCLUDE_MEMORY): Remove. * mapper-resolver.cc (INCLUDE_MEMORY): Remove. * method.cc (INCLUDE_MEMORY): Remove. * module.cc (INCLUDE_MEMORY): Remove. * name-lookup.cc (INCLUDE_MEMORY): Remove. * optimize.cc (INCLUDE_MEMORY): Remove. * parser.cc (INCLUDE_MEMORY): Remove. * pt.cc (INCLUDE_MEMORY): Remove. * ptree.cc (INCLUDE_MEMORY): Remove. * rtti.cc (INCLUDE_MEMORY): Remove. * search.cc (INCLUDE_MEMORY): Remove. * semantics.cc (INCLUDE_MEMORY): Remove. * tree.cc (INCLUDE_MEMORY): Remove. * typeck.cc (INCLUDE_MEMORY): Remove. * typeck2.cc (INCLUDE_MEMORY): Remove. * vtable-class-hierarchy.cc (INCLUDE_MEMORY): Remove. gcc/d/ChangeLog: * d-attribs.cc (INCLUDE_MEMORY): Remove. * d-builtins.cc (INCLUDE_MEMORY): Remove. * d-codegen.cc (INCLUDE_MEMORY): Remove. * d-convert.cc (INCLUDE_MEMORY): Remove. * d-diagnostic.cc (INCLUDE_MEMORY): Remove. * d-frontend.cc (INCLUDE_MEMORY): Remove. * d-lang.cc (INCLUDE_MEMORY): Remove. * d-longdouble.cc (INCLUDE_MEMORY): Remove. * d-target.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * intrinsics.cc (INCLUDE_MEMORY): Remove. * modules.cc (INCLUDE_MEMORY): Remove. * toir.cc (INCLUDE_MEMORY): Remove. * typeinfo.cc (INCLUDE_MEMORY): Remove. * types.cc (INCLUDE_MEMORY): Remove. gcc/fortran/ChangeLog: * arith.cc (INCLUDE_MEMORY): Remove. * array.cc (INCLUDE_MEMORY): Remove. * bbt.cc (INCLUDE_MEMORY): Remove. * check.cc (INCLUDE_MEMORY): Remove. * class.cc (INCLUDE_MEMORY): Remove. * constructor.cc (INCLUDE_MEMORY): Remove. * convert.cc (INCLUDE_MEMORY): Remove. * cpp.cc (INCLUDE_MEMORY): Remove. * data.cc (INCLUDE_MEMORY): Remove. * decl.cc (INCLUDE_MEMORY): Remove. * dependency.cc (INCLUDE_MEMORY): Remove. * dump-parse-tree.cc (INCLUDE_MEMORY): Remove. * error.cc (INCLUDE_MEMORY): Remove. * expr.cc (INCLUDE_MEMORY): Remove. * f95-lang.cc (INCLUDE_MEMORY): Remove. * frontend-passes.cc (INCLUDE_MEMORY): Remove. * interface.cc (INCLUDE_MEMORY): Remove. * intrinsic.cc (INCLUDE_MEMORY): Remove. * io.cc (INCLUDE_MEMORY): Remove. * iresolve.cc (INCLUDE_MEMORY): Remove. * match.cc (INCLUDE_MEMORY): Remove. * matchexp.cc (INCLUDE_MEMORY): Remove. * misc.cc (INCLUDE_MEMORY): Remove. * module.cc (INCLUDE_MEMORY): Remove. * openmp.cc (INCLUDE_MEMORY): Remove. * options.cc (INCLUDE_MEMORY): Remove. * parse.cc (INCLUDE_MEMORY): Remove. * primary.cc (INCLUDE_MEMORY): Remove. * resolve.cc (INCLUDE_MEMORY): Remove. * scanner.cc (INCLUDE_MEMORY): Remove. * simplify.cc (INCLUDE_MEMORY): Remove. * st.cc (INCLUDE_MEMORY): Remove. * symbol.cc (INCLUDE_MEMORY): Remove. * target-memory.cc (INCLUDE_MEMORY): Remove. * trans-array.cc (INCLUDE_MEMORY): Remove. * trans-common.cc (INCLUDE_MEMORY): Remove. * trans-const.cc (INCLUDE_MEMORY): Remove. * trans-decl.cc (INCLUDE_MEMORY): Remove. * trans-expr.cc (INCLUDE_MEMORY): Remove. * trans-intrinsic.cc (INCLUDE_MEMORY): Remove. * trans-io.cc (INCLUDE_MEMORY): Remove. * trans-openmp.cc (INCLUDE_MEMORY): Remove. * trans-stmt.cc (INCLUDE_MEMORY): Remove. * trans-types.cc (INCLUDE_MEMORY): Remove. * trans.cc (INCLUDE_MEMORY): Remove. gcc/go/ChangeLog: * go-backend.cc (INCLUDE_MEMORY): Remove. * go-lang.cc (INCLUDE_MEMORY): Remove. gcc/jit/ChangeLog: * dummy-frontend.cc (INCLUDE_MEMORY): Remove. * jit-playback.cc (INCLUDE_MEMORY): Remove. * jit-recording.cc (INCLUDE_MEMORY): Remove. gcc/lto/ChangeLog: * lto-common.cc (INCLUDE_MEMORY): Remove. * lto-dump.cc (INCLUDE_MEMORY): Remove. * lto-partition.cc (INCLUDE_MEMORY): Remove. * lto-symtab.cc (INCLUDE_MEMORY): Remove. * lto.cc (INCLUDE_MEMORY): Remove. gcc/m2/ChangeLog: * gm2-gcc/gcc-consolidation.h (INCLUDE_MEMORY): Remove. * gm2-gcc/m2configure.cc (INCLUDE_MEMORY): Remove. * mc-boot/GASCII.cc (INCLUDE_MEMORY): Remove. * mc-boot/GASCII.h (INCLUDE_MEMORY): Remove. * mc-boot/GArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GAssertion.cc (INCLUDE_MEMORY): Remove. * mc-boot/GAssertion.h (INCLUDE_MEMORY): Remove. * mc-boot/GBreak.cc (INCLUDE_MEMORY): Remove. * mc-boot/GBreak.h (INCLUDE_MEMORY): Remove. * mc-boot/GCOROUTINES.h (INCLUDE_MEMORY): Remove. * mc-boot/GCmdArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GCmdArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GDebug.cc (INCLUDE_MEMORY): Remove. * mc-boot/GDebug.h (INCLUDE_MEMORY): Remove. Remove. * mc-boot/GDynamicStrings.cc (INCLUDE_MEMORY): Remove. * mc-boot/GDynamicStrings.h (INCLUDE_MEMORY): Remove. * mc-boot/GEnvironment.cc (INCLUDE_MEMORY): Remove. * mc-boot/GEnvironment.h (INCLUDE_MEMORY): Remove. * mc-boot/GFIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GFormatStrings.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFormatStrings.h (INCLUDE_MEMORY): Remove. * mc-boot/GFpuIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GFpuIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GIndexing.cc (INCLUDE_MEMORY): Remove. * mc-boot/GIndexing.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2Dependent.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2Dependent.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2EXCEPTION.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2EXCEPTION.h (INCLUDE_MEMORY): Remove. * mc-boot/GM2RTS.cc (INCLUDE_MEMORY): Remove. * mc-boot/GM2RTS.h (INCLUDE_MEMORY): Remove. Remove. * mc-boot/GMemUtils.cc (INCLUDE_MEMORY): Remove. * mc-boot/GMemUtils.h (INCLUDE_MEMORY): Remove. * mc-boot/GNumberIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GNumberIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GPushBackInput.cc (INCLUDE_MEMORY): Remove. * mc-boot/GPushBackInput.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTExceptions.cc (INCLUDE_MEMORY): Remove. * mc-boot/GRTExceptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTco.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTentity.h (INCLUDE_MEMORY): Remove. * mc-boot/GRTint.cc (INCLUDE_MEMORY): Remove. * mc-boot/GRTint.h (INCLUDE_MEMORY): Remove. * mc-boot/GSArgs.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/GSFIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSFIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GSYSTEM.h (INCLUDE_MEMORY): Remove. * mc-boot/GSelective.h (INCLUDE_MEMORY): Remove. * mc-boot/GStdIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStdIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GStorage.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStorage.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrCase.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrCase.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrIO.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrIO.h (INCLUDE_MEMORY): Remove. * mc-boot/GStrLib.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStrLib.h (INCLUDE_MEMORY): Remove. * mc-boot/GStringConvert.cc (INCLUDE_MEMORY): Remove. * mc-boot/GStringConvert.h (INCLUDE_MEMORY): Remove. * mc-boot/GSysExceptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GSysStorage.cc (INCLUDE_MEMORY): Remove. * mc-boot/GSysStorage.h (INCLUDE_MEMORY): Remove. * mc-boot/GTimeString.cc (INCLUDE_MEMORY): Remove. * mc-boot/GTimeString.h (INCLUDE_MEMORY): Remove. * mc-boot/GUnixArgs.h (INCLUDE_MEMORY): Remove. * mc-boot/Galists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Galists.h (INCLUDE_MEMORY): Remove. * mc-boot/Gdecl.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gdecl.h (INCLUDE_MEMORY): Remove. * mc-boot/Gdtoa.h (INCLUDE_MEMORY): Remove. * mc-boot/Gerrno.h (INCLUDE_MEMORY): Remove. * mc-boot/Gkeyc.cc (INCLUDE_MEMORY): Remove. (checkGccConfigSystem): Remove printing out `#define INCLUDE_MEMORY`. * mc-boot/Gkeyc.h (INCLUDE_MEMORY): Remove. * mc-boot/Gldtoa.h (INCLUDE_MEMORY): Remove. * mc-boot/Glibc.h (INCLUDE_MEMORY): Remove. * mc-boot/Glibm.h (INCLUDE_MEMORY): Remove. * mc-boot/Glists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Glists.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcComment.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcComment.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcComp.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcComp.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcDebug.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcDebug.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcError.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcError.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcFileName.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcFileName.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcLexBuf.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcLexBuf.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcMetaError.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcMetaError.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcOptions.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcOptions.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPreprocess.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPreprocess.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPretty.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPretty.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcPrintf.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcPrintf.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcQuiet.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcQuiet.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcReserved.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcReserved.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcSearch.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcSearch.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcStack.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcStack.h (INCLUDE_MEMORY): Remove. * mc-boot/GmcStream.cc (INCLUDE_MEMORY): Remove. * mc-boot/GmcStream.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcflex.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp1.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp1.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp2.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp2.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp3.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp3.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp4.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp4.h (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp5.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gmcp5.h (INCLUDE_MEMORY): Remove. * mc-boot/GnameKey.cc (INCLUDE_MEMORY): Remove. * mc-boot/GnameKey.h (INCLUDE_MEMORY): Remove. * mc-boot/GsymbolKey.cc (INCLUDE_MEMORY): Remove. * mc-boot/GsymbolKey.h (INCLUDE_MEMORY): Remove. * mc-boot/Gtermios.h (INCLUDE_MEMORY): Remove. * mc-boot/Gtop.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gvarargs.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gvarargs.h (INCLUDE_MEMORY): Remove. * mc-boot/Gwlists.cc (INCLUDE_MEMORY): Remove. * mc-boot/Gwlists.h (INCLUDE_MEMORY): Remove. * mc-boot/Gwrapc.h (INCLUDE_MEMORY): Remove. * pge-boot/GIndexing.h (INCLUDE_MEMORY): Remove. * pge-boot/GSEnvironment.h (INCLUDE_MEMORY): Remove. * pge-boot/GScan.h (INCLUDE_MEMORY): Remove. gcc/objc/ChangeLog: * objc-act.cc (INCLUDE_MEMORY): Remove. * objc-encoding.cc (INCLUDE_MEMORY): Remove. * objc-gnu-runtime-abi-01.cc (INCLUDE_MEMORY): Remove. * objc-lang.cc (INCLUDE_MEMORY): Remove. * objc-next-runtime-abi-01.cc (INCLUDE_MEMORY): Remove. * objc-next-runtime-abi-02.cc (INCLUDE_MEMORY): Remove. * objc-runtime-shared-support.cc (INCLUDE_MEMORY): Remove. gcc/objcp/ChangeLog: * objcp-decl.cc (INCLUDE_MEMORY): Remove. * objcp-lang.cc (INCLUDE_MEMORY): Remove. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (INCLUDE_MEMORY): Remove. * rust-attribs.cc (INCLUDE_MEMORY): Remove. * rust-system.h (INCLUDE_MEMORY): Remove. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>