Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch implements C++26 Pack Indexing, as described in
<https://wg21.link/P2662R3>.
The issue discussing how to mangle pack indexes has not been resolved
yet <https://github.com/itanium-cxx-abi/cxx-abi/issues/175> and I've
made no attempt to address it so far.
Unlike v1, which used augmented TYPE/EXPR_PACK_EXPANSION codes, this
version introduces two new codes: PACK_INDEX_EXPR and PACK_INDEX_TYPE.
Both carry two operands: the pack expansion and the index. They are
handled in tsubst_pack_index: substitute the index and the pack and
then extract the element from the vector (if possible).
To handle pack indexing in a decltype or with decltype(auto), there is
also the new PACK_INDEX_PARENTHESIZED_P flag.
With this feature, it's valid to write something like
using U = tmpl<Ts...[Is]...>;
where we first expand the template argument into
Ts...[Is#0], Ts...[Is#1], ...
and then substitute each individual pack index.
PR c++/113798
gcc/cp/ChangeLog:
* constexpr.cc (potential_constant_expression_1) <case PACK_INDEX_EXPR>:
New case.
* cp-objcp-common.cc (cp_common_init_ts): Mark PACK_INDEX_TYPE and
PACK_INDEX_EXPR.
* cp-tree.def (PACK_INDEX_TYPE): New.
(PACK_INDEX_EXPR): New.
* cp-tree.h (WILDCARD_TYPE_P): Also check PACK_INDEX_TYPE.
(PACK_INDEX_CHECK): Define.
(PACK_INDEX_P): Define.
(PACK_INDEX_PACK): Define.
(PACK_INDEX_INDEX): Define.
(PACK_INDEX_PARENTHESIZED_P): Define.
(make_pack_index): Declare.
(pack_index_element): Declare.
* cxx-pretty-print.cc (cxx_pretty_printer::expression) <case
PACK_INDEX_EXPR>: New case.
(cxx_pretty_printer::type_id) <case PACK_INDEX_TYPE>: New case.
* error.cc (dump_type) <case PACK_INDEX_TYPE>: New case.
(dump_type_prefix): Handle PACK_INDEX_TYPE.
(dump_type_suffix): Likewise.
(dump_expr) <case PACK_INDEX_EXPR>: New case.
* mangle.cc (write_type) <case PACK_INDEX_TYPE>: New case.
* module.cc (trees_out::type_node) <case PACK_INDEX_TYPE>: New case.
(trees_in::tree_node) <case PACK_INDEX_TYPE>: New case.
* parser.cc (cp_parser_next_tokens_are_pack_index_p): New.
(cp_parser_pack_index): New.
(cp_parser_primary_expression): Handle a C++26 pack-index-expression.
(cp_parser_unqualified_id): Handle a C++26 pack-index-specifier.
(cp_parser_nested_name_specifier_opt): See if a pack-index-specifier
follows.
(cp_parser_qualifying_entity): Handle a C++26 pack-index-specifier.
(cp_parser_decltype_expr): Set id_expression_or_member_access_p for
pack indexing.
(cp_parser_mem_initializer_id): Handle a C++26 pack-index-specifier.
(cp_parser_simple_type_specifier): Likewise.
(cp_parser_base_specifier): Likewise.
* pt.cc (iterative_hash_template_arg) <case PACK_INDEX_TYPE,
PACK_INDEX_EXPR>: New case.
(find_parameter_packs_r) <case PACK_INDEX_TYPE, PACK_INDEX_EXPR>: New
case.
(make_pack_index): New.
(tsubst_pack_index): New.
(tsubst): Avoid tsubst on PACK_INDEX_TYPE.
<case TYPENAME_TYPE>: Add a call to error.
<case PACK_INDEX_TYPE>: New case.
(tsubst_expr) <case PACK_INDEX_EXPR>: New case.
(dependent_type_p_r): Return true for PACK_INDEX_TYPE.
(type_dependent_expression_p): Recurse on PACK_INDEX_PACK for
PACK_INDEX_EXPR.
* ptree.cc (cxx_print_type) <case PACK_INDEX_TYPE>: New case.
* semantics.cc (finish_parenthesized_expr): Set
PACK_INDEX_PARENTHESIZED_P for PACK_INDEX_EXPR.
(finish_type_pack_element): Adjust error messages.
(pack_index_element): New.
* tree.cc (cp_tree_equal) <case PACK_INDEX_EXPR>: New case.
(cp_walk_subtrees) <case PACK_INDEX_TYPE, PACK_INDEX_EXPR>: New case.
* typeck.cc (structural_comptypes) <case PACK_INDEX_TYPE>: New case.
libstdc++-v3/ChangeLog:
* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust
dg-prune-output.
gcc/testsuite/ChangeLog:
* g++.dg/cpp26/pack-indexing1.C: New test.
* g++.dg/cpp26/pack-indexing2.C: New test.
* g++.dg/cpp26/pack-indexing3.C: New test.
* g++.dg/cpp26/pack-indexing4.C: New test.
* g++.dg/cpp26/pack-indexing5.C: New test.
* g++.dg/cpp26/pack-indexing6.C: New test.
* g++.dg/cpp26/pack-indexing7.C: New test.
* g++.dg/cpp26/pack-indexing8.C: New test.
* g++.dg/cpp26/pack-indexing9.C: New test.
* g++.dg/cpp26/pack-indexing10.C: New test.
* g++.dg/cpp26/pack-indexing11.C: New test.
* g++.dg/modules/pack-index-1_a.C: New test.
* g++.dg/modules/pack-index-1_b.C: New test.
|
|
Here we weren't emitting the guard variable for 'a' when we emitted 'afn'
in the importer, because we only treated inline variables as needing that.
Fixed by generalizing to vague_linkage_p.
But we need to specifically exempt vtables, because the rest of the module
code handles them specially and expects them to be DECL_EXTERNAL.
gcc/cp/ChangeLog:
* module.cc (trees_out::core_bools): Check vague_linkage_p.
(has_definition): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/static-3_b.C: New test.
* g++.dg/modules/static-3_a.H: New test.
|
|
The modules implementation is necessarily sensitive to the internal workings
of class line_map, and so it needed changes in order to handle a 64-bit
location_t. The changes mostly boil down to supporting that in the debug
dumping routines (which is accomplished by using a new custom code %K for
that purpose), and supporting that when streaming in and out from the
module (which is accomplished by using a new loc() function to go along with
existing abstractions like u() or z() for streaming in and out different
data types).
gcc/cp/ChangeLog:
* module.cc (bytes_out::loc): New function.
(bytes_in::loc): New function.
(struct span): Change int fields to location_diff_t.
(range_t): Change from "unsigned int" to "line_map_uint_t".
(struct ord_loc_info): Likewise.
(struct macro_loc_info): Likewise.
(class module_state): Likewise.
(dumper::operator()): Add new code 'K' for dumping a location_t.
(loc_spans::init): Use %K instead of %u for location_t dumps.
(loc_spans::open): Likewise.
(loc_spans::close): Likewise. Adjust bitwise expressions to support
64-bit location_t as well.
(struct module_state_config): Change ordinary_locs and macro_locs
from "unsigned int" to "line_map_uint_t". Reorder fields to improve
packing. Rather than changing the constructor initializer list to
match the new order, switch to NSDMI instead.
(module_state::note_location): Adjust to support 64-bit location_t.
(module_state::write_location): Use %K instead of %u for location_t
dumps. Use loc() instead of u() for streaming location_t.
(module_state::read_location): Likewise.
(module_state::write_ordinary_maps): Likewise.
(module_state::write_macro_maps): Likewise.
(module_state::write_config): Likewise.
(module_state::read_config): Likewise.
(module_state::write_prepare_maps): Use %K instead of %u for
location_t dumps. Adjust variable types and bitwise expressions to
support 64-bit location_t.
(module_state::read_ordinary_maps): Likewise.
(module_state::read_macro_maps): Likewise.
(preprocess_module): Adjust data types to support 64-bit number of
line maps.
|
|
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>
|
|
We weren't writing out the definition of an inline variable, so the importer
either got an undefined symbol or 0.
gcc/cp/ChangeLog:
* module.cc (has_definition): Also true for inline vars.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inline-1_a.C: New test.
* g++.dg/modules/inline-1_b.C: New test.
|
|
21_strings/basic_string/operations/contains/nonnull.cc was failing because
the module was built with debug markers and the testcase was built not
expecting debug markers, so we crashed in lower_stmt. Let's accommodate
this by discarding debug marker statements we don't want.
gcc/cp/ChangeLog:
* module.cc (trees_in::core_vals) [STATEMENT_LIST]: Skip
DEBUG_BEGIN_STMT if !MAY_HAVE_DEBUG_MARKER_STMTS.
|
|
While experimenting with testing module std I noticed that gcc -M broke on
it; it seems I need to set directives_only even sooner than I did in
r15-4219.
gcc/c-family/ChangeLog:
* c-ppoutput.cc (preprocess_file): Don't set directives_only here.
gcc/cp/ChangeLog:
* module.cc (module_preprocess_options): Set directives_only here.
|
|
The C++ modules code has a -fmodule-header (or -x c++-{user,system}-header)
option to specify looking up headers to compile to header units on the usual
include paths. I'd like to have the same functionality for full C++20
modules such as module std, which I proposed to live on the include path at
bits/std.cc. But this behavior doesn't seem necessarily connected to
modules, so I'm proposing a general C/C++ option to specify the behavior of
looking in the include path for the input files specified on the command
line.
Other ideas for the name of the option are very welcome.
The libcpp change is to allow -fsearch-include-path{,=user} to find files in
the current working directory, like -include. This can be handy for a quick
compile of both std.cc and a file that imports it, e.g.
g++ -std=c++20 -fmodules -fsearch-include-path bits/std.cc importer.cc
gcc/ChangeLog:
* doc/cppopts.texi: Document -fsearch-include-path.
* doc/invoke.texi: Mention it for modules.
gcc/c-family/ChangeLog:
* c.opt: Add -fsearch-include-path.
* c-opts.cc (c_common_post_options): Handle it.
gcc/cp/ChangeLog:
* module.cc (module_preprocess_options): Don't override it.
libcpp/ChangeLog:
* internal.h (search_path_head): Declare.
* files.cc (search_path_head): No longer static.
* init.cc (cpp_read_main_file): Use it.
|
|
Coroutines have been enabled by -std=c++20 since GCC 11.
gcc/cp/ChangeLog:
* module.cc (module_state_config::get_dialect): Expect coroutines in
C++20.
|
|
When merging a newly imported declaration with an existing declaration
we don't currently propagate new default arguments, which causes issues
when modularising header units. This patch adds logic to propagate
default arguments to existing declarations on import, and error if the
defaults do not match.
PR c++/99274
gcc/cp/ChangeLog:
* module.cc (trees_in::is_matching_decl): Merge default
arguments.
* tree.cc (cp_tree_equal) <AGGR_INIT_EXPR>: Handle unification
of AGGR_INIT_EXPRs with new VAR_DECL slots.
gcc/testsuite/ChangeLog:
* g++.dg/modules/lambda-7.h: Skip ODR-violating declaration when
testing ODR deduplication.
* g++.dg/modules/lambda-7_b.C: Note we're testing ODR
deduplication.
* g++.dg/modules/default-arg-1_a.H: New test.
* g++.dg/modules/default-arg-1_b.C: New test.
* g++.dg/modules/default-arg-2_a.H: New test.
* g++.dg/modules/default-arg-2_b.C: New test.
* g++.dg/modules/default-arg-3.h: New test.
* g++.dg/modules/default-arg-3_a.H: New test.
* g++.dg/modules/default-arg-3_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
The 'location_t' type currently only stores a limited number of distinct
locations. In some cases, if many modules are imported that sum up to a
large number of locations, we may run out of room to represent new
locations for these imported declarations. In such a case, any new
declarations from the affected modules simply get given a location of
"the module interface as a whole".
'write_location' sometimes gets confused when this happens: it finds that
the location is a location we've noted to get streamed out, but it's
inconsistent whether it's an ordinary location from the current module
or an imported location from a different module. This causes
random-looking locations to be associated with these declarations, and
occasionally (checking-only) ICEs.
This patch fixes the issue by first checking whether an ordinary
location represents a module (rather than a location inside a module);
if so, we instead write the location of the point that we imported this
module. This will continue recursively in case the importing location
also was not able to be stored.
We only need to handle this in the IS_ORDINARY_LOC case: even for
locations originally within macro expansions, the remapping logic for
location exhaustion will make them look like ordinary locs again.
This is a relatively expensive addition, so this new check only occurs
if we've noted resource exhaustion has occurred while preparing imported
line maps, or in checking builds.
PR c++/105443
gcc/cp/ChangeLog:
* module.cc (loc_spans::locs_exhausted_p): New field.
(loc_spans::loc_spans): Initialise it.
(loc_spans::locations_exhausted_p): New function.
(module_state::read_prepare_maps): Move inform into...
(loc_spans::report_location_exhaustion): ...this new function.
(module_state::write_location): Check for writing module
locations stored due to resource exhaustion.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
In cases like the linked PR we sometimes get mutually recursive
dependencies that both rely on the other to have been streamed as part
of their merge key information. In the linked PR, this causes an ICE.
The root cause is that 'sort_cluster' is not correctly ordering the
dependencies; both the element_t specialisation and the
reverse_adaptor::first function decl depend on each other, but by
streaming element_t first it ends up trying to stream itself recursively
as part of calculating its own merge key, which apart from the checking
ICE will also cause issues on stream-in, as the merge key will not
properly stream.
There is a comment already in 'sort_cluster' describing this issue, but
it says:
Finding the single cluster entry dep is very tricky and
expensive. Let's just not do that. It's harmless in this case
anyway.
However in this case it was not harmless: it's just somewhat luck that
the sorting happened to work for the existing cases in the testsuite.
This patch solves the issue by noting any declarations that rely on deps
first seen within their own merge key. This declaration gets marked as
an "entry" dep; any of these deps that end up recursively referring back
to that entry dep as part of their own merge key do not.
Then within sort_cluster we can ensure that the entry dep is written to
be streamed first of its cluster; this will ensure that any other deps
are just emitted as back-references, and the mergeable dep itself will
structurally decompose.
PR c++/116317
gcc/cp/ChangeLog:
* module.cc
(depset::DB_MAYBE_RECURSIVE_BIT): New flag.
(depset::DB_ENTRY_BIT): New flag.
(depset::is_maybe_recursive): New accessor.
(depset::is_entry): New accessor.
(depset::hash::writing_merge_key): New field.
(trees_out::decl_value): Inform dep_hash while we're writing the
merge key information for a decl.
(depset::hash::add_dependency): Find recursive deps and mark the
entry point.
(sort_cluster): Ensure that the entry dep is streamed first.
gcc/testsuite/ChangeLog:
* g++.dg/modules/late-ret-4_a.H: New test.
* g++.dg/modules/late-ret-4_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
This patch generalizes diagnostic_context so that rather than having
a single output format, it has a vector of zero or more.
It adds new two options:
-fdiagnostics-add-output=DIAGNOSTICS-OUTPUT-SPEC
-fdiagnostics-set-output=DIAGNOSTICS-OUTPUT-SPEC
which both take a new configuration syntax of the form SCHEME ("text" or
"sarif"), optionally followed by ":" and one or more KEY=VALUE pairs,
in this form:
<SCHEME>
<SCHEME>:<KEY>=<VALUE>
<SCHEME>:<KEY>=<VALUE>,<KEY2>=<VALUE2>
...etc
where each SCHEME supports some set of keys. For example, it's now
possible to use:
-fdiagnostics-add-output=sarif:version=2.1,file=foo.2.1.sarif \
-fdiagnostics-add-output=sarif:version=2.2-prerelease,file=foo.2.2.sarif
to add a pair of outputs, each writing to a different file, using
versions 2.1 and 2.2 of the SARIF standard respectively, whilst also
emitting the classic text form of the diagnostics to stderr.
I hope the new syntax gives us room to potentially add new kinds of
output sink in the future (e.g. RPC notifications), and to add new
key/value pairs as needed by the different sinks.
Implementation-wise, the diagnostic_context's m_printer which previously
was used directly by the single output format now becomes a "reference
printer", created by the client (such as the frontend), with defaults
modified by command-line options. Each of the multiple output sinks has
its own pretty_printer instance, created by cloning the context's
reference printer.
gcc/ChangeLog:
PR other/116613
* Makefile.in (OBJS-libcommon-target): Add opts-diagnostic.o.
* common.opt (fdiagnostics-add-output=): New.
(fdiagnostics-set-output=): New.
(diagnostics_output_format): Drop sarif-file-2.2-prerelease from
enum.
* common.opt.urls: Regenerate.
* diagnostic-buffer.h (diagnostic_buffer::~diagnostic_buffer): New.
(diagnostic_buffer::ensure_per_format_buffer): Rename to...
(diagnostic_buffer::ensure_per_format_buffers): ...this.
(diagnostic_buffer::m_per_format_buffer): Replace with...
(diagnostic_buffer::m_per_format_buffers): ...this, updating type.
* diagnostic-format-json.cc (json_output_format::update_printer):
New.
(json_output_format::follows_reference_printer_p): New.
(diagnostic_output_format_init_json): Drop redundant call to
set_path_format, as this is not a text output format.
* diagnostic-format-sarif.cc: Include "diagnostic-format-text.h".
(sarif_builder::set_printer): New.
(sarif_builder::sarif_builder): Add "printer" param and use it for
m_printer.
(sarif_builder::make_location_object::escape_nonascii_renderer::render):
Rather than using dc.m_printer, create a
diagnostic_text_output_format instance and use its printer.
(sarif_output_format::follows_reference_printer_p): New.
(sarif_output_format::update_printer): New.
(sarif_output_format::sarif_output_format): Pass in correct
printer to m_builder's ctor.
(diagnostic_output_format_init_sarif): Drop redundant call to
set_path_format, as this is not a text output format. Replace
calls to pp_show_color and set_token_printer with call to
update_printer. Drop redundant call to set_show_highlight_colors,
as this printer does not show colors.
(diagnostic_output_format_init_sarif_file): Split out file opening
into...
(diagnostic_output_format_open_sarif_file): ...this new function.
(make_sarif_sink): New.
(selftest::test_make_location_object): Provide a pp for the
builder.
* diagnostic-format-sarif.h
(diagnostic_output_format_open_sarif_file): New decl.
(make_sarif_sink): New decl.
* diagnostic-format-text.cc (diagnostic_text_output_format::dump):
Dump sm_follows_reference_printer.
(diagnostic_text_output_format::on_report_verbatim): New.
(diagnostic_text_output_format::follows_reference_printer_p): New.
(diagnostic_text_output_format::update_printer): New.
* diagnostic-format-text.h
(diagnostic_text_output_format::diagnostic_text_output_format):
Add optional "follows_reference_printer" param.
(diagnostic_text_output_format::on_report_verbatim): New decl.
(diagnostic_text_output_format::after_diagnostic): Drop "final".
(diagnostic_text_output_format::follows_reference_printer_p): New
decl.
(class diagnostic_text_output_format): Convert private members to
protected.
(diagnostic_text_output_format::m_follows_reference_printer): New
field.
* diagnostic-format.h
(diagnostic_output_format::on_report_verbatim): New vfunc.
(diagnostic_output_format::follows_reference_printer_p): New vfunc.
(diagnostic_output_format::update_printer): New vfunc.
(diagnostic_output_format::get_printer): Use m_printer rather than
a printer from m_context.
(diagnostic_output_format::diagnostic_output_format): Initialize
m_printer by cloning the context's printer.
(diagnostic_output_format::m_printer): New field.
* diagnostic-global-context.cc (verbatim): Reimplement in terms of
global_dc->report_verbatim, moving existing implementation to
diagnostic_text_output_format::on_report_verbatim.
(fnotice): Support multiple output sinks by using a new
global_dc->supports_fnotice_on_stderr_p.
* diagnostic-output-file.h
(diagnostic_output_file::diagnostic_output_file): New default ctor.
(diagnostic_output_file::operator=): Implement move assignment.
* diagnostic-path.cc (selftest::test_interprocedural_path_1): Pass
false for new param of text_output's ctor.
* diagnostic-show-locus.cc
(selftest::test_layout_x_offset_display_utf8): Use reference
printer.
(selftest::test_layout_x_offset_display_tab): Likewise.
(selftest::test_one_liner_fixit_remove): Likewise.
* diagnostic.cc: Include "pretty-print-urlifier.h".
(diagnostic_set_caret_max_width): Update for global_dc's m_printer
becoming reference printer.
(diagnostic_context::initialize): Update for m_printer becoming
m_reference_printer. Use ::make_unique to create it. Update for
m_output_format becoming m_output_sinks.
(diagnostic_context::color_init): Update the reference printer,
then update the printers for any output sinks that follow it.
(diagnostic_context::urls_init): Likewise.
(diagnostic_context::finish): Update comment. Update for
m_output_format becoming m_output_sinks. Update for m_printer
becoming m_reference_printer and use "delete" on it rather than
XDELETE.
(diagnostic_context::dump): Update for m_printer becoming
reference printer, and for multiple output sinks.
(diagnostic_context::set_output_format): Reimplement for
supporting multiple output sinks.
(diagnostic_context::get_output_format): Likewise.
(diagnostic_context::add_sink): New.
(diagnostic_context::supports_fnotice_on_stderr_p): New.
(diagnostic_context::set_pretty_printer): New.
(diagnostic_context::refresh_output_sinks): New.
(diagnostic_context::set_format_decoder): New.
(diagnostic_context::set_show_highlight_colors): New.
(diagnostic_context::set_prefixing_rule): New.
(diagnostic_context::report_diagnostic): Update to support
multiple output sinks.
(diagnostic_context::report_verbatim): New.
(diagnostic_context::emit_diagram): Update to support multiple
output sinks.
(diagnostic_context::error_recursion): Update to use
m_reference_printer.
(fancy_abort): Likewise.
(diagnostic_context::end_group): Update to support multiple
output sinks.
(diagnostic_output_format::dump): Implement.
(diagnostic_output_format::on_report_verbatim): Likewise.
(diagnostic_output_format_init): Drop
DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE_2_2_PRERELEASE.
(diagnostic_context::set_diagnostic_buffer): Reimplement to
support multiple output sinks.
(diagnostic_context::clear_diagnostic_buffer): Likewise.
(diagnostic_context::flush_diagnostic_buffer): Likewise.
(diagnostic_buffer::diagnostic_buffer): Initialize
m_per_format_buffers.
(diagnostic_buffer::~diagnostic_buffer): New dtor.
(diagnostic_buffer::dump): Reimplement to support multiple output
sinks.
(diagnostic_buffer::empty_p): Likewise.
(diagnostic_buffer::move_to): Likewise.
(diagnostic_buffer::ensure_per_format_buffer): Likewise, renaming
to...
(diagnostic_buffer::ensure_per_format_buffers): ...this.
* diagnostic.h
(DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE_2_2_PRERELEASE): Delete.
(class diagnostic_context): Add friend class diagnostic_buffer.
(diagnostic_context::set_pretty_printer): New decl.
(diagnostic_context::refresh_output_sinks): New decl.
(diagnostic_context::report_verbatim): New decl.
(diagnostic_context::get_output_format): Drop.
(diagnostic_context::set_show_highlight_colors): Drop body.
(diagnostic_context::set_format_decoder): New decl.
(diagnostic_context::set_prefixing_rule): New decl.
(diagnostic_context::clone_printer): Reimplement.
(diagnostic_context::get_reference_printer): New accessor.
(diagnostic_context::add_sink): New decl.
(diagnostic_context::supports_fnotice_on_stderr_p): New decl.
(diagnostic_context::m_printer): Replace with...
(diagnostic_context::m_reference_printer): ...this, and make
private.
(diagnostic_context::m_output_format): Replace with...
(diagnostic_context::m_output_sinks): ...this.
(diagnostic_format_decoder): Delete.
(diagnostic_prefixing_rule): Delete.
(diagnostic_ready_p): Delete.
* doc/invoke.texi: Document -fdiagnostics-add-output= and
-fdiagnostics-set-output=.
* gcc.cc: Include "opts-diagnostic.h".
(driver_handle_option): Handle cases OPT_fdiagnostics_add_output_
and OPT_fdiagnostics_set_output_.
* opts-diagnostic.cc: New file.
* opts-diagnostic.h (handle_OPT_fdiagnostics_add_output_): New decl.
(handle_OPT_fdiagnostics_set_output_): New decl.
* opts-global.cc (init_options_once): Update for global_dc's
m_printer becoming reference printer. Call
global_dc->refresh_output_sinks.
* opts.cc (common_handle_option): Replace use of
diagnostic_prefixing_rule with dc->set_prefixing_rule. Handle
cases OPT_fdiagnostics_add_output_ and
OPT_fdiagnostics_set_output_. Update for m_printer becoming
reference printer.
* selftest-diagnostic.cc
(selftest::test_diagnostic_context::test_diagnostic_context):
Update for m_printer becoming reference printer.
(test_diagnostic_context::test_show_locus): Likewise.
* selftest-run-tests.cc (selftest::run_tests): Call
selftest::opts_diagnostic_cc_tests.
* selftest.h (selftest::opts_diagnostic_cc_tests): New decl.
* simple-diagnostic-path.cc
(selftest::simple_diagnostic_path_cc_tests): Use reference
printer.
* toplev.cc (announce_function): Update for global_dc's m_printer
becoming reference printer.
(toplev::main): Likewise.
* tree-diagnostic.cc (tree_diagnostics_defaults): Replace use of
diagnostic_format_decoder with context->set_format_decoder.
* tree-diagnostic.h
(tree_dump_pretty_printer::tree_dump_pretty_printer): Update for
global_dc's m_printer becoming reference printer.
* tree.cc (escaped_string::escape): Likewise.
(selftest::test_escaped_strings): Likewise.
gcc/ada/ChangeLog:
PR other/116613
* gcc-interface/misc.cc (internal_error_function): Update for
m_printer becoming reference printer.
gcc/analyzer/ChangeLog:
PR other/116613
* analyzer-language.cc (on_finish_translation_unit): Update for
m_printer becoming reference printer.
* engine.cc (run_checkers): Likewise.
* program-point.cc (function_point::print_source_line): Likewise.
gcc/c-family/ChangeLog:
PR other/116613
* c-format.cc (selftest::test_type_mismatch_range_labels): Update
for m_printer becoming reference printer.
(selftest::test_type_mismatch_range_labels): Likewise.
gcc/c/ChangeLog:
PR other/116613
* c-objc-common.cc: Include "make-unique.h".
(c_initialize_diagnostics): Use unique_ptr for pretty_printer.
Use context->set_format_decoder.
gcc/cp/ChangeLog:
PR other/116613
* error.cc (cxx_initialize_diagnostics): Use unique_ptr for
pretty_printer. Use context->set_format_decoder.
* module.cc (noisy_p): Update for global_dc's m_printer becoming
reference printer.
gcc/d/ChangeLog:
PR other/116613
* d-diagnostic.cc (d_diagnostic_report_diagnostic): Update for
m_printer becoming reference printer.
gcc/fortran/ChangeLog:
PR other/116613
* error.cc (gfc_diagnostic_build_kind_prefix): Update for
global_dc's m_printer becoming reference printer.
(gfc_diagnostics_init): Replace usage of diagnostic_format_decoder
with global_dc->set_format_decoder.
gcc/jit/ChangeLog:
PR other/116613
* dummy-frontend.cc: Include "make-unique.h".
(class jit_diagnostic_listener): New.
(jit_begin_diagnostic): Update comment.
(jit_end_diagnostic): Drop call to add_diagnostic.
(jit_langhook_init): Set the output format to a new
jit_diagnostic_listener.
* jit-playback.cc (playback::context::add_diagnostic): Add "text"
param and use that rather than trying to get the text from a
pretty_printer.
* jit-playback.h (playback::context::add_diagnostic): Add "text"
param.
gcc/testsuite/ChangeLog:
PR other/116613
* gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info):
Update for global_dc's m_printer becoming reference printer.
* gcc.dg/plugin/crash-test-ice-in-header-sarif-2.2.c: Replace usage
of -fdiagnostics-format=sarif-file-2.2-prerelease with
-fdiagnostics-set-output=sarif:version=2.2-prerelease.
* gcc.dg/plugin/diagnostic_plugin_test_paths.c: Update for
global_dc's m_printer becoming reference printer.
* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c: Update for
changes to output formats.
* gcc.dg/plugin/expensive_selftests_plugin.c: Update for
global_dc's m_printer becoming reference printer.
* gcc.dg/sarif-output/add-output-sarif-defaults.c: New test.
* gcc.dg/sarif-output/bad-binary-op.c: New test.
* gcc.dg/sarif-output/bad-binary-op.py: New support script.
* gcc.dg/sarif-output/multiple-outputs.c: New test.
* gcc.dg/sarif-output/multiple-outputs.py: New support script.
* lib/scansarif.exp (verify-sarif-file): Add an optional second
argument specifying the expected filename of the .sarif file.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
I've tried to build stage3 with
-Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank
added to STRICT_WARN and that expectably resulted in about
2744 unique trailing whitespace warnings and 124837 leading whitespace
warnings when excluding *.md files (which obviously is in big part a
generator issue). Others from that are generator related, I think those
need to be solved later.
The following patch just fixes up the easy case (trailing whitespace),
which could be easily automated:
for i in `find . -name \*.h -o -name \*.cc -o -name \*.c | xargs grep -l '[ ]$' | grep -v testsuite/`; do sed -i -e 's/[ ]*$//' $i; done
I've excluded files which I knew are obviously generated or go FE.
Is there anything else we'd want to avoid the changes?
Due to patch size, I've split it between gcc/ part (this patch)
and rest (include/, libiberty/, libgcc/, libcpp/, libstdc++-v3/).
2024-10-24 Jakub Jelinek <jakub@redhat.com>
gcc/
* lra-assigns.cc: Remove trailing whitespace.
* symtab.cc: Likewise.
* stmt.cc: Likewise.
* cgraphbuild.cc: Likewise.
* cfgcleanup.cc: Likewise.
* loop-init.cc: Likewise.
* df-problems.cc: Likewise.
* diagnostic-macro-unwinding.cc: Likewise.
* langhooks.h: Likewise.
* except.cc: Likewise.
* tree-vect-loop.cc: Likewise.
* coverage.cc: Likewise.
* hash-table.cc: Likewise.
* ggc-page.cc: Likewise.
* gimple-ssa-strength-reduction.cc: Likewise.
* tree-parloops.cc: Likewise.
* internal-fn.cc: Likewise.
* ipa-split.cc: Likewise.
* calls.cc: Likewise.
* reorg.cc: Likewise.
* sbitmap.h: Likewise.
* omp-offload.cc: Likewise.
* cfgrtl.cc: Likewise.
* reginfo.cc: Likewise.
* gengtype.h: Likewise.
* omp-general.h: Likewise.
* ipa-comdats.cc: Likewise.
* gimple-range-edge.h: Likewise.
* tree-ssa-structalias.cc: Likewise.
* target.def: Likewise.
* basic-block.h: Likewise.
* graphite-isl-ast-to-gimple.cc: Likewise.
* auto-profile.cc: Likewise.
* optabs.cc: Likewise.
* gengtype-lex.l: Likewise.
* optabs.def: Likewise.
* ira-build.cc: Likewise.
* ira.cc: Likewise.
* function.h: Likewise.
* tree-ssa-propagate.cc: Likewise.
* gcov-io.cc: Likewise.
* builtin-types.def: Likewise.
* ddg.cc: Likewise.
* lra-spills.cc: Likewise.
* cfg.cc: Likewise.
* bitmap.cc: Likewise.
* gimple-range-gori.h: Likewise.
* tree-ssa-loop-im.cc: Likewise.
* cfghooks.h: Likewise.
* genmatch.cc: Likewise.
* explow.cc: Likewise.
* lto-streamer-in.cc: Likewise.
* graphite-scop-detection.cc: Likewise.
* ipa-prop.cc: Likewise.
* gcc.cc: Likewise.
* vec.h: Likewise.
* cfgexpand.cc: Likewise.
* config/alpha/vms.h: Likewise.
* config/alpha/alpha.cc: Likewise.
* config/alpha/driver-alpha.cc: Likewise.
* config/alpha/elf.h: Likewise.
* config/iq2000/iq2000.h: Likewise.
* config/iq2000/iq2000.cc: Likewise.
* config/pa/pa-64.h: Likewise.
* config/pa/som.h: Likewise.
* config/pa/pa.cc: Likewise.
* config/pa/pa.h: Likewise.
* config/pa/pa32-regs.h: Likewise.
* config/c6x/c6x.cc: Likewise.
* config/openbsd-stdint.h: Likewise.
* config/elfos.h: Likewise.
* config/lm32/lm32.cc: Likewise.
* config/lm32/lm32.h: Likewise.
* config/lm32/lm32-protos.h: Likewise.
* config/darwin-c.cc: Likewise.
* config/rx/rx.cc: Likewise.
* config/host-darwin.h: Likewise.
* config/netbsd.h: Likewise.
* config/ia64/ia64.cc: Likewise.
* config/ia64/freebsd.h: Likewise.
* config/avr/avr-c.cc: Likewise.
* config/avr/avr.cc: Likewise.
* config/avr/avr-arch.h: Likewise.
* config/avr/avr.h: Likewise.
* config/avr/stdfix.h: Likewise.
* config/avr/gen-avr-mmcu-specs.cc: Likewise.
* config/avr/avr-log.cc: Likewise.
* config/avr/elf.h: Likewise.
* config/avr/gen-avr-mmcu-texi.cc: Likewise.
* config/avr/avr-devices.cc: Likewise.
* config/nvptx/nvptx.cc: Likewise.
* config/vx-common.h: Likewise.
* config/sol2.cc: Likewise.
* config/rl78/rl78.cc: Likewise.
* config/cris/cris.cc: Likewise.
* config/arm/symbian.h: Likewise.
* config/arm/unknown-elf.h: Likewise.
* config/arm/linux-eabi.h: Likewise.
* config/arm/arm.cc: Likewise.
* config/arm/arm-mve-builtins.h: Likewise.
* config/arm/bpabi.h: Likewise.
* config/arm/vxworks.h: Likewise.
* config/arm/arm.h: Likewise.
* config/arm/aout.h: Likewise.
* config/arm/elf.h: Likewise.
* config/host-linux.cc: Likewise.
* config/sh/sh_treg_combine.cc: Likewise.
* config/sh/vxworks.h: Likewise.
* config/sh/elf.h: Likewise.
* config/sh/netbsd-elf.h: Likewise.
* config/sh/sh.cc: Likewise.
* config/sh/embed-elf.h: Likewise.
* config/sh/sh.h: Likewise.
* config/darwin-driver.cc: Likewise.
* config/m32c/m32c.cc: Likewise.
* config/frv/frv.cc: Likewise.
* config/openbsd.h: Likewise.
* config/aarch64/aarch64-protos.h: Likewise.
* config/aarch64/aarch64-builtins.cc: Likewise.
* config/aarch64/aarch64-cost-tables.h: Likewise.
* config/aarch64/aarch64.cc: Likewise.
* config/bfin/bfin.cc: Likewise.
* config/bfin/bfin.h: Likewise.
* config/bfin/bfin-protos.h: Likewise.
* config/i386/gmm_malloc.h: Likewise.
* config/i386/djgpp.h: Likewise.
* config/i386/sol2.h: Likewise.
* config/i386/stringop.def: Likewise.
* config/i386/i386-features.cc: Likewise.
* config/i386/openbsdelf.h: Likewise.
* config/i386/cpuid.h: Likewise.
* config/i386/i386.h: Likewise.
* config/i386/smmintrin.h: Likewise.
* config/i386/avx10_2-512convertintrin.h: Likewise.
* config/i386/i386-options.cc: Likewise.
* config/i386/i386-opts.h: Likewise.
* config/i386/i386-expand.cc: Likewise.
* config/i386/avx512dqintrin.h: Likewise.
* config/i386/wmmintrin.h: Likewise.
* config/i386/gnu-user.h: Likewise.
* config/i386/host-mingw32.cc: Likewise.
* config/i386/avx10_2bf16intrin.h: Likewise.
* config/i386/cygwin.h: Likewise.
* config/i386/driver-i386.cc: Likewise.
* config/i386/biarch64.h: Likewise.
* config/i386/host-cygwin.cc: Likewise.
* config/i386/cygming.h: Likewise.
* config/i386/i386-builtins.cc: Likewise.
* config/i386/avx10_2convertintrin.h: Likewise.
* config/i386/i386.cc: Likewise.
* config/i386/gas.h: Likewise.
* config/i386/freebsd.h: Likewise.
* config/mingw/winnt-cxx.cc: Likewise.
* config/mingw/winnt.cc: Likewise.
* config/h8300/h8300.cc: Likewise.
* config/host-solaris.cc: Likewise.
* config/m32r/m32r.h: Likewise.
* config/m32r/m32r.cc: Likewise.
* config/darwin.h: Likewise.
* config/sparc/linux64.h: Likewise.
* config/sparc/sparc-protos.h: Likewise.
* config/sparc/sysv4.h: Likewise.
* config/sparc/sparc.h: Likewise.
* config/sparc/linux.h: Likewise.
* config/sparc/freebsd.h: Likewise.
* config/sparc/sparc.cc: Likewise.
* config/gcn/gcn-run.cc: Likewise.
* config/gcn/gcn.cc: Likewise.
* config/gcn/gcn-tree.cc: Likewise.
* config/kopensolaris-gnu.h: Likewise.
* config/nios2/nios2.h: Likewise.
* config/nios2/elf.h: Likewise.
* config/nios2/nios2.cc: Likewise.
* config/host-netbsd.cc: Likewise.
* config/rtems.h: Likewise.
* config/pdp11/pdp11.cc: Likewise.
* config/pdp11/pdp11.h: Likewise.
* config/mn10300/mn10300.cc: Likewise.
* config/mn10300/linux.h: Likewise.
* config/moxie/moxie.h: Likewise.
* config/moxie/moxie.cc: Likewise.
* config/rs6000/aix71.h: Likewise.
* config/rs6000/vec_types.h: Likewise.
* config/rs6000/xcoff.h: Likewise.
* config/rs6000/rs6000.cc: Likewise.
* config/rs6000/rs6000-internal.h: Likewise.
* config/rs6000/rs6000-p8swap.cc: Likewise.
* config/rs6000/rs6000-c.cc: Likewise.
* config/rs6000/aix.h: Likewise.
* config/rs6000/rs6000-logue.cc: Likewise.
* config/rs6000/rs6000-string.cc: Likewise.
* config/rs6000/rs6000-call.cc: Likewise.
* config/rs6000/ppu_intrinsics.h: Likewise.
* config/rs6000/altivec.h: Likewise.
* config/rs6000/darwin.h: Likewise.
* config/rs6000/host-darwin.cc: Likewise.
* config/rs6000/freebsd64.h: Likewise.
* config/rs6000/spu2vmx.h: Likewise.
* config/rs6000/linux.h: Likewise.
* config/rs6000/si2vmx.h: Likewise.
* config/rs6000/driver-rs6000.cc: Likewise.
* config/rs6000/freebsd.h: Likewise.
* config/vxworksae.h: Likewise.
* config/mips/frame-header-opt.cc: Likewise.
* config/mips/mips.h: Likewise.
* config/mips/mips.cc: Likewise.
* config/mips/sde.h: Likewise.
* config/darwin-protos.h: Likewise.
* config/mcore/mcore-elf.h: Likewise.
* config/mcore/mcore.h: Likewise.
* config/mcore/mcore.cc: Likewise.
* config/epiphany/epiphany.cc: Likewise.
* config/fr30/fr30.h: Likewise.
* config/fr30/fr30.cc: Likewise.
* config/riscv/riscv-vector-builtins-shapes.cc: Likewise.
* config/riscv/riscv-vector-builtins-bases.cc: Likewise.
* config/visium/visium.h: Likewise.
* config/mmix/mmix.cc: Likewise.
* config/v850/v850.cc: Likewise.
* config/v850/v850-c.cc: Likewise.
* config/v850/v850.h: Likewise.
* config/stormy16/stormy16.cc: Likewise.
* config/stormy16/stormy16-protos.h: Likewise.
* config/stormy16/stormy16.h: Likewise.
* config/arc/arc.cc: Likewise.
* config/vxworks.cc: Likewise.
* config/microblaze/microblaze-c.cc: Likewise.
* config/microblaze/microblaze-protos.h: Likewise.
* config/microblaze/microblaze.h: Likewise.
* config/microblaze/microblaze.cc: Likewise.
* config/freebsd-spec.h: Likewise.
* config/m68k/m68kelf.h: Likewise.
* config/m68k/m68k.cc: Likewise.
* config/m68k/netbsd-elf.h: Likewise.
* config/m68k/linux.h: Likewise.
* config/freebsd.h: Likewise.
* config/host-openbsd.cc: Likewise.
* regcprop.cc: Likewise.
* dumpfile.cc: Likewise.
* combine.cc: Likewise.
* tree-ssa-forwprop.cc: Likewise.
* ipa-profile.cc: Likewise.
* hw-doloop.cc: Likewise.
* opts.cc: Likewise.
* gcc-ar.cc: Likewise.
* tree-cfg.cc: Likewise.
* incpath.cc: Likewise.
* tree-ssa-sccvn.cc: Likewise.
* function.cc: Likewise.
* genattrtab.cc: Likewise.
* rtl.def: Likewise.
* genchecksum.cc: Likewise.
* profile.cc: Likewise.
* df-core.cc: Likewise.
* tree-pretty-print.cc: Likewise.
* tree.h: Likewise.
* plugin.cc: Likewise.
* tree-ssa-loop-ch.cc: Likewise.
* emit-rtl.cc: Likewise.
* haifa-sched.cc: Likewise.
* gimple-range-edge.cc: Likewise.
* range-op.cc: Likewise.
* tree-ssa-ccp.cc: Likewise.
* dwarf2cfi.cc: Likewise.
* recog.cc: Likewise.
* vtable-verify.cc: Likewise.
* system.h: Likewise.
* regrename.cc: Likewise.
* tree-ssa-dom.cc: Likewise.
* loop-unroll.cc: Likewise.
* lra-constraints.cc: Likewise.
* pretty-print.cc: Likewise.
* ifcvt.cc: Likewise.
* ipa.cc: Likewise.
* alloc-pool.h: Likewise.
* collect2.cc: Likewise.
* pointer-query.cc: Likewise.
* cfgloop.cc: Likewise.
* toplev.cc: Likewise.
* sese.cc: Likewise.
* gengtype.cc: Likewise.
* gimplify-me.cc: Likewise.
* double-int.cc: Likewise.
* bb-reorder.cc: Likewise.
* dwarf2out.cc: Likewise.
* tree-ssa-loop-ivcanon.cc: Likewise.
* tree-ssa-reassoc.cc: Likewise.
* cgraph.cc: Likewise.
* sel-sched.cc: Likewise.
* attribs.cc: Likewise.
* expr.cc: Likewise.
* tree-ssa-scopedtables.h: Likewise.
* gimple-range-cache.cc: Likewise.
* ipa-pure-const.cc: Likewise.
* tree-inline.cc: Likewise.
* genhooks.cc: Likewise.
* gimple-range-phi.h: Likewise.
* shrink-wrap.cc: Likewise.
* tree.cc: Likewise.
* gimple.cc: Likewise.
* backend.h: Likewise.
* opts-common.cc: Likewise.
* cfg-flags.def: Likewise.
* gcse-common.cc: Likewise.
* tree-ssa-scopedtables.cc: Likewise.
* ccmp.cc: Likewise.
* builtins.def: Likewise.
* builtin-attrs.def: Likewise.
* postreload.cc: Likewise.
* sched-deps.cc: Likewise.
* ipa-inline-transform.cc: Likewise.
* tree-vect-generic.cc: Likewise.
* ipa-polymorphic-call.cc: Likewise.
* builtins.cc: Likewise.
* sel-sched-ir.cc: Likewise.
* trans-mem.cc: Likewise.
* ipa-visibility.cc: Likewise.
* cgraph.h: Likewise.
* tree-ssa-phiopt.cc: Likewise.
* genopinit.cc: Likewise.
* ipa-inline.cc: Likewise.
* omp-low.cc: Likewise.
* ipa-utils.cc: Likewise.
* tree-ssa-math-opts.cc: Likewise.
* tree-ssa-ifcombine.cc: Likewise.
* gimple-range.cc: Likewise.
* ipa-fnsummary.cc: Likewise.
* ira-color.cc: Likewise.
* value-prof.cc: Likewise.
* varasm.cc: Likewise.
* ipa-icf.cc: Likewise.
* ira-emit.cc: Likewise.
* lto-streamer.h: Likewise.
* lto-wrapper.cc: Likewise.
* regs.h: Likewise.
* gengtype-parse.cc: Likewise.
* alias.cc: Likewise.
* lto-streamer.cc: Likewise.
* real.h: Likewise.
* wide-int.h: Likewise.
* targhooks.cc: Likewise.
* gimple-ssa-warn-access.cc: Likewise.
* real.cc: Likewise.
* ipa-reference.cc: Likewise.
* bitmap.h: Likewise.
* ginclude/float.h: Likewise.
* ginclude/stddef.h: Likewise.
* ginclude/stdarg.h: Likewise.
* ginclude/stdatomic.h: Likewise.
* optabs.h: Likewise.
* sel-sched-ir.h: Likewise.
* convert.cc: Likewise.
* cgraphunit.cc: Likewise.
* lra-remat.cc: Likewise.
* tree-if-conv.cc: Likewise.
* gcov-dump.cc: Likewise.
* tree-predcom.cc: Likewise.
* dominance.cc: Likewise.
* gimple-range-cache.h: Likewise.
* ipa-devirt.cc: Likewise.
* rtl.h: Likewise.
* ubsan.cc: Likewise.
* tree-ssa.cc: Likewise.
* ssa.h: Likewise.
* cse.cc: Likewise.
* jump.cc: Likewise.
* hwint.h: Likewise.
* caller-save.cc: Likewise.
* coretypes.h: Likewise.
* ipa-fnsummary.h: Likewise.
* tree-ssa-strlen.cc: Likewise.
* modulo-sched.cc: Likewise.
* cgraphclones.cc: Likewise.
* lto-cgraph.cc: Likewise.
* hw-doloop.h: Likewise.
* data-streamer.h: Likewise.
* compare-elim.cc: Likewise.
* profile-count.h: Likewise.
* tree-vect-loop-manip.cc: Likewise.
* ree.cc: Likewise.
* reload.cc: Likewise.
* tree-ssa-loop-split.cc: Likewise.
* tree-into-ssa.cc: Likewise.
* gcse.cc: Likewise.
* cfgloopmanip.cc: Likewise.
* df.h: Likewise.
* fold-const.cc: Likewise.
* wide-int.cc: Likewise.
* gengtype-state.cc: Likewise.
* sanitizer.def: Likewise.
* tree-ssa-sink.cc: Likewise.
* target-hooks-macros.h: Likewise.
* tree-ssa-pre.cc: Likewise.
* gimple-pretty-print.cc: Likewise.
* ipa-utils.h: Likewise.
* tree-outof-ssa.cc: Likewise.
* tree-ssa-coalesce.cc: Likewise.
* gimple-match.h: Likewise.
* tree-ssa-loop-niter.cc: Likewise.
* tree-loop-distribution.cc: Likewise.
* tree-emutls.cc: Likewise.
* tree-eh.cc: Likewise.
* varpool.cc: Likewise.
* ssa-iterators.h: Likewise.
* asan.cc: Likewise.
* reload1.cc: Likewise.
* cfgloopanal.cc: Likewise.
* tree-vectorizer.cc: Likewise.
* simplify-rtx.cc: Likewise.
* opts-global.cc: Likewise.
* gimple-ssa-store-merging.cc: Likewise.
* expmed.cc: Likewise.
* tree-ssa-loop-prefetch.cc: Likewise.
* tree-ssa-dse.h: Likewise.
* tree-vect-stmts.cc: Likewise.
* gimple-fold.cc: Likewise.
* lra-coalesce.cc: Likewise.
* data-streamer-out.cc: Likewise.
* diagnostic.cc: Likewise.
* tree-ssa-alias.cc: Likewise.
* tree-vect-patterns.cc: Likewise.
* common/common-target.def: Likewise.
* common/config/rx/rx-common.cc: Likewise.
* common/config/msp430/msp430-common.cc: Likewise.
* common/config/avr/avr-common.cc: Likewise.
* common/config/i386/i386-common.cc: Likewise.
* common/config/pdp11/pdp11-common.cc: Likewise.
* common/config/rs6000/rs6000-common.cc: Likewise.
* common/config/mcore/mcore-common.cc: Likewise.
* graphite.cc: Likewise.
* gimple-low.cc: Likewise.
* genmodes.cc: Likewise.
* gimple-loop-jam.cc: Likewise.
* lto-streamer-out.cc: Likewise.
* predict.cc: Likewise.
* omp-expand.cc: Likewise.
* gimple-array-bounds.cc: Likewise.
* predict.def: Likewise.
* opts.h: Likewise.
* tree-stdarg.cc: Likewise.
* gimplify.cc: Likewise.
* ira-lives.cc: Likewise.
* loop-doloop.cc: Likewise.
* lra.cc: Likewise.
* gimple-iterator.h: Likewise.
* tree-sra.cc: Likewise.
gcc/fortran/
* trans-openmp.cc: Remove trailing whitespace.
* trans-common.cc: Likewise.
* match.h: Likewise.
* scanner.cc: Likewise.
* gfortranspec.cc: Likewise.
* io.cc: Likewise.
* iso-c-binding.def: Likewise.
* iso-fortran-env.def: Likewise.
* types.def: Likewise.
* openmp.cc: Likewise.
* f95-lang.cc: Likewise.
gcc/analyzer/
* state-purge.cc: Remove trailing whitespace.
* region-model.h: Likewise.
* region-model.cc: Likewise.
* program-point.cc: Likewise.
* exploded-graph.h: Likewise.
* program-state.cc: Likewise.
* supergraph.cc: Likewise.
gcc/c-family/
* c-ubsan.cc: Remove trailing whitespace.
* stub-objc.cc: Likewise.
* c-pragma.cc: Likewise.
* c-ppoutput.cc: Likewise.
* c-indentation.cc: Likewise.
* c-ada-spec.cc: Likewise.
* c-opts.cc: Likewise.
* c-common.cc: Likewise.
* c-format.cc: Likewise.
* c-omp.cc: Likewise.
* c-objc.h: Likewise.
* c-cppbuiltin.cc: Likewise.
* c-attribs.cc: Likewise.
* c-target.def: Likewise.
* c-common.h: Likewise.
gcc/c/
* c-typeck.cc: Remove trailing whitespace.
* gimple-parser.cc: Likewise.
* c-parser.cc: Likewise.
* c-decl.cc: Likewise.
gcc/cp/
* vtable-class-hierarchy.cc: Remove trailing whitespace.
* typeck2.cc: Likewise.
* decl.cc: Likewise.
* init.cc: Likewise.
* semantics.cc: Likewise.
* module.cc: Likewise.
* rtti.cc: Likewise.
* cxx-pretty-print.cc: Likewise.
* cvt.cc: Likewise.
* mangle.cc: Likewise.
* name-lookup.h: Likewise.
* coroutines.cc: Likewise.
* error.cc: Likewise.
* lambda.cc: Likewise.
* tree.cc: Likewise.
* g++spec.cc: Likewise.
* decl2.cc: Likewise.
* cp-tree.h: Likewise.
* parser.cc: Likewise.
* pt.cc: Likewise.
* call.cc: Likewise.
* lex.cc: Likewise.
* cp-lang.cc: Likewise.
* cp-tree.def: Likewise.
* constexpr.cc: Likewise.
* typeck.cc: Likewise.
* name-lookup.cc: Likewise.
* optimize.cc: Likewise.
* search.cc: Likewise.
* mapper-client.cc: Likewise.
* ptree.cc: Likewise.
* class.cc: Likewise.
gcc/jit/
* docs/examples/tut04-toyvm/toyvm.cc: Remove trailing whitespace.
gcc/lto/
* lto-object.cc: Remove trailing whitespace.
* lto-symtab.cc: Likewise.
* lto-partition.cc: Likewise.
* lang-specs.h: Likewise.
* lto-lang.cc: Likewise.
gcc/objc/
* objc-encoding.cc: Remove trailing whitespace.
* objc-map.h: Likewise.
* objc-next-runtime-abi-01.cc: Likewise.
* objc-act.cc: Likewise.
* objc-map.cc: Likewise.
gcc/objcp/
* objcp-decl.cc: Remove trailing whitespace.
* objcp-lang.cc: Likewise.
* objcp-decl.h: Likewise.
gcc/rust/
* util/optional.h: Remove trailing whitespace.
* util/expected.h: Likewise.
* util/rust-unicode-data.h: Likewise.
gcc/m2/
* mc-boot/GFpuIO.cc: Remove trailing whitespace.
* mc-boot/GFIO.cc: Likewise.
* mc-boot/GFormatStrings.cc: Likewise.
* mc-boot/GCmdArgs.cc: Likewise.
* mc-boot/GDebug.h: Likewise.
* mc-boot/GM2Dependent.cc: Likewise.
* mc-boot/GRTint.cc: Likewise.
* mc-boot/GDebug.cc: Likewise.
* mc-boot/GmcError.cc: Likewise.
* mc-boot/Gmcp4.cc: Likewise.
* mc-boot/GM2RTS.cc: Likewise.
* mc-boot/GIO.cc: Likewise.
* mc-boot/Gmcp5.cc: Likewise.
* mc-boot/GDynamicStrings.cc: Likewise.
* mc-boot/Gmcp1.cc: Likewise.
* mc-boot/GFormatStrings.h: Likewise.
* mc-boot/Gmcp2.cc: Likewise.
* mc-boot/Gmcp3.cc: Likewise.
* pge-boot/GFIO.cc: Likewise.
* pge-boot/GDebug.h: Likewise.
* pge-boot/GM2Dependent.cc: Likewise.
* pge-boot/GDebug.cc: Likewise.
* pge-boot/GM2RTS.cc: Likewise.
* pge-boot/GSymbolKey.cc: Likewise.
* pge-boot/GIO.cc: Likewise.
* pge-boot/GIndexing.cc: Likewise.
* pge-boot/GDynamicStrings.cc: Likewise.
* pge-boot/GFormatStrings.h: Likewise.
gcc/go/
* go-gcc.cc: Remove trailing whitespace.
* gospec.cc: Likewise.
|
|
Noticed while testing my fix for PR c++/113814. Not all of these are
easily testable but I've tested a couple that were straight-forward.
For consistency also adds a new TYPE_WARN_IF_NOT_ALIGN_RAW flag to match
the decl version Nathan added.
gcc/cp/ChangeLog:
* module.cc (trees_in::read_class_def): Propagate some missing
flags from the streamed-in definition.
gcc/ChangeLog:
* tree.h (TYPE_WARN_IF_NOT_ALIGN_RAW): New accessor.
(TYPE_WARN_IF_NOT_ALIGN): Use it.
(SET_TYPE_WARN_IF_NOT_ALIGN): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/class-10_a.H: New test.
* g++.dg/modules/class-10_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
When compiling with '-fdeclone-ctor-dtor' (enabled by default with -Os),
we run into issues where we don't correctly emit the underlying
functions. We also need to ensure that COMDAT constructors are marked
as such before 'maybe_clone_body' attempts to propagate COMDAT groups to
the new thunks.
gcc/cp/ChangeLog:
* module.cc (post_load_processing): Mark COMDAT as needed, emit
declarations if maybe_clone_body fails.
gcc/testsuite/ChangeLog:
* g++.dg/modules/clone-2_a.C: New test.
* g++.dg/modules/clone-2_b.C: New test.
* g++.dg/modules/clone-3_a.C: New test.
* g++.dg/modules/clone-3_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
The ICE in the linked PR is caused because maybe_clone_decl is not
prepared to be called on a declaration that has already had clones
created; what happens otherwise is that start_preparsed_function early
exits and never sets up cfun, causing a segfault later on.
To fix this we ensure that post_load_processing only calls
maybe_clone_decl if TREE_ASM_WRITTEN has not been marked on the
declaration yet, and (if maybe_clone_decls succeeds) marks this flag on
the decl so that it doesn't get called again later when finalising
deferred vague linkage declarations in c_parse_final_cleanups.
As a bonus this now allows us to only keep the DECL_SAVED_TREE around in
expand_or_defer_fn_1 for modules which have CMIs, which will have
benefits for LTO performance in non-interface TUs.
For clarity we also update the streaming code to do post_load_decls for
maybe in-charge cdtors rather than any DECL_ABSTRACT_P declaration, as
this is more accurate to the decls affected by maybe_clone_body.
PR c++/115007
gcc/cp/ChangeLog:
* module.cc (module_state::read_cluster): Replace
DECL_ABSTRACT_P with DECL_MAYBE_IN_CHARGE_CDTOR_P.
(post_load_processing): Check and mark TREE_ASM_WRITTEN.
* semantics.cc (expand_or_defer_fn_1): Use the more specific
module_maybe_has_cmi_p instead of modules_p.
gcc/testsuite/ChangeLog:
* g++.dg/modules/virt-6_a.C: New test.
* g++.dg/modules/virt-6_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
In some cases we can access members of a namespace-scope class without
ever having performed name-lookup on it; this can occur when a
forward-declaration of the class is used as a return type, for
instance, or with PIMPL.
One possible approach would be to do name lookup in complete_type to
force lazy loading to occur, but this seems overly expensive for a
relatively rare case. Instead, this patch generalises the existing
pending-entity support to handle this case as well.
Unfortunately this does mean that almost every class definition will be
added to the pending-entity table, and almost always unnecessarily, but
I don't see a good way to avoid this.
gcc/cp/ChangeLog:
* module.cc (depset::DB_IS_MEMBER_BIT): Rename to...
(depset::DB_IS_PENDING_BIT): ...this.
(depset::is_member): Remove.
(depset::is_pending_entity): New function.
(depset::hash::make_dependency): Mark definitions of
namespace-scope types as maybe-pending entities.
(depset::hash::add_class_entities): Rename DB_IS_MEMBER_BIT to
DB_IS_PENDING_BIT.
(depset::hash::find_dependencies): Use is_pending_entity
instead of is_member.
(module_state::write_pendings): Likewise; adjust comment.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inst-4_b.C: Adjust pending-entity count.
* g++.dg/modules/member-def-1_c.C: Likewise.
* g++.dg/modules/member-def-2_c.C: Likewise.
* g++.dg/modules/tpl-spec-3_b.C: Likewise.
* g++.dg/modules/tpl-spec-4_b.C: Likewise.
* g++.dg/modules/tpl-spec-5_b.C: Likewise.
* g++.dg/modules/class-9_a.H: New test.
* g++.dg/modules/class-9_b.H: New test.
* g++.dg/modules/class-9_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
init_modules has rejected -M -fmodules-ts on the premise that module
dependency analysis requires macro expansion, but this is no longer
accurate; P1857 prohibited module directives produced by macro expansion.
They can still be dependent on #if directives, but those are still handled
with -fdirectives-only.
What wasn't working was -M or -dM, because cpp_scan_nooutput never called
module_token_pre to implement the import. The simplest fix is to use the
-fdirectives-only scan when modules are enabled and teach directives_only_cb
about flag_no_output.
gcc/cp/ChangeLog:
* module.cc (init_modules): Don't warn about -M.
gcc/c-family/ChangeLog:
* c-ppoutput.cc (preprocess_file): For modules,
use directives-only scan even with flag_no_output.
(directives_only_cb): Respect flag_no_output.
gcc/ChangeLog:
* doc/invoke.texi (C++ Module Preprocessing): Allow -M,
refer to -fdeps.
gcc/testsuite/ChangeLog:
* g++.dg/modules/macro-8_a.H: New test.
* g++.dg/modules/macro-8_b.C: New test.
* g++.dg/modules/macro-8_c.C: New test.
* g++.dg/modules/macro-8_d.C: New test.
|
|
Currently the streaming code uses TREE_CONSTANT to determine whether an
entity will have a definition that is interesting to stream out. This
is not sufficient, however; we also need to write the definition of
references, since although not TREE_CONSTANT they can still be usable in
constant expressions.
As such this patch uses the existing decl_maybe_constant_var function
which correctly handles this case.
gcc/cp/ChangeLog:
* module.cc (has_definition): Use decl_maybe_constant_var
instead of TREE_CONSTANT.
gcc/testsuite/ChangeLog:
* g++.dg/modules/cexpr-5_a.C: New test.
* g++.dg/modules/cexpr-5_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
My last fix for this issue (PR c++/114947, r15-810) didn't go far
enough; I had assumed that the issue where we lost track of partial
specialisations we would need to walk again later was limited to
partitions (where we always re-walk all specialisations), but the linked
PR is the same cause but for header units, and it is possible to
construct test cases exposing the same bug just for normal modules.
As such this patch just unconditionally ensures that whenever we modify
DECL_TEMPLATE_SPECIALIZATIONS we also track any partial specialisations
that might have added.
Also clean up a couple of comments and assertions to make expected state
more obvious when processing these specs.
PR c++/116496
gcc/cp/ChangeLog:
* module.cc (trees_in::decl_value): Don't call
set_defining_module_for_partial_spec here.
(depset::hash::add_partial_entities): Clarity assertions.
* pt.cc (add_mergeable_specialization): Always call
set_defining_module_for_partial_spec when adding a partial spec.
gcc/testsuite/ChangeLog:
* g++.dg/modules/partial-5_a.C: New test.
* g++.dg/modules/partial-5_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
Rename diagnostic_context's "printer" field to "m_printer",
for consistency with other fields, and to highlight places
where we currently use this, to help assess feasibility
of supporting multiple output sinks (PR other/116613).
No functional change intended.
gcc/ChangeLog:
PR other/116613
* attribs.cc (decls_mismatched_attributes): Rename
diagnostic_context's "printer" field to "m_printer".
(attr_access::array_as_string): Likewise.
* diagnostic-format-json.cc
(json_output_format::on_report_diagnostic): Likewise.
(diagnostic_output_format_init_json): Likewise.
* diagnostic-format-sarif.cc
(sarif_result::on_nested_diagnostic): Likewise.
(sarif_ice_notification): Likewise.
(sarif_builder::on_report_diagnostic): Likewise.
(sarif_builder::make_result_object): Likewise.
(sarif_builder::make_location_object): Likewise.
(sarif_builder::make_message_object_for_diagram): Likewise.
(diagnostic_output_format_init_sarif): Likewise.
* diagnostic-format-text.cc
(diagnostic_text_output_format::~diagnostic_text_output_format):
Likewise.
(diagnostic_text_output_format::on_report_diagnostic): Likewise.
(diagnostic_text_output_format::on_diagram): Likewise.
(diagnostic_text_output_format::print_any_cwe): Likewise.
(diagnostic_text_output_format::print_any_rules): Likewise.
(diagnostic_text_output_format::print_option_information):
Likewise.
* diagnostic-format.h (diagnostic_output_format::get_printer):
New.
* diagnostic-global-context.cc (verbatim): Rename
diagnostic_context's "printer" field to "m_printer".
* diagnostic-path.cc (path_label::get_text): Likewise.
(print_path_summary_as_text): Likewise.
(diagnostic_context::print_path): Likewise.
(selftest::test_empty_path): Likewise.
(selftest::test_intraprocedural_path): Likewise.
(selftest::test_interprocedural_path_1): Likewise.
(selftest::test_interprocedural_path_2): Likewise.
(selftest::test_recursion): Likewise.
(selftest::test_control_flow_1): Likewise.
(selftest::test_control_flow_2): Likewise.
(selftest::test_control_flow_3): Likewise.
(assert_cfg_edge_path_streq): Likewise.
(selftest::test_control_flow_5): Likewise.
(selftest::test_control_flow_6): Likewise.
* diagnostic-show-locus.cc (layout::layout): Likewise.
(selftest::test_layout_x_offset_display_utf8): Likewise.
(selftest::test_layout_x_offset_display_tab): Likewise.
(selftest::test_diagnostic_show_locus_unknown_location): Likewise.
(selftest::test_one_liner_simple_caret): Likewise.
(selftest::test_one_liner_no_column): Likewise.
(selftest::test_one_liner_caret_and_range): Likewise.
(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
(selftest::test_one_liner_fixit_insert_before): Likewise.
(selftest::test_one_liner_fixit_insert_after): Likewise.
(selftest::test_one_liner_fixit_remove): Likewise.
(selftest::test_one_liner_fixit_replace): Likewise.
(selftest::test_one_liner_fixit_replace_non_equal_range):
Likewise.
(selftest::test_one_liner_fixit_replace_equal_secondary_range):
Likewise.
(selftest::test_one_liner_fixit_validation_adhoc_locations):
Likewise.
(selftest::test_one_liner_many_fixits_1): Likewise.
(selftest::test_one_liner_many_fixits_2): Likewise.
(selftest::test_one_liner_labels): Likewise.
(selftest::test_one_liner_simple_caret_utf8): Likewise.
(selftest::test_one_liner_caret_and_range_utf8): Likewise.
(selftest::test_one_liner_multiple_carets_and_ranges_utf8):
Likewise.
(selftest::test_one_liner_fixit_insert_before_utf8): Likewise.
(selftest::test_one_liner_fixit_insert_after_utf8): Likewise.
(selftest::test_one_liner_fixit_remove_utf8): Likewise.
(selftest::test_one_liner_fixit_replace_utf8): Likewise.
(selftest::test_one_liner_fixit_replace_non_equal_range_utf8):
Likewise.
(selftest::test_one_liner_fixit_replace_equal_secondary_range_utf8):
Likewise.
(selftest::test_one_liner_fixit_validation_adhoc_locations_utf8):
Likewise.
(selftest::test_one_liner_many_fixits_1_utf8): Likewise.
(selftest::test_one_liner_many_fixits_2_utf8): Likewise.
(selftest::test_one_liner_labels_utf8): Likewise.
(selftest::test_one_liner_colorized_utf8): Likewise.
(selftest::test_add_location_if_nearby): Likewise.
(selftest::test_diagnostic_show_locus_fixit_lines): Likewise.
(selftest::test_overlapped_fixit_printing): Likewise.
(selftest::test_overlapped_fixit_printing_utf8): Likewise.
(selftest::test_overlapped_fixit_printing_2): Likewise.
(selftest::test_fixit_insert_containing_newline): Likewise.
(selftest::test_fixit_insert_containing_newline_2): Likewise.
(selftest::test_fixit_replace_containing_newline): Likewise.
(selftest::test_fixit_deletion_affecting_newline): Likewise.
(selftest::test_tab_expansion): Likewise.
(selftest::test_escaping_bytes_1): Likewise.
(selftest::test_escaping_bytes_2): Likewise.
(selftest::test_line_numbers_multiline_range): Likewise.
* diagnostic.cc (file_name_as_prefix): Likewise.
(diagnostic_set_caret_max_width): Likewise.
(diagnostic_context::initialize): Likewise.
(diagnostic_context::color_init): Likewise.
(diagnostic_context::urls_init): Likewise.
(diagnostic_context::finish): Likewise.
(diagnostic_context::get_location_text): Likewise.
(diagnostic_build_prefix): Likewise.
(diagnostic_context::report_current_module): Likewise.
(default_diagnostic_starter): Likewise.
(default_diagnostic_start_span_fn): Likewise.
(default_diagnostic_finalizer): Likewise.
(diagnostic_context::report_diagnostic): Likewise.
(diagnostic_append_note): Likewise.
(diagnostic_context::error_recursion): Likewise.
(fancy_abort): Likewise.
* diagnostic.h (diagnostic_context::set_show_highlight_colors):
Likewise.
(diagnostic_context::printer): Rename to...
(diagnostic_context::m_printer): ...this.
(diagnostic_format_decoder): Rename diagnostic_context's "printer"
field to "m_printer".
(diagnostic_prefixing_rule): Likewise.
(diagnostic_ready_p): Likewise.
* gimple-ssa-warn-access.cc (pass_waccess::maybe_warn_memmodel):
Likewise.
* langhooks.cc (lhd_print_error_function): Likewise.
* lto-wrapper.cc (print_lto_docs_link): Likewise.
* opts-global.cc (init_options_once): Likewise.
* opts.cc (common_handle_option): Likewise.
* simple-diagnostic-path.cc (simple_diagnostic_path_cc_tests):
Likewise.
* text-art/dump.h (dump_to_file<T>): Likewise.
* toplev.cc (announce_function): Likewise.
(toplev::main): Likewise.
* tree-diagnostic.cc (default_tree_diagnostic_starter): Likewise.
* tree.cc (escaped_string::escape): Likewise.
(selftest::test_escaped_strings): Likewise.
gcc/ada/ChangeLog:
PR other/116613
* gcc-interface/misc.cc (internal_error_function): Rename
diagnostic_context's "printer" field to "m_printer".
gcc/analyzer/ChangeLog:
PR other/116613
* access-diagram.cc (access_range::dump): Rename
diagnostic_context's "printer" field to "m_printer".
* analyzer-language.cc (on_finish_translation_unit): Likewise.
* analyzer.cc (make_label_text): Likewise.
(make_label_text_n): Likewise.
* call-details.cc (call_details::dump): Likewise.
* call-summary.cc (call_summary::dump): Likewise.
(call_summary_replay::dump): Likewise.
* checker-event.cc (checker_event::debug): Likewise.
* constraint-manager.cc (range::dump): Likewise.
(bounded_range::dump): Likewise.
(bounded_ranges::dump): Likewise.
(constraint_manager::dump): Likewise.
* diagnostic-manager.cc
(diagnostic_manager::emit_saved_diagnostic): Likewise.
* engine.cc (exploded_node::dump): Likewise.
(exploded_path::dump): Likewise.
(run_checkers): Likewise.
* kf-analyzer.cc (kf_analyzer_dump_escaped::impl_call_pre):
Likewise.
* pending-diagnostic.cc (evdesc::event_desc::formatted_print):
Likewise.
* program-point.cc (function_point::print_source_line): Likewise.
(program_point::dump): Likewise.
* program-state.cc (extrinsic_state::dump_to_file): Likewise.
(sm_state_map::dump): Likewise.
(program_state::dump_to_file): Likewise.
* ranges.cc (symbolic_byte_offset::dump): Likewise.
(symbolic_byte_range::dump): Likewise.
* region-model-reachability.cc (reachable_regions::dump): Likewise.
* region-model.cc (region_to_value_map::dump): Likewise.
(region_model::dump): Likewise.
(model_merger::dump): Likewise.
* region.cc (region_offset::dump): Likewise.
(region::dump): Likewise.
* sm-malloc.cc (deallocator_set::dump): Likewise.
(sufficiently_similar_p): Likewise.
* store.cc (uncertainty_t::dump): Likewise.
(binding_key::dump): Likewise.
(binding_map::dump): Likewise.
(binding_cluster::dump): Likewise.
(store::dump): Likewise.
* supergraph.cc (supergraph::dump_dot_to_file): Likewise.
(superedge::dump): Likewise.
* svalue.cc (svalue::dump): Likewise.
gcc/c-family/ChangeLog:
PR other/116613
* c-format.cc (selftest::test_type_mismatch_range_labels): Rename
diagnostic_context's "printer" field to "m_printer".
(selftest::test_type_mismatch_range_labels): Likewise.
* c-opts.cc (c_diagnostic_finalizer): Likewise.
gcc/c/ChangeLog:
PR other/116613
* c-objc-common.cc (c_initialize_diagnostics): Rename
diagnostic_context's "printer" field to "m_printer".
gcc/cp/ChangeLog:
PR other/116613
* error.cc (cxx_initialize_diagnostics): Rename
diagnostic_context's "printer" field to "m_printer".
(cxx_print_error_function): Likewise.
(cp_diagnostic_starter): Likewise.
(cp_print_error_function): Likewise.
(print_instantiation_full_context): Likewise.
(print_instantiation_partial_context_line): Likewise.
(maybe_print_constexpr_context): Likewise.
(print_location): Likewise.
(print_constrained_decl_info): Likewise.
(print_concept_check_info): Likewise.
(print_constraint_context_head): Likewise.
(print_requires_expression_info): Likewise.
* module.cc (noisy_p): Likewise.
gcc/d/ChangeLog:
PR other/116613
* d-diagnostic.cc (d_diagnostic_report_diagnostic): Rename
diagnostic_context's "printer" field to "m_printer".
gcc/fortran/ChangeLog:
PR other/116613
* error.cc (gfc_clear_pp_buffer): Rename diagnostic_context's
"printer" field to "m_printer".
(gfc_warning): Likewise.
(gfc_diagnostic_build_kind_prefix): Likewise.
(gfc_diagnostic_build_locus_prefix): Likewise.
(gfc_diagnostic_starter): Likewise.
(gfc_diagnostic_starter): Likewise.
(gfc_diagnostic_start_span): Likewise.
(gfc_diagnostic_finalizer): Likewise.
(gfc_warning_check): Likewise.
(gfc_error_opt): Likewise.
(gfc_error_check): Likewise.
gcc/jit/ChangeLog:
PR other/116613
* jit-playback.cc (add_diagnostic): Rename diagnostic_context's
"printer" field to "m_printer".
gcc/testsuite/ChangeLog:
PR other/116613
* gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info):
Update for renaming of field "printer" to "m_printer".
* gcc.dg/plugin/diagnostic_group_plugin.c
(test_diagnostic_starter): Likewise.
(test_diagnostic_start_span_fn): Likewise.
(test_output_format::on_begin_group): Likewise.
(test_output_format::on_end_group): Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_paths.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(custom_diagnostic_finalizer): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
This patch goes through all .cc files in gcc/cp and adds in any
auto_diagnostic_groups that seem to be missing by looking for any
'inform' calls that aren't grouped with their respective error/warning.
Now with SARIF output support this seems to be a bit more important.
The patch isn't complete; I've tried to also track helper functions used
for diagnostics to group them, but some may have been missed.
Additionally there are a few functions that are definitely missing
groupings but I wasn't able to see an obvious way to add them without
potentially grouping together unrelated messages.
This list includes:
- lazy_load_{binding,pendings} "during load of {binding,pendings} for"
- cp_finish_decomp "in initialization of structured binding variable"
- require_deduced_type "using __builtin_source_location"
- convert_nontype_argument "in template argument for type %qT"
- coerce_template_params "so any instantiation with a non-empty parameter pack"
- tsubst_default_argument "when instantiating default argument"
- invalid_nontype_parm_type_p "invalid template non-type parameter"
gcc/cp/ChangeLog:
* class.cc (add_method): Add missing auto_diagnostic_group.
(handle_using_decl): Likewise.
(maybe_warn_about_overly_private_class): Likewise.
(check_field_decl): Likewise.
(check_field_decls): Likewise.
(resolve_address_of_overloaded_function): Likewise.
(note_name_declared_in_class): Likewise.
* constraint.cc (associate_classtype_constraints): Likewise.
(diagnose_trait_expr): Clean up whitespace.
* coroutines.cc (find_coro_traits_template_decl): Add missing
auto_diagnostic_group.
(coro_promise_type_found_p): Likewise.
(coro_diagnose_throwing_fn): Likewise.
* cvt.cc (build_expr_type_conversion): Likewise.
* decl.cc (validate_constexpr_redeclaration): Likewise.
(duplicate_function_template_decls): Likewise.
(duplicate_decls): Likewise.
(lookup_label_1): Likewise.
(check_previous_goto_1): Likewise.
(check_goto_1): Likewise.
(make_typename_type): Likewise.
(make_unbound_class_template): Likewise.
(check_tag_decl): Likewise.
(start_decl): Likewise.
(maybe_commonize_var): Likewise.
(check_for_uninitialized_const_var): Likewise.
(reshape_init_class): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
(find_decomp_class_base): Likewise.
(cp_finish_decomp): Likewise.
(expand_static_init): Likewise.
(grokfndecl): Likewise.
(grokdeclarator): Likewise.
(check_elaborated_type_specifier): Likewise.
(lookup_and_check_tag): Likewise.
(xref_tag): Likewise.
(cxx_simulate_enum_decl): Likewise.
(finish_function): Likewise.
* decl2.cc (check_classfn): Likewise.
(record_mangling): Likewise.
(mark_used): Likewise.
* error.cc (qualified_name_lookup_error): Likewise.
* except.cc (build_throw): Likewise.
* init.cc (get_nsdmi): Likewise.
(diagnose_uninitialized_cst_or_ref_member_1): Likewise.
(warn_placement_new_too_small): Likewise.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(build_delete): Likewise.
* lambda.cc (add_capture): Likewise.
(add_default_capture): Likewise.
* lex.cc (unqualified_fn_lookup_error): Likewise.
* method.cc (synthesize_method): Likewise.
(defaulted_late_check): Likewise.
* module.cc (trees_in::is_matching_decl): Likewise.
(trees_in::read_enum_def): Likewise.
(module_state::check_not_purview): Likewise.
(module_state::deferred_macro): Likewise.
(module_state::read_config): Likewise.
(module_state::check_read): Likewise.
(declare_module): Likewise.
(init_modules): Likewise.
* name-lookup.cc (diagnose_name_conflict): Likewise.
(lookup_using_decl): Likewise.
(set_decl_namespace): Likewise.
(finish_using_directive): Likewise.
(push_namespace): Likewise.
(add_imported_namespace): Likewise.
* parser.cc (cp_parser_check_for_definition_in_return_type): Likewise.
(cp_parser_userdef_numeric_literal): Likewise.
(cp_parser_nested_name_specifier_opt): Likewise.
(cp_parser_new_expression): Likewise.
(cp_parser_binary_expression): Likewise.
(cp_parser_lambda_introducer): Likewise.
(cp_parser_module_declaration): Likewise.
(cp_parser_import_declaration): Likewise, removing gotos to
support this.
(cp_parser_declaration): Add missing auto_diagnostic_group.
(cp_parser_decl_specifier_seq): Likewise.
(cp_parser_template_id): Likewise.
(cp_parser_template_name): Likewise.
(cp_parser_explicit_specialization): Likewise.
(cp_parser_placeholder_type_specifier): Likewise.
(cp_parser_elaborated_type_specifier): Likewise.
(cp_parser_enum_specifier): Likewise.
(cp_parser_asm_definition): Likewise.
(cp_parser_init_declarator): Likewise.
(cp_parser_direct_declarator): Likewise.
(cp_parser_class_head): Likewise.
(cp_parser_member_declaration): Likewise.
(cp_parser_lookup_name): Likewise.
(cp_parser_explicit_template_declaration): Likewise.
(cp_parser_check_class_key): Likewise.
* pt.cc (maybe_process_partial_specialization): Likewise.
(determine_specialization): Likewise.
(check_for_bare_parameter_packs): Likewise.
(check_template_shadow): Likewise.
(process_partial_specialization): Likewise.
(push_template_decl): Likewise.
(redeclare_class_template): Likewise.
(convert_nontype_argument_function): Likewise.
(check_valid_ptrmem_cst_expr): Likewise.
(convert_nontype_argument): Likewise.
(convert_template_argument): Likewise.
(coerce_template_parms): Likewise.
(tsubst_qualified_id): Likewise.
(tsubst_expr): Likewise.
(most_specialized_partial_spec): Likewise.
(do_class_deduction): Likewise.
(do_auto_deduction): Likewise.
* search.cc (lookup_member): Likewise.
* semantics.cc (finish_non_static_data_member): Likewise.
(process_outer_var_ref): Likewise.
(finish_id_expression_1): Likewise.
(finish_offsetof): Likewise.
(omp_reduction_lookup): Likewise.
(finish_omp_clauses): Likewise.
* tree.cc (check_abi_tag_redeclaration): Likewise.
(check_abi_tag_args): Likewise.
* typeck.cc (invalid_nonstatic_memfn_p): Likewise.
(complain_about_unrecognized_member): Likewise.
(finish_class_member_access_expr): Likewise.
(error_args_num): Likewise.
(warn_for_null_address): Likewise.
(cp_build_binary_op): Likewise.
(build_x_unary_op): Likewise.
(cp_build_unary_op): Likewise.
(build_static_cast): Likewise.
(cp_build_modify_expr): Likewise.
(get_delta_difference): Likewise.
(convert_for_assignment): Widen scope of auto_diagnostic_group.
(check_return_expr): Add missing auto_diagnostic_group.
* typeck2.cc (cxx_incomplete_type_diagnostic): Likewise.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
|
|
After importing a header unit we learn about and setup any header
modules that we transitively depend on. However, this causes
'set_filename' to fail an assertion if we then come across this header
as an #include and attempt to translate it into a module. We still need
to do this translation so that libcpp learns that this is a header unit,
but we shouldn't error just because we've already seen it as an import.
Instead this patch merely checks and errors to handle the case of a
broken mapper implementation which supplies a different CMI path from
the one we already got.
As a drive-by fix, also make failing to find the CMI for a module be a
fatal error: any further errors in the TU are unlikely to be helpful.
PR c++/99243
gcc/cp/ChangeLog:
* module.cc (module_state::set_filename): Handle repeated calls
to 'set_filename' as long as the CMI path matches.
(maybe_translate_include): Adjust comment.
gcc/testsuite/ChangeLog:
* g++.dg/modules/map-2.C: Prune additional fatal error message.
* g++.dg/modules/inc-xlate-4_a.H: New test.
* g++.dg/modules/inc-xlate-4_b.H: New test.
* g++.dg/modules/inc-xlate-4_c.H: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
Currently the handling of include translation is confusing to read,
using a tri-state integer without much clarity on what different states
mean. This patch cleans this up to use explicit enumerators indicating
the different possible states instead, and fixes a bug where the option
'-flang-info-include-translate' ended being accidentally unusable.
PR c++/110980
gcc/cp/ChangeLog:
* module.cc (maybe_translate_include): Clean up.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inc-xlate-2_a.H: New test.
* g++.dg/modules/inc-xlate-2_b.H: New test.
* g++.dg/modules/inc-xlate-3.h: New test.
* g++.dg/modules/inc-xlate-3_a.H: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
It was pointed out to me that the current error referencing an internal
linkage entity reads almost like an ICE message, with the message
finishing with the unhelpful:
m.cpp:1:8: error: failed to write compiled module: Bad file data
1 | export module M;
| ^~~~~~
Similarly, whenever we decide not to emit a module CMI due to other
errors we currently emit the following message:
m.cpp:1:8: warning: not writing module âMâ due to errors
1 | export module M;
| ^~~~~~
Neither of these messages really add anything useful; users already
understand that when an error is reported then the normal outputs will
not be created, so these messages are just noise.
There is one case we still need this latter message, however; when an
error in a template has been silenced with '-Wno-template-body' we still
don't want to write a module CMI, so emit an error now instead.
This patch also removes a number of dg-prune-output directives in the
testsuite that are no longer needed with this change.
gcc/cp/ChangeLog:
* module.cc (module_state::write_begin): Return a boolean to
indicate errors rather than just doing set_error().
(finish_module_processing): Prevent emission of unnecessary
errors; only indicate module writing occurred if write_begin
succeeds.
gcc/testsuite/ChangeLog:
* g++.dg/modules/export-1.C: Remove message.
* g++.dg/modules/internal-1.C: Remove message.
* g++.dg/modules/ambig-2_b.C: Remove unnecessary pruning.
* g++.dg/modules/atom-decl-2.C: Likewise.
* g++.dg/modules/atom-pragma-3.C: Likewise.
* g++.dg/modules/atom-preamble-2_f.C: Likewise.
* g++.dg/modules/block-decl-2.C: Likewise.
* g++.dg/modules/dir-only-4.C: Likewise.
* g++.dg/modules/enum-12.C: Likewise.
* g++.dg/modules/exp-xlate-1_b.C: Likewise.
* g++.dg/modules/export-3.C: Likewise.
* g++.dg/modules/friend-3.C: Likewise.
* g++.dg/modules/friend-5_b.C: Likewise.
* g++.dg/modules/inc-xlate-1_e.C: Likewise.
* g++.dg/modules/linkage-2.C: Likewise.
* g++.dg/modules/local-extern-1.C: Likewise.
* g++.dg/modules/main-1.C: Likewise.
* g++.dg/modules/map-2.C: Likewise.
* g++.dg/modules/mod-decl-1.C: Likewise.
* g++.dg/modules/mod-decl-3.C: Likewise.
* g++.dg/modules/pr99174.H: Likewise.
* g++.dg/modules/pr99468.H: Likewise.
* g++.dg/modules/token-1.C: Likewise.
* g++.dg/modules/token-3.C: Likewise.
* g++.dg/modules/token-4.C: Likewise.
* g++.dg/modules/token-5.C: Likewise.
* g++.dg/modules/using-10.C: Likewise.
* g++.dg/modules/using-12.C: Likewise.
* g++.dg/modules/using-3.C: Likewise.
* g++.dg/modules/using-9.C: Likewise.
* g++.dg/modules/using-enum-2.C: Likewise.
* g++.dg/modules/permissive-error-1.C: New test.
* g++.dg/modules/permissive-error-2.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
[PR115020]
The error in the linked PR is caused because 'DECL_THIS_STATIC' is true
for the static member function, causing the streaming code to assume
that this is an internal linkage GM entity that needs to be explicitly
streamed, which then on read-in gets marked as a vague linkage function
(despite being non-inline) causing import_export_decl to complain.
However, I don't see any reason why we should care about this:
definitions in the GMF should just be emitted as per usual regardless of
whether they're internal-linkage or not. Actually the only thing we
care about here are header modules, since they have no TU to write
definitions into. As such this patch removes these conditions from
'has_definition' and updates some comments to clarify.
PR c++/115020
gcc/cp/ChangeLog:
* module.cc (has_definition): Only force writing definitions for
header_module_p.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr115020_a.C: New test.
* g++.dg/modules/pr115020_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
Currently we implement [temp.deduct.guide] p1 by forcing all deduction
guides to be considered as exported. However this is not sufficient:
for transitive non-exported imports we will still hide the deduction
guide from name lookup, causing errors.
This patch instead adjusts name lookup to have a new ANY_REACHABLE flag
to allow for this case. Currently this is only used by deduction guides
but there are some other circumstances where this may be useful in the
future (e.g. finding existing temploid friends).
PR c++/116403
gcc/cp/ChangeLog:
* pt.cc (deduction_guides_for): Use ANY_REACHABLE for lookup of
deduction guides.
* module.cc (depset::hash::add_deduction_guides): Likewise.
(module_state::write_cluster): No longer override deduction
guides as exported.
* name-lookup.cc (name_lookup::search_namespace_only): Ignore
visibility when LOOK_want::ANY_REACHABLE is specified.
(check_module_override): Ignore visibility when checking for
ambiguating deduction guides.
* name-lookup.h (LOOK_want): New flag 'ANY_REACHABLE'.
gcc/testsuite/ChangeLog:
* g++.dg/modules/dguide-4_a.C: New test.
* g++.dg/modules/dguide-4_b.C: New test.
* g++.dg/modules/dguide-4_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
When reading an NTTP we call get_template_parm_object which delegates
setting of DECL_INITIAL to the general cp_finish_decl procedure, which
calls check_initializer to validate and record it.
Apart from being unnecessary (it must have already been validated by the
writing module), this also causes errors in cases like the linked PR, as
validating may end up needing to call lazy_load_pendings to determine
any specialisations that may exist which violates assumptions of the
modules streaming code.
This patch works around the issue by adding a flag to
get_template_parm_object to disable these checks when not needed.
PR c++/116382
gcc/cp/ChangeLog:
* cp-tree.h (get_template_parm_object): Add check_init param.
* module.cc (trees_in::tree_node): Pass check_init=false when
building NTTPs.
* pt.cc (get_template_parm_object): Prevent cp_finish_decl from
validating the initializer when check_init=false.
gcc/testsuite/ChangeLog:
* g++.dg/modules/tpl-nttp-1_a.C: New test.
* g++.dg/modules/tpl-nttp-1_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
We need to use the DECL_TEMPLATE_INSTANTIATIONS property to find
reachable specialisations from a template to ensure that any GM
specialisations are properly marked as reachable.
Currently the modules code uses the decl when rebuilding this property,
but this is not always correct; it appears that for type specialisations
we need to use the TREE_TYPE of the decl instead so that the
specialisation is correctly found. This patch makes the required
adjustments.
PR c++/116364
gcc/cp/ChangeLog:
* cp-tree.h (get_mergeable_specialization_flags): Adjust
signature.
* module.cc (trees_out::decl_value): Indicate whether this is a
type or decl specialisation.
* pt.cc (get_mergeable_specialization_flags): Match against the
type of a non-decl specialisation.
(add_mergeable_specialization): Use the already calculated spec
instead of always adding decl to DECL_TEMPLATE_INSTANTIATIONS.
gcc/testsuite/ChangeLog:
* g++.dg/modules/tpl-spec-9_a.C: New test.
* g++.dg/modules/tpl-spec-9_b.C: New test.
* g++.dg/modules/tpl-spec-9_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
While stepping through some code I noticed that we do some extra work
(finding the originating module decl, stripping the template, and
inspecting the attached-ness) for every declaration taken from a header
unit. This doesn't seem necessary though since no declaration in a
header unit can be attached to anything but the global module, so we can
just assume that global_p will be true.
This was the original behaviour before I removed this assumption while
refactoring for r15-2807-gc592310d5275e0.
gcc/cp/ChangeLog:
* module.cc (module_state::read_cluster): Assume header module
declarations will require GM merging.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
Currently name lookup generally seems to assume that all entities
declared within a named module (partition) are attached to said module,
which is not true for GM entities (e.g. via extern "C++"), and causes
issues with deduplication.
This patch fixes the issue by ensuring that module attachment of a
declaration is consistently used to handling merging. Handling this
exposes some issues with deduplicating temploid friends; to resolve this
we always create the BINDING_SLOT_PARTITION slot so that we have
somewhere to place attached names (from any module).
This doesn't yet completely handle issues with allowing otherwise
conflicting temploid friends from different modules to co-exist in the
same module if neither are reachable from the other via name lookup.
PR c++/114950
gcc/cp/ChangeLog:
* module.cc (trees_out::decl_value): Stream bit indicating
imported temploid friends early.
(trees_in::decl_value): Use this bit with key_mergeable.
(trees_in::key_mergeable): Allow merging attached declarations
if they're imported temploid friends (which must be namespace
scope).
(module_state::read_cluster): Check for GM entities that may
require merging even when importing from partitions.
* name-lookup.cc (enum binding_slots): Adjust comment.
(get_fixed_binding_slot): Always create partition slot.
(name_lookup::search_namespace_only): Support binding vectors
with both partition and GM entities to dedup.
(walk_module_binding): Likewise.
(name_lookup::adl_namespace_fns): Likewise.
(set_module_binding): Likewise.
(check_module_override): Use attachment of the decl when
checking overrides rather than named_module_p.
(lookup_imported_hidden_friend): Use partition slot for finding
mergeable template bindings.
* name-lookup.h (set_module_binding): Split mod_glob_flag
parameter into separate global_p and partition_p params.
gcc/testsuite/ChangeLog:
* g++.dg/modules/tpl-friend-13_e.C: Adjust error message.
* g++.dg/modules/ambig-2_a.C: New test.
* g++.dg/modules/ambig-2_b.C: New test.
* g++.dg/modules/part-9_a.C: New test.
* g++.dg/modules/part-9_b.C: New test.
* g++.dg/modules/part-9_c.C: New test.
* g++.dg/modules/tpl-friend-15.h: New test.
* g++.dg/modules/tpl-friend-15_a.C: New test.
* g++.dg/modules/tpl-friend-15_b.C: New test.
* g++.dg/modules/tpl-friend-15_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
This error message reads to me the wrong way around, particularly in the
context of other errors. Updated so that the ellipsis connect.
gcc/cp/ChangeLog:
* module.cc (trees_in::read_enum_def): Clarify error.
gcc/testsuite/ChangeLog:
* g++.dg/modules/enum-bad-1_b.C: Update error message.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
Deduction guides are represented as 'normal' functions currently, and
have no special handling in modules. However, this causes some issues;
by [temp.deduct.guide] a deduction guide is not found by normal name
lookup and instead all reachable deduction guides for a class template
should be considered, but this does not happen currently.
To solve this, this patch ensures that all deduction guides are
considered exported to ensure that they are always visible to importers
if they are reachable. Another alternative here would be to add a new
kind of "all reachable" flag to name lookup, but that is complicated by
some difficulties in handling GM entities; this may be a better way to
go if more kinds of entities end up needing this handling, however.
Another issue here is that because deduction guides are "unrelated"
functions, they will usually get discarded from the GMF, so this patch
ensures that when finding dependencies, GMF deduction guides will also
have bindings created. We do this in find_dependencies so that we don't
unnecessarily create bindings for GMF deduction guides that are never
reached; for consistency we do this for *all* deduction guides, not just
GM ones. We also make sure that the opposite (a deduction guide being
the only purview reference to a GMF template) correctly marks it as
reachable.
Finally, when merging deduction guides from multiple modules, the name
lookup code may now return two-dimensional overload sets, so update
callers to match.
As a small drive-by improvement this patch also updates the error pretty
printing code to add a space before the '->' when printing a deduction
guide, so we get 'S(int) -> S<int>' instead of 'S(int)-> S<int>'.
PR c++/115231
gcc/cp/ChangeLog:
* error.cc (dump_function_decl): Add a space before '->' when
printing deduction guides.
* module.cc (depset::hash::add_binding_entity): Don't create
bindings for guides here, only mark dependencies.
(depset::hash::add_deduction_guides): New.
(depset::hash::find_dependencies): Add deduction guide
dependencies for a class template.
(module_state::write_cluster): Always consider deduction guides
as exported.
* pt.cc (deduction_guides_for): Use 'lkp_iterator' instead of
'ovl_iterator'.
gcc/testsuite/ChangeLog:
* g++.dg/modules/dguide-1_a.C: New test.
* g++.dg/modules/dguide-1_b.C: New test.
* g++.dg/modules/dguide-2_a.C: New test.
* g++.dg/modules/dguide-2_b.C: New test.
* g++.dg/modules/dguide-3_a.C: New test.
* g++.dg/modules/dguide-3_b.C: New test.
* g++.dg/modules/dguide-3_c.C: New test.
* g++.dg/modules/dguide-3_d.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
In recent versions of GCC we've been diagnosing more and more kinds of
errors inside a template ahead of time. This is a largely good thing
because it catches bugs, typos, dead code etc sooner.
But if the template never gets instantiated then such errors are harmless
and can be inconvenient to work around if say the code in question is
third party and in maintenance mode. So it'd be handy to be able to
prevent these template errors from rendering the entire TU uncompilable.
(Note that such code is "ill-formed no diagnostic required" according
the standard.)
To that end this patch turns any errors issued within a template into
permerrors associated with a new -Wtemplate-body flag so that they can
be downgraded via e.g. -fpermissive or -Wno-error=template-body. If
the template containing a downgraded error later needs to be instantiated,
we'll issue an error then. But if the template never gets instantiated
then the downgraded error won't affect validity of the rest of the TU.
This is implemented via a diagnostic hook that gets called for each
diagnostic, and which adjusts an error diagnostic appropriately if we
detect it's occurring from a template context, and additionally flags
the template as erroneous.
For example the new testcase permissive-error1a.C gives:
gcc/testsuite/g++.dg/template/permissive-error1a.C: In function 'void f()':
gcc/testsuite/g++.dg/template/permissive-error1a.C:7:5: warning: increment of read-only variable 'n' [-Wtemplate-body]
7 | ++n;
| ^
...
gcc/testsuite/g++.dg/template/permissive-error1a.C: In instantiation of 'void f() [with T = int]':
gcc/testsuite/g++.dg/template/permissive-error1a.C:26:9: required from here
26 | f<int>();
| ~~~~~~^~
gcc/testsuite/g++.dg/template/permissive-error1a.C:5:6: error: instantiating erroneous template
5 | void f() {
| ^
gcc/testsuite/g++.dg/template/permissive-error1a.C:7:5: note: first error appeared here
7 | ++n; // {
| ^
...
PR c++/116064
gcc/c-family/ChangeLog:
* c.opt (Wtemplate-body): New warning.
gcc/cp/ChangeLog:
* cp-tree.h (erroneous_templates_t): Declare.
(erroneous_templates): Declare.
(cp_seen_error): Declare.
(seen_error): #define to cp_seen_error.
* error.cc (get_current_template): Define.
(relaxed_template_errors): Define.
(cp_adjust_diagnostic_info): Define.
(cp_seen_error): Define.
(cxx_initialize_diagnostics): Set
diagnostic_context::m_adjust_diagnostic_info.
* module.cc (finish_module_processing): Don't write the
module if it contains an erroneous template.
* pt.cc (maybe_diagnose_erroneous_template): Define.
(instantiate_class_template): Call it.
(instantiate_decl): Likewise.
gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::initialize): Set
m_adjust_diagnostic_info.
(diagnostic_context::report_diagnostic): Call
m_adjust_diagnostic_info.
* diagnostic.h (diagnostic_context::m_adjust_diagnostic_info):
New data member.
* doc/invoke.texi (-Wno-template-body): Document.
(-fpermissive): Mention -Wtemplate-body.
gcc/testsuite/ChangeLog:
* g++.dg/ext/typedef-init.C: Downgrade error inside template
to warning due to -fpermissive.
* g++.dg/pr84492.C: Likewise.
* g++.old-deja/g++.pt/crash51.C: Remove unneeded dg-options.
* g++.dg/template/permissive-error1.C: New test.
* g++.dg/template/permissive-error1a.C: New test.
* g++.dg/template/permissive-error1b.C: New test.
* g++.dg/template/permissive-error1c.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
Currently we don't stream the contents of 'nowarn_map'; this means that
warning suppressions don't get applied in importers, which is
particularly relevant for templates (as in the linked testcase).
Rather than streaming the whole contents of 'nowarn_map', this patch
instead just streams the exported suppressions for each tree node
individually, to not build up additional locations and suppressions for
tree nodes that do not need to be streamed.
PR c++/115757
gcc/cp/ChangeLog:
* module.cc (trees_out::core_vals): Write warning specs for
DECLs and EXPRs.
(trees_in::core_vals): Read warning specs.
gcc/ChangeLog:
* tree.h (put_warning_spec_at): Declare new function.
(has_warning_spec): Likewise.
(get_warning_spec): Likewise.
(put_warning_spec): Likewise.
* diagnostic-spec.h (nowarn_spec_t::from_bits): New function.
* diagnostic-spec.cc (put_warning_spec_at): New function.
* warning-control.cc (has_warning_spec): New function.
(get_warning_spec): New function.
(put_warning_spec): New function.
gcc/testsuite/ChangeLog:
* g++.dg/modules/warn-spec-1_a.C: New test.
* g++.dg/modules/warn-spec-1_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
While lazy loading, instantiation of pendings can sometimes recursively
perform name lookup and begin further lazy loading. When using the
'-ftime-report' functionality this causes ICEs as we could start an
already-running timer for the importing.
This patch fixes the issue by using the 'timevar_cond*' API instead to
support such recursive calls.
PR c++/115165
gcc/cp/ChangeLog:
* module.cc (lazy_load_binding): Use 'timevar_cond*' APIs.
(lazy_load_pendings): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/timevar-1_a.H: New test.
* g++.dg/modules/timevar-1_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
With modules, a non-function using-declaration is not completely
interchangable with the declaration that it refers to; in particular,
such a using-declaration may be exported without revealing the name of
the entity it refers to.
This patch fixes this by building USING_DECLs for all using-declarations
that bind a non-function from a different scope. These new decls can
than have purviewness and exportingness attached to them without
affecting the decl that they refer to.
We do this for all such usings, not just usings that may be revealed in
a module; this way we can verify the change in representation against
the (more comprehensive) non-modules testsuites, and in a future patch
we can use the locations of these using-decls to enhance relevant
diagnostics.
Another possible approach would be to reuse OVERLOADs for this, as is
already done within add_binding_entity for modules. I didn't do this
because lots of code (as well as the names of the accessors) makes
assumptions that OVERLOADs refer to function overload sets, and so
splitting this up reduced semantic burden and made it easier to avoid
unintentional changes. This did mean that we need to move out the
definitions of ovl_iterator::{purview,exporting}_p, because the
structures for module decls are declared later on in cp-tree.h.
Building USING_DECLs changed a couple of code paths when adjusting
bindings; in particular, pushdecl recognises global using-declarations
as usings now, and so checks fall through to update_binding. To not
regress g++.dg/lookup/linkage2.C the checks for 'extern' declarations no
longer were sufficient (they don't handle 'extern "C"'); but
duplicate_decls performed all the relevant checks anyway.
Otherwise in general we strip using-decls from all lookup_* functions
where necessary. Over time for diagnostics purposes it would probably
be good to slowly revert this (especially e.g. lookup_elaborated_type
causes some diagnostic quality regressions here) but this patch doesn't
do so to minimise churn.
This patch also tries not to build USING_DECLs when just redeclaring an
existing declaration, and instead reveals that declaration in-place.
This requires reworking some logic handling CONST_DECLs in module
streaming, since a non-using CONST_DECL may now be exported indepenently
of its containing enum.
'add_binding_entity' needs to explicitly write the names of unscoped
enumerators so that lazy loading will trigger when the name is found by
name lookup; it does this by pretending that the enum declarations are
always usings so that it doesn't double-write definitions. By also
checking if the enumerator was marked purview/exported we can use that
to override a non-purview/non-exported TYPE_DECL and ensure it's made
visible regardless.
When reading we should get the exported flag on the enumeration
constant, and so should properly create a binding for it. We don't need
to do anything to handle importedness as that checking is skipped for
EK_USINGs.
Some other places assume that module information for a CONST_DECL
inherits module information from its containing type. This includes:
- get_originating_module_decl, for determining if the name was imported
or has module attachment; I don't /think/ this change should affect
that, so I'm leaving this untouched.
- binding_cmp, for sorting by exportedness; since now an enumerator
could be exported without the containing decl being exported, we need
to handle this here too.
PR c++/114683
gcc/cp/ChangeLog:
* cp-tree.h (class ovl_iterator): Move definitions of purview_p
and exporting_p to name-lookup.cc.
* module.cc (depset::hash::add_binding_entity): Strip
using-decls. Remove workarounds. Handle CONST_DECLs with
different purview/exported from their enum.
(enum ct_bind_flags): Remove unnecessary cbf_wrapped flag.
(module_state::write_cluster): Likewise.
(module_state::read_cluster): Build USING_DECL for non-function
usings.
(binding_cmp): Handle CONST_DECLs with different purview and/or
exported from their enum.
(set_instantiating_module): Support CONST_DECLs.
* name-lookup.cc (get_fixed_binding_slot): Strip USING_DECLs.
(name_lookup::process_binding): Strip USING_DECLs.
(name_lookup::process_module_binding): Remove workaround.
(update_binding): Strip USING_DECLs, remove incorrect check for
non-extern variables.
(ovl_iterator::purview_p): Support USING_DECLs.
(ovl_iterator::exporting_p): Support USING_DECLs.
(walk_module_binding): Handle stat hack type.
(do_nonmember_using_decl): Strip USING_DECLs when comparing;
build USING_DECLs for non-function usings in different scope
rather than binding directly.
(get_namespace_binding): Strip USING_DECLs.
(lookup_name): Strip USING_DECLs.
(lookup_elaborated_type): Strip USING_DECLs.
* decl.cc (poplevel): Still support -Wunused for using-decls.
(lookup_and_check_tag): Remove unnecessary strip_using_decl.
* parser.cc (cp_parser_template_name): Likewise.
(cp_parser_nonclass_name): Likewise.
(cp_parser_class_name): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/using29.C: Update errors.
* g++.dg/lookup/using53.C: Update errors, add XFAILs.
* g++.dg/modules/using-22_b.C: Remove xfails.
* g++.dg/warn/Wunused-var-18.C: Update error, add check.
* g++.dg/lookup/using68.C: New test.
* g++.dg/modules/using-24_a.C: New test.
* g++.dg/modules/using-24_b.C: New test.
* g++.dg/modules/using-25_a.C: New test.
* g++.dg/modules/using-25_b.C: New test.
* g++.dg/modules/using-enum-4_a.C: New test.
* g++.dg/modules/using-enum-4_b.C: New test.
* g++.dg/modules/using-enum-4_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|
|
I noticed there already exists a getter to get the scope of a lambda
from its type directly rather than needing to go via
CLASSTYPE_LAMBDA_EXPR, we may as well use it.
gcc/cp/ChangeLog:
* module.cc (trees_out::get_merge_kind): Use
LAMBDA_TYPE_EXTRA_SCOPE instead of LAMBDA_EXPR_EXTRA_SCOPE.
(trees_out::key_mergeable): Likewise.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
[PR115745]
This C++26 paper allows structured bindings declaration in
if/while/for/switch conditions, where the structured binding shouldn't
be initialized by array (so in the standard only non-union class types;
as extension _Complex will also work and vectors will be diagnosed because
of conversion issues) and the decision variable is the artificial variable
(e in the standard) itself contextually converted to bool or converted to
some integer/enumeration type.
The standard requires that the conversion is evaluated before the get calls
in case of std::tuple* using class, so the largest part of the patch is making
sure this can be done during instantiation without duplicating too much
code.
In cp_parser_condition, creating a TARGET_EXPR to hold temporarily the
bool or int/enum result of the conversion across the get calls is easy, it
could be just added in between cp_finish_decl and cp_finish_decomp, but for
pt.cc there was no easy spot to add that.
In the end, the patch uses DECL_DECOMP_BASE for this. That tree is used
primarily for the user vars or var proxies to point back at the
DECL_ARTIFICIAL e variable, before this patch it has been NULL_TREE on
the base. In some places code was checking if DECL_DECOMP_BASE is NULL_TREE
to find out if it is the base or user var/var proxy.
The patch introduces DECL_DECOMP_IS_BASE macro for what used to be
!DECL_DECOMP_BASE and can stick something else in the base's
DECL_DECOMP_BASE as long as it is not a VAR_DECL.
The patch uses integer_zero_node to mark if/while/for condition structured
binding, integer_one_node to mark switch condition structured binding and
finally cp_finish_decomp sets it to TARGET_EXPR if some get method calls are
emitted and from there the callers can pick that up. This way I also
avoided code duplication between !processing_template_decl parsing and
pt.cc.
2024-07-02 Jakub Jelinek <jakub@redhat.com>
PR c++/115745
gcc/cp/
* cp-tree.h: Implement C++26 P0963R3 - Structured binding declaration
as a condition.
(DECL_DECOMP_BASE): Adjust comment.
(DECL_DECOMP_IS_BASE): Define.
* parser.cc (cp_parser_selection_statement): Adjust
cp_parser_condition caller.
(cp_parser_condition): Add KEYWORD argument. Parse
C++26 structured bindings in conditions.
(cp_parser_c_for, cp_parser_iteration_statement): Adjust
cp_parser_condition callers.
(cp_parser_simple_declaration): Adjust
cp_parser_decomposition_declaration caller.
(cp_parser_decomposition_declaration): Add KEYWORD argument.
If it is not RID_MAX, diagnose for C++23 and older rather than C++14
and older. Set DECL_DECOMP_BASE to integer_zero_node for structured
bindings used in if/while/for conditions or integer_one_node for
those used in switch conditions.
* decl.cc (poplevel, check_array_initializer): Use DECL_DECOMP_IS_BASE
instead of !DECL_DECOMP_BASE.
(cp_finish_decomp): Diagnose array initializer for structured bindings
used in conditions. If using std::tuple_{size,element}, emit
conversion to bool or integer/enumeration of e into a TARGET_EXPR
before emitting get method calls.
* decl2.cc (mark_used): Use DECL_DECOMP_IS_BASE instead of
!DECL_DECOMP_BASE.
* module.cc (trees_in::tree_node): Likewise.
* typeck.cc (maybe_warn_about_returning_address_of_local): Likewise.
* semantics.cc (maybe_convert_cond): For structured bindings with
TARGET_EXPR DECL_DECOMP_BASE use that as condition.
(finish_switch_cond): Likewise.
gcc/testsuite/
* g++.dg/cpp1z/decomp16.C: Adjust expected diagnostics.
* g++.dg/cpp26/decomp3.C: New test.
* g++.dg/cpp26/decomp4.C: New test.
* g++.dg/cpp26/decomp5.C: New test.
* g++.dg/cpp26/decomp6.C: New test.
* g++.dg/cpp26/decomp7.C: New test.
* g++.dg/cpp26/decomp8.C: New test.
* g++.dg/cpp26/decomp9.C: New test.
* g++.dg/cpp26/decomp10.C: New test.
|
|
Adjusting the comment I added in r15-1223 to clarify that this is a
workaround for a bug elsewhere.
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_binding_entity): Adjust comment.
|
|
exception_ptr.h contains
namespace __exception_ptr
{
class exception_ptr;
}
using __exception_ptr::exception_ptr;
so when module std tries to 'export using std::exception_ptr', it names
another using-directive rather than the class directly, so __exception_ptr
is never explicitly opened in module purview.
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_binding_entity): Set
DECL_MODULE_PURVIEW_P instead of asserting.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-20_a.C: New test.
|
|
Within a source file, #include is translated to import if a suitable header
unit is available, but this wasn't working with -include. This turned out
to be because we suppressed the translation before the beginning of the
main file. After removing that, I had to tweak libcpp file handling to
accommodate the way it moves from an -include to the main file.
gcc/ChangeLog:
* doc/invoke.texi (C++ Modules): Mention -include.
gcc/cp/ChangeLog:
* module.cc (maybe_translate_include): Allow before the main file.
libcpp/ChangeLog:
* files.cc (_cpp_stack_file): LC_ENTER for -include header unit.
gcc/testsuite/ChangeLog:
* g++.dg/modules/dashinclude-1_b.C: New test.
* g++.dg/modules/dashinclude-1_a.H: New test.
|
|
This patch fixes a couple issues with the current handling of revealing
declarations with using-decls.
Firstly, doing 'remove_node' when handling function overload sets is not
safe, because it not only mutates the OVERLOAD we're walking over but
potentially any other references to this OVERLOAD that are cached from
phase-1 template lookup. This causes the attached using-17 testcase to
fail because the overload set in 'X::test()' no longer contains the
'ns::f(T)' template once instantiated at the end of the file.
This patch works around this by simply not removing the old declaration.
This does make the overload list potentially longer than it otherwise
would have been, but only when re-exporting the same set of functions in
a using-decl. Additionally, because 'ovl_insert' always prepends these
newly inserted overloads, repeated exported using-decls won't continue
to add declarations, as the first exported using-decl will be found
before the original (unexported) declaration.
Another, related, issue is that using-decls of GMF entities currently
doesn't mark them as reachable unless they are also exported, and thus
they may not be available in e.g. module implementation units. We solve
this with a new flag on OVERLOADs set when they are declared within the
module purview. This starts to run into the more general issue of
handling using-decls of non-functions (see e.g. PR114863) but by just
marking such GMF entities as purview we can work around this for now.
This also allows us to get rid of the special-casing of exported
using-decls in 'add_binding_entity', which was incorrect anyway: a
non-exported using-decl still needs to be emitted anyway if it lives in
the module purview, even if referring to a non-purview item.
PR c++/114867
gcc/cp/ChangeLog:
* cp-tree.h (OVL_PURVIEW_P): New.
(ovl_iterator::purview_p): New.
* module.cc (depset::hash::add_binding_entity): Only ignore
entities not within module purview. Set OVL_PURVIEW_P on new
OVERLOADs for emitted declarations.
(module_state::read_cluster): Imported using-decls are always
in purview, mark as OVL_PURVIEW_P.
* name-lookup.h (enum WMB_Flags): New WMB_Purview flag.
* name-lookup.cc (walk_module_binding): Set WMB_Purview as
needed.
(do_nonmember_using_decl): Don't remove from existing OVERLOADs.
Also reveal non-exported decls. Also reveal 'extern "C"' decls.
Add workaround to reveal non-function decls.
* tree.cc (ovl_insert): Adjust to also set OVL_PURVIEW_P when
needed.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-17_a.C: New test.
* g++.dg/modules/using-17_b.C: New test.
* g++.dg/modules/using-18_a.C: New test.
* g++.dg/modules/using-18_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
If a user mistakenly includes a standard library header within the
module purview, they currently get a confusing "declaration conflicts
with builtin" error. This patch updates the message to include "in
module", to help guide the user towards the likely cause.
PR c++/102345
gcc/cp/ChangeLog:
* module.cc (module_may_redeclare): Update error message.
gcc/testsuite/ChangeLog:
* g++.dg/modules/enum-12.C: Test for updated error.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
This appears to be an oversight in the definition of module_has_cmi_p.
This change will allow us to use the function directly in more places
that need to additional work only if generating a module CMI in the
future, allowing us to do additional work only when we know we need it.
gcc/cp/ChangeLog:
* cp-tree.h (module_has_cmi_p): Also include header units.
(module_maybe_has_cmi_p): Update comment.
* module.cc (set_defining_module): Only need to track
declarations for later exporting if the module may have a CMI.
(set_defining_module_for_partial_spec): Likewise.
* name-lookup.cc (pushdecl): Likewise.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
Constrained partial specialisations aren't all necessarily tracked on
the instantiation table. The modules code uses a separate
'partial_specializations' table to track them instead to ensure that
they get walked and emitted when emitting a module, but currently this
does not always happen.
The attached testcase fails in two ways. First, because the partial
specialisation is just a declaration (and not a definition),
'set_defining_module' never ends up getting called on it and so it never
gets added to the partial specialisation table. We fix this by ensuring
that when partial specializations are created they always get added, and
so we never miss one. To prevent adding partial specialisations multiple
times we split this out as a new function.
The second way it fails is that when exporting the primary interface for
a module with partitions, we also re-walk the specializations of all
imported partitions to merge them into a single BMI. So this patch
ensures that after calling 'match_mergeable_specialization' we also
ensure that if the name came from a partition it gets added to the
specialization table so that a dependency is correctly created for it.
PR c++/114947
gcc/cp/ChangeLog:
* cp-tree.h (set_defining_module_for_partial_spec): Declare.
* module.cc (trees_in::decl_value): Track partial specs coming
from partitions.
(set_defining_module): Don't track partial specialisations here
anymore.
(set_defining_module_for_partial_spec): New function.
* pt.cc (process_partial_specialization): Call it.
gcc/testsuite/ChangeLog:
* g++.dg/modules/partial-4_a.C: New test.
* g++.dg/modules/partial-4_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
I got notified by Linaro CI and by checking testresults that there seems
to be some occasional failures in tpl-friend-4_b.C on some architectures
and standards modes since r15-59-gb5f6a56940e708. I haven't been able
to reproduce but looking at the backtrace I suspect the issue is that
we're adding to the 'imported_temploid_friend' map a decl that is
ultimately discarded, which then has its address reused by a later decl
causing a failure in the assert in 'set_originating_module'.
This patch fixes the problem by ensuring 'imported_temploid_friends' is
correctly marked as a GTY root, and that 'duplicate_decls' properly
removes entries from the map for declarations that it frees.
PR c++/114275
gcc/cp/ChangeLog:
* cp-tree.h (remove_defining_module): Declare.
* decl.cc (duplicate_decls): Call remove_defining_module on
to-be-freed newdecl.
* module.cc (imported_temploid_friends): Mark as GTY root...
(init_modules): ...and allocate from ggc.
(trees_in::decl_value): Only track for declarations that won't
be discarded.
(remove_defining_module): New function.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
The change in r14-8408 to also emit partial specializations in the
global module fragment caused the regression in the linked PR; this
patch fixes this by restricting emitted GM partial specializations to
those that are actually used.
PR c++/114630
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_partial_entities): Mark GM
specializations as unreached.
(depset::hash::find_dependencies): Also reach entities in the
DECL_TEMPLATE_SPECIALIZATIONS list.
gcc/testsuite/ChangeLog:
* g++.dg/modules/partial-3.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
This patch implements the changes described in
https://github.com/itanium-cxx-abi/cxx-abi/pull/171.
One restriction that is lifted in the ABI that hasn't been updated here
is that the ABI no longer requires unique vtables to be emitted with
vague linkage. I haven't changed this behaviour for this patch, but in
the future we could look into changing the relevant target hook
('class_data_always_comdat') to default to 'false'. But the current
behaviour is more forgiving to changes in key function identification.
Since the ABI for vtables attached to named modules no longer depends on
key methods, this also resolves the issue described in PR c++/105224.
PR c++/105224
gcc/cp/ChangeLog:
* class.cc (finish_struct_1): Also push classes attached to a
module into the 'keyed_classes' list.
* decl.cc (record_key_method_defined): Don't push classes
attached to a named module into the 'keyed_classes' list.
* module.cc (trees_in::read_class_def): Likewise.
* decl2.cc (import_export_class): Uniquely emit vtables for
non-template classes attached to a named module.
(vtables_uniquely_emitted): New function.
(import_export_decl): Update comments. Update with knowledge
about new kinds of uniquely emitted vtables.
gcc/testsuite/ChangeLog:
* g++.dg/modules/virt-2_a.C: Update linkage requirements.
* g++.dg/modules/virt-2_b.C: Likewise.
* g++.dg/modules/virt-2_c.C: Likewise.
* g++.dg/modules/virt-4_a.C: New test.
* g++.dg/modules/virt-4_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
|