diff mbox series

[RFC/PATCH] Use unique_ptr in more places in pretty_printer/diagnostics [PR116613]

Message ID 20241014231846.465392-1-dmalcolm@redhat.com
State New
Headers show
Series [RFC/PATCH] Use unique_ptr in more places in pretty_printer/diagnostics [PR116613] | expand

Commit Message

David Malcolm Oct. 14, 2024, 11:18 p.m. UTC
My forthcoming patches for PR other/116613 (for supporting multiple
diagnostic outputs at once) make much more use of cloning of
pretty_printer than before.

Hence it makes sense to have a preliminary patch in which the result of
pretty_printer::clone becomes a std::unique_ptr, rather than add more
manual uses of "delete" on plain "pretty_printer *".

On doing so, I noticed various other places where naked new/delete is
used for run-time configuration of diagnostics:
* the output format (text vs SARIF)
* client data hooks
* the option manager
* the URLifier

Hence this patch also makes use of std::unique_ptr and ::make_unique for
managing such client policy classes.

Unfortunately we can't directly include <memory> in our internal headers
but instead any of our TUs that make use of std::unique_ptr must #define
INCLUDE_MEMORY before including system.h.

Hence the bulk of this patch is taken up with adding a define of
INCLUDE_MEMORY to hundreds of source files: everything that includes
diagnostic.h or pretty-print.h (and thus anything transitively such as
includers of lto-wrapper.h, c-tree.h, cp-tree.h and rtl-ssa.h).

However, it's really ugly, and I'd much rather simply edit system.h
so that <memory> is always included.  Would that simpler approach be
acceptable?  I'd like to use std::unique_ptr in more places, such as
when creating passes, so I think the number of places we'd need
INCLUDE_MEMORY is likely to eventually be most of the TUs in the
compiler.

I've successfully built stage 1 on all configurations with this patch
*without* Modula 2.

Unfortuately, for Modula 2 there are numerous generated sources, many
of which start with:

  #include "config.h"
  #include "system.h"
  #include "gcc-consolidation.h"

I've tried fixing this by adding:

	print (p, '#define INCLUDE_MEMORY\n');

to gcc/m2/mc/keyc.mod, but my various attempts to regenerate the
Modula 2 sources keep failing; sorry.

So I'm hoping that either Gaius can help me here with regenerating
the Modula 2 sources, or the "always include <memory> from system.h"
approach is acceptable/preferable.

Thoughts?

gcc/ada/ChangeLog:
	PR other/116613
	* gcc-interface/misc.cc: Add #define INCLUDE_MEMORY
	* gcc-interface/trans.cc: Likewise.
	* gcc-interface/utils.cc: Likewise.

gcc/analyzer/ChangeLog:
	PR other/116613
	* analyzer-logging.cc: Add #define INCLUDE_MEMORY
	(logger::logger): Update for m_pp becoming a unique_ptr.
	(logger::~logger): Likewise.
	(logger::log_va_partial): Likewise.
	(logger::end_log_line): Likewise.
	* analyzer-logging.h (logger::get_printer): Likewise.
	(logger::m_pp): Convert to a unique_ptr.
	* analyzer.cc (make_label_text): Use
	diagnostic_context::clone_printer and use unique_ptr.
	(make_label_text_n): Likewise.
	* bar-chart.cc: Add #define INCLUDE_MEMORY
	* pending-diagnostic.cc (evdesc::event_desc::formatted_print):
	Use diagnostic_context::clone_printer and use unique_ptr.
	* sm-malloc.cc (sufficiently_similar_p): Likewise.
	* supergraph.cc (supergraph::dump_dot_to_file): Likewise.

gcc/c-family/ChangeLog:
	PR other/116613
	* c-ada-spec.cc: Add #define INCLUDE_MEMORY.
	* c-attribs.cc: Likewise.
	* c-common.cc: Likewise.
	* c-format.cc: Likewise.
	* c-gimplify.cc: Likewise.
	* c-indentation.cc: Likewise.
	* c-opts.cc: Likewise.
	* c-pch.cc: Likewise.
	* c-pragma.cc: Likewise.
	* c-pretty-print.cc: Likewise.  Add #include "make-unique.h".
	(c_pretty_printer::clone): Use std::unique_ptr and ::make_unique.
	* c-pretty-print.h (c_pretty_printer::clone): Use std::unique_ptr.
	* c-type-mismatch.cc: Add #define INCLUDE_MEMORY.
	* c-warn.cc: Likewise.

gcc/c/ChangeLog:
	PR other/116613
	* c-aux-info.cc: Add #define INCLUDE_MEMORY.
	* c-convert.cc: Likewise.
	* c-errors.cc: Likewise.
	* c-fold.cc: Likewise.
	* c-lang.cc: Likewise.
	* c-objc-common.cc: Likewise.
	(pp_markup::element_quoted_type::print_type): Use unique_ptr.
	* c-typeck.cc: Add #define INCLUDE_MEMORY.
	* gimple-parser.cc: Likewise.

gcc/cp/ChangeLog:
	PR other/116613
	* call.cc: Add #define INCLUDE_MEMORY.
	* class.cc: Likewise.
	* constexpr.cc: Likewise.
	* constraint.cc: Likewise.
	* contracts.cc: Likewise.
	* coroutines.cc: Likewise.
	* cp-gimplify.cc: Likewise.
	* cp-lang.cc: Likewise.
	* cp-objcp-common.cc: Likewise.
	* cp-ubsan.cc: Likewise.
	* cvt.cc: Likewise.
	* cxx-pretty-print.cc: Likewise.  Add #include "cp-tree.h".
	(cxx_pretty_printer::clone): Use std::unique_ptr and
	::make_unique.
	* cxx-pretty-print.h (cxx_pretty_printer::clone): Use
	std::unique_ptr.
	* decl2.cc: Add #define INCLUDE_MEMORY.
	* dump.cc: Likewise.
	* except.cc: Likewise.
	* expr.cc: Likewise.
	* friend.cc: Likewise.
	* init.cc: Likewise.
	* lambda.cc: Likewise.
	* logic.cc: Likewise.
	* mangle.cc: Likewise.
	* method.cc: Likewise.
	* optimize.cc: Likewise.
	* pt.cc: Likewise.
	* ptree.cc: Likewise.
	* rtti.cc: Likewise.
	* search.cc: Likewise.
	* semantics.cc: Likewise.
	* tree.cc: Likewise.
	* typeck.cc: Likewise.
	* typeck2.cc: Likewise.
	* vtable-class-hierarchy.cc: Likewise.

gcc/d/ChangeLog:
	PR other/116613
	* d-attribs.cc: Add #define INCLUDE_MEMORY.
	* d-builtins.cc: Likewise.
	* d-codegen.cc: Likewise.
	* d-convert.cc: Likewise.
	* d-diagnostic.cc: Likewise.
	* d-frontend.cc: Likewise.
	* d-lang.cc: Likewise.
	* d-longdouble.cc: Likewise.
	* d-target.cc: Likewise.
	* decl.cc: Likewise.
	* expr.cc: Likewise.
	* intrinsics.cc: Likewise.
	* modules.cc: Likewise.
	* toir.cc: Likewise.
	* typeinfo.cc: Likewise.
	* types.cc: Likewise.

gcc/fortran/ChangeLog:
	PR other/116613
	* arith.cc: Add #define INCLUDE_MEMORY.
	* array.cc: Likewise.
	* bbt.cc: Likewise.
	* check.cc: Likewise.
	* class.cc: Likewise.
	* constructor.cc: Likewise.
	* convert.cc: Likewise.
	* cpp.cc: Likewise.
	* data.cc: Likewise.
	* decl.cc: Likewise.
	* dependency.cc: Likewise.
	* dump-parse-tree.cc: Likewise.
	* error.cc: Likewise.
	* expr.cc: Likewise.
	* f95-lang.cc: Likewise.
	* frontend-passes.cc: Likewise.
	* interface.cc: Likewise.
	* intrinsic.cc: Likewise.
	* io.cc: Likewise.
	* iresolve.cc: Likewise.
	* match.cc: Likewise.
	* matchexp.cc: Likewise.
	* misc.cc: Likewise.
	* module.cc: Likewise.
	* openmp.cc: Likewise.
	* options.cc: Likewise.
	* parse.cc: Likewise.
	* primary.cc: Likewise.
	* resolve.cc: Likewise.
	* scanner.cc: Likewise.
	* simplify.cc: Likewise.
	* st.cc: Likewise.
	* symbol.cc: Likewise.
	* target-memory.cc: Likewise.
	* trans-array.cc: Likewise.
	* trans-common.cc: Likewise.
	* trans-const.cc: Likewise.
	* trans-decl.cc: Likewise.
	* trans-expr.cc: Likewise.
	* trans-intrinsic.cc: Likewise.
	* trans-io.cc: Likewise.
	* trans-openmp.cc: Likewise.
	* trans-stmt.cc: Likewise.
	* trans-types.cc: Likewise.
	* trans.cc: Likewise.

gcc/go/ChangeLog:
	PR other/116613
	* go-backend.cc: Add #define INCLUDE_MEMORY.
	* go-lang.cc: Likewise.

gcc/jit/ChangeLog:
	PR other/116613
	* dummy-frontend.cc: Add #define INCLUDE_MEMORY.
	* jit-playback.cc: Likewise.
	* jit-recording.cc: Likewise.

gcc/lto/ChangeLog:
	PR other/116613
	* lto-common.cc: Add #define INCLUDE_MEMORY.
	* lto-dump.cc: Likewise.
	* lto-partition.cc: Likewise.
	* lto-symtab.cc: Likewise.
	* lto.cc: Likewise.

gcc/m2/ChangeLog:
	PR other/116613
	* gm2-gcc/gcc-consolidation.h: Add #define INCLUDE_MEMORY.
	* gm2-gcc/m2configure.cc: Likewise.

gcc/objc/ChangeLog:
	PR other/116613
	* objc-act.cc: Add #define INCLUDE_MEMORY.
	* objc-encoding.cc: Likewise.
	* objc-gnu-runtime-abi-01.cc: Likewise.
	* objc-lang.cc: Likewise.
	* objc-next-runtime-abi-01.cc: Likewise.
	* objc-next-runtime-abi-02.cc: Likewise.
	* objc-runtime-shared-support.cc: Likewise.

gcc/objcp/ChangeLog:: Add #define INCLUDE_MEMORY.
	PR other/116613
	* objcp-decl.cc
	* objcp-lang.cc: Likewise.

gcc/rust/ChangeLog:
	PR other/116613
	* resolve/rust-ast-resolve-expr.cc: Add #define INCLUDE_MEMORY.
	* rust-attribs.cc: Likewise.
	* rust-system.h: Likewise.

gcc/ChangeLog:
	PR other/116613
	* asan.cc: Add #define INCLUDE_MEMORY.
	* attribs.cc: Likewise.
	(attr_access::array_as_string): Use
	diagnostic_context::clone_printer and use unique_ptr.
	* auto-profile.cc: Add #define INCLUDE_MEMORY.
	* calls.cc: Likewise.
	* cfganal.cc: Likewise.
	* cfgexpand.cc: Likewise.
	* cfghooks.cc: Likewise.
	* cfgloop.cc: Likewise.
	* cgraph.cc: Likewise.
	* cgraphclones.cc: Likewise.
	* cgraphunit.cc: Likewise.
	* collect-utils.cc: Likewise.
	* collect2.cc: Likewise.
	* common/config/aarch64/aarch64-common.cc: Likewise.
	* common/config/arm/arm-common.cc: Likewise.
	* common/config/avr/avr-common.cc: Likewise.
	* config/aarch64/aarch64-cc-fusion.cc: Likewise.
	* config/aarch64/aarch64-early-ra.cc: Likewise.
	* config/aarch64/aarch64-sve-builtins.cc: Likewise.
	* config/arc/arc.cc: Likewise.
	* config/arm/aarch-common.cc: Likewise.
	* config/arm/arm-mve-builtins.cc: Likewise.
	* config/avr/avr-devices.cc: Likewise.
	* config/avr/driver-avr.cc: Likewise.
	* config/bpf/bpf.cc: Likewise.
	* config/bpf/btfext-out.cc: Likewise.
	* config/bpf/core-builtins.cc: Likewise.
	* config/darwin.cc: Likewise.
	* config/i386/driver-i386.cc: Likewise.
	* config/i386/i386-builtins.cc: Likewise.
	* config/i386/i386-expand.cc: Likewise.
	* config/i386/i386-features.cc: Likewise.
	* config/i386/i386-options.cc: Likewise.
	* config/loongarch/loongarch-builtins.cc: Likewise.
	* config/mingw/winnt-cxx.cc: Likewise.
	* config/mingw/winnt.cc: Likewise.
	* config/mips/mips.cc: Likewise.
	* config/msp430/driver-msp430.cc: Likewise.
	* config/nvptx/mkoffload.cc: Likewise.
	* config/nvptx/nvptx.cc: Likewise.
	* config/riscv/riscv-avlprop.cc: Likewise.
	* config/riscv/riscv-vector-builtins.cc: Likewise.
	* config/riscv/riscv-vsetvl.cc: Likewise.
	* config/rs6000/driver-rs6000.cc: Likewise.
	* config/rs6000/host-darwin.cc: Likewise.
	* config/rs6000/rs6000-c.cc: Likewise.
	* config/s390/s390-c.cc: Likewise.
	* config/s390/s390.cc: Likewise.
	* config/sol2-cxx.cc: Likewise.
	* config/vms/vms-c.cc: Likewise.
	* config/xtensa/xtensa-dynconfig.cc: Likewise.
	* coroutine-passes.cc: Likewise.
	* coverage.cc: Likewise.
	* data-streamer-in.cc: Likewise.
	* data-streamer-out.cc: Likewise.
	* data-streamer.cc: Likewise.
	* diagnostic-client-data-hooks.h (make_compiler_data_hooks): Use
	std::unique_ptr for return type.
	* diagnostic-format-json.cc (diagnostic_output_format_init_json):
	Update for usage of std::unique_ptr in set_output_format.
	* diagnostic-format-sarif.cc
	(diagnostic_output_format_init_sarif): Likewise.
	(test_message_with_embedded_link): Likewise for set_urlifier.
	* diagnostic-format-text.cc: Add #define INCLUDE_MEMORY.
	* diagnostic-global-context.cc: Likewise.
	* diagnostic-macro-unwinding.cc: Likewise.
	* diagnostic-show-locus.cc: Likewise.
	* diagnostic-spec.cc: Likewise.
	* diagnostic.cc (diagnostic_context::set_output_format): Use
	std::unique_ptr for input.
	(diagnostic_context::set_client_data_hooks): Likewise.
	(diagnostic_context::set_option_manager): Likewise.
	(diagnostic_context::set_urlifier): Likewise.
	* diagnostic.h: Complain if INCLUDE_MEMORY was not defined.
	(diagnostic_context::set_output_format): Use std::unique_ptr for
	input.
	(diagnostic_context::set_client_data_hooks): Likewise.
	(diagnostic_context::set_option_manager): Likewise.
	(diagnostic_context::set_urlifier): Likewise.
	(diagnostic_context::clone_printer): New.
	(diagnostic_context::m_printer): Update comment.
	(diagnostic_context::m_option_mgr): Likewise.
	(diagnostic_context::m_urlifier): Likewise.
	(diagnostic_context::m_edit_context_ptr): Likewise.
	(diagnostic_context::m_output_format): Likewise.
	(diagnostic_context::m_client_data_hooks): Likewise.
	(diagnostic_context::m_theme): Likewise.
	* digraph.cc: Add #define INCLUDE_MEMORY.
	* dwarf2out.cc: Likewise.
	* edit-context.cc: Likewise.
	* except.cc: Likewise.
	* expr.cc: Likewise.
	* file-prefix-map.cc: Likewise.
	* final.cc: Likewise.
	* fwprop.cc: Likewise.
	* gcc-rich-location.cc: Likewise.
	* gcc-urlifier.cc: Likewise.  Add #include "make-unique.h".
	(make_gcc_urlifier): Use std::unique_ptr and ::make_unique.
	* gcc-urlifier.h (make_gcc_urlifier): Use std::unique_ptr.
	* gcc.cc: Add #define INCLUDE_MEMORY.  Include
	"pretty-print-urlifier.h".
	* gcov-dump.cc: Add #define INCLUDE_MEMORY.
	* gcov-tool.cc: Likewise.
	* gengtype.cc (open_base_files): Likewise to output.
	* gimple-fold.cc: Likewise.
	* gimple-harden-conditionals.cc: Likewise.
	* gimple-harden-control-flow.cc: Likewise.
	* gimple-if-to-switch.cc: Likewise.
	* gimple-lower-bitint.cc: Likewise.
	* gimple-predicate-analysis.cc: Likewise.
	* gimple-pretty-print.cc: Likewise.
	* gimple-range-cache.cc: Likewise.
	* gimple-range-edge.cc: Likewise.
	* gimple-range-fold.cc: Likewise.
	* gimple-range-gori.cc: Likewise.
	* gimple-range-infer.cc: Likewise.
	* gimple-range-op.cc: Likewise.
	* gimple-range-path.cc: Likewise.
	* gimple-range-phi.cc: Likewise.
	* gimple-range-trace.cc: Likewise.
	* gimple-range.cc: Likewise.
	* gimple-ssa-backprop.cc: Likewise.
	* gimple-ssa-sprintf.cc: Likewise.
	* gimple-ssa-store-merging.cc: Likewise.
	* gimple-ssa-strength-reduction.cc: Likewise.
	* gimple-ssa-warn-access.cc: Likewise.
	* gimple-ssa-warn-alloca.cc: Likewise.
	* gimple-ssa-warn-restrict.cc: Likewise.
	* gimple-streamer-in.cc: Likewise.
	* gimple-streamer-out.cc: Likewise.
	* gimple.cc: Likewise.
	* gimplify.cc: Likewise.
	* graph.cc: Likewise.
	* graphviz.cc: Likewise.
	* input.cc: Likewise.
	* ipa-cp.cc: Likewise.
	* ipa-devirt.cc: Likewise.
	* ipa-fnsummary.cc: Likewise.
	* ipa-free-lang-data.cc: Likewise.
	* ipa-icf-gimple.cc: Likewise.
	* ipa-icf.cc: Likewise.
	* ipa-inline-analysis.cc: Likewise.
	* ipa-inline.cc: Likewise.
	* ipa-modref-tree.cc: Likewise.
	* ipa-modref.cc: Likewise.
	* ipa-param-manipulation.cc: Likewise.
	* ipa-polymorphic-call.cc: Likewise.
	* ipa-predicate.cc: Likewise.
	* ipa-profile.cc: Likewise.
	* ipa-prop.cc: Likewise.
	* ipa-pure-const.cc: Likewise.
	* ipa-reference.cc: Likewise.
	* ipa-split.cc: Likewise.
	* ipa-sra.cc: Likewise.
	* ipa-strub.cc: Likewise.
	* ipa-utils.cc: Likewise.
	* langhooks.cc: Likewise.
	* late-combine.cc: Likewise.
	* lto-cgraph.cc: Likewise.
	* lto-compress.cc: Likewise.
	* lto-opts.cc: Likewise.
	* lto-section-in.cc: Likewise.
	* lto-section-out.cc: Likewise.
	* lto-streamer-in.cc: Likewise.
	* lto-streamer-out.cc: Likewise.
	* lto-streamer.cc: Likewise.
	* lto-wrapper.cc: Likewise.  Include "make-unique.h".
	(main): Use ::make_unique when creating option manager.
	* multiple_target.cc: Likewise.
	* omp-expand.cc: Likewise.
	* omp-general.cc: Likewise.
	* omp-low.cc: Likewise.
	* omp-oacc-neuter-broadcast.cc: Likewise.
	* omp-offload.cc: Likewise.
	* omp-simd-clone.cc: Likewise.
	* optc-gen.awk: Likewise in output.
	* optc-save-gen.awk: Likewise in output.
	* options-urls-cc-gen.awk: Likewise in output.
	* opts-common.cc: Likewise.
	* opts-global.cc: Likewise.
	* opts.cc: Likewise.
	* pair-fusion.cc: Likewise.
	* passes.cc: Likewise.
	* pointer-query.cc: Likewise.
	* predict.cc: Likewise.
	* pretty-print.cc (pretty_printer::clone): Use std::unique_ptr and
	::make_unique.
	* pretty-print.h: Complain if INCLUDE_MEMORY is not defined.
	(pretty_printer::clone): Use std::unique_ptr.
	* print-rtl.cc: Add #define INCLUDE_MEMORY.
	* print-tree.cc: Likewise.
	* profile-count.cc: Likewise.
	* range-op-float.cc: Likewise.
	* range-op-ptr.cc: Likewise.
	* range-op.cc: Likewise.
	* range.cc: Likewise.
	* read-rtl-function.cc: Likewise.
	* rtl-error.cc: Likewise.
	* rtl-ssa/accesses.cc: Likewise.
	* rtl-ssa/blocks.cc: Likewise.
	* rtl-ssa/changes.cc: Likewise.
	* rtl-ssa/functions.cc: Likewise.
	* rtl-ssa/insns.cc: Likewise.
	* rtl-ssa/movement.cc: Likewise.
	* rtl-tests.cc: Likewise.
	* sanopt.cc: Likewise.
	* sched-rgn.cc: Likewise.
	* selftest-diagnostic-path.cc: Likewise.
	* selftest-diagnostic.cc: Likewise.
	* splay-tree-utils.cc: Likewise.
	* sreal.cc: Likewise.
	* stmt.cc: Likewise.
	* substring-locations.cc: Likewise.
	* symtab-clones.cc: Likewise.
	* symtab-thunks.cc: Likewise.
	* symtab.cc: Likewise.
	* text-art/box-drawing.cc: Likewise.
	* text-art/canvas.cc: Likewise.
	* text-art/ruler.cc: Likewise.
	* text-art/selftests.cc: Likewise.
	* text-art/theme.cc: Likewise.
	* toplev.cc: Likewise.  Include "make-unique.h".
	(general_init): Use ::make_unique when setting option_manager.
	* trans-mem.cc: Add #define INCLUDE_MEMORY.
	* tree-affine.cc: Likewise.
	* tree-call-cdce.cc: Likewise.
	* tree-cfg.cc: Likewise.
	* tree-chrec.cc: Likewise.
	* tree-dfa.cc: Likewise.
	* tree-diagnostic-client-data-hooks.cc: Include "make-unique.h".
	(make_compiler_data_hooks): Use std::unique_ptr and ::make_unique.
	* tree-diagnostic.cc: Add #define INCLUDE_MEMORY.
	* tree-dump.cc: Likewise.
	* tree-inline.cc: Likewise.
	* tree-into-ssa.cc: Likewise.
	* tree-logical-location.cc: Likewise.
	* tree-nested.cc: Likewise.
	* tree-nrv.cc: Likewise.
	* tree-object-size.cc: Likewise.
	* tree-outof-ssa.cc: Likewise.
	* tree-pretty-print.cc: Likewise.
	* tree-profile.cc: Likewise.
	* tree-scalar-evolution.cc: Likewise.
	* tree-sra.cc: Likewise.
	* tree-ssa-address.cc: Likewise.
	* tree-ssa-alias.cc: Likewise.
	* tree-ssa-ccp.cc: Likewise.
	* tree-ssa-coalesce.cc: Likewise.
	* tree-ssa-copy.cc: Likewise.
	* tree-ssa-dce.cc: Likewise.
	* tree-ssa-dom.cc: Likewise.
	* tree-ssa-forwprop.cc: Likewise.
	* tree-ssa-ifcombine.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* tree-ssa-loop-im.cc: Likewise.
	* tree-ssa-loop-manip.cc: Likewise.
	* tree-ssa-loop-niter.cc: Likewise.
	* tree-ssa-loop-split.cc: Likewise.
	* tree-ssa-math-opts.cc: Likewise.
	* tree-ssa-operands.cc: Likewise.
	* tree-ssa-phiprop.cc: Likewise.
	* tree-ssa-pre.cc: Likewise.
	* tree-ssa-propagate.cc: Likewise.
	* tree-ssa-reassoc.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.
	* tree-ssa-scopedtables.cc: Likewise.
	* tree-ssa-sink.cc: Likewise.
	* tree-ssa-strlen.cc: Likewise.
	* tree-ssa-structalias.cc: Likewise.
	* tree-ssa-ter.cc: Likewise.
	* tree-ssa-uninit.cc: Likewise.
	* tree-ssa.cc: Likewise.
	* tree-ssanames.cc: Likewise.
	* tree-stdarg.cc: Likewise.
	* tree-streamer-in.cc: Likewise.
	* tree-streamer-out.cc: Likewise.
	* tree-streamer.cc: Likewise.
	* tree-switch-conversion.cc: Likewise.
	* tree-tailcall.cc: Likewise.
	* tree-vrp.cc: Likewise.
	* tree.cc: Likewise.
	* ubsan.cc: Likewise.
	* value-pointer-equiv.cc: Likewise.
	* value-prof.cc: Likewise.
	* value-query.cc: Likewise.
	* value-range-pretty-print.cc: Likewise.
	* value-range-storage.cc: Likewise.
	* value-range.cc: Likewise.
	* value-relation.cc: Likewise.
	* var-tracking.cc: Likewise.
	* varpool.cc: Likewise.
	* vr-values.cc: Likewise.
	* wide-int-print.cc: Likewise.

libgcc/ChangeLog:
	PR other/116613
	* libgcov-util.c: Add #define INCLUDE_MEMORY.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/ada/gcc-interface/misc.cc               |  1 +
 gcc/ada/gcc-interface/trans.cc              |  1 +
 gcc/ada/gcc-interface/utils.cc              |  1 +
 gcc/analyzer/analyzer-logging.cc            | 16 +++----
 gcc/analyzer/analyzer-logging.h             |  4 +-
 gcc/analyzer/analyzer.cc                    | 27 ++++++-----
 gcc/analyzer/bar-chart.cc                   |  1 +
 gcc/analyzer/pending-diagnostic.cc          | 12 ++---
 gcc/analyzer/sm-malloc.cc                   | 13 +++---
 gcc/analyzer/supergraph.cc                  | 11 ++---
 gcc/asan.cc                                 |  1 +
 gcc/attribs.cc                              |  8 ++--
 gcc/auto-profile.cc                         |  1 +
 gcc/c-family/c-ada-spec.cc                  |  1 +
 gcc/c-family/c-attribs.cc                   |  1 +
 gcc/c-family/c-common.cc                    |  1 +
 gcc/c-family/c-format.cc                    |  1 +
 gcc/c-family/c-gimplify.cc                  |  1 +
 gcc/c-family/c-indentation.cc               |  1 +
 gcc/c-family/c-opts.cc                      |  1 +
 gcc/c-family/c-pch.cc                       |  1 +
 gcc/c-family/c-pragma.cc                    |  1 +
 gcc/c-family/c-pretty-print.cc              |  6 ++-
 gcc/c-family/c-pretty-print.h               |  2 +-
 gcc/c-family/c-type-mismatch.cc             |  1 +
 gcc/c-family/c-warn.cc                      |  1 +
 gcc/c/c-aux-info.cc                         |  1 +
 gcc/c/c-convert.cc                          |  1 +
 gcc/c/c-errors.cc                           |  1 +
 gcc/c/c-fold.cc                             |  1 +
 gcc/c/c-lang.cc                             |  1 +
 gcc/c/c-objc-common.cc                      |  5 +-
 gcc/c/c-typeck.cc                           |  1 +
 gcc/c/gimple-parser.cc                      |  1 +
 gcc/calls.cc                                |  1 +
 gcc/cfganal.cc                              |  1 +
 gcc/cfgexpand.cc                            |  1 +
 gcc/cfghooks.cc                             |  1 +
 gcc/cfgloop.cc                              |  1 +
 gcc/cgraph.cc                               |  1 +
 gcc/cgraphclones.cc                         |  1 +
 gcc/cgraphunit.cc                           |  1 +
 gcc/collect-utils.cc                        |  1 +
 gcc/collect2.cc                             |  1 +
 gcc/common/config/aarch64/aarch64-common.cc |  1 +
 gcc/common/config/arm/arm-common.cc         |  1 +
 gcc/common/config/avr/avr-common.cc         |  1 +
 gcc/config/aarch64/aarch64-cc-fusion.cc     |  1 +
 gcc/config/aarch64/aarch64-early-ra.cc      |  1 +
 gcc/config/aarch64/aarch64-sve-builtins.cc  |  1 +
 gcc/config/arc/arc.cc                       |  1 +
 gcc/config/arm/aarch-common.cc              |  1 +
 gcc/config/arm/arm-mve-builtins.cc          |  1 +
 gcc/config/avr/avr-devices.cc               |  1 +
 gcc/config/avr/driver-avr.cc                |  1 +
 gcc/config/bpf/bpf.cc                       |  1 +
 gcc/config/bpf/btfext-out.cc                |  1 +
 gcc/config/bpf/core-builtins.cc             |  1 +
 gcc/config/darwin.cc                        |  1 +
 gcc/config/i386/driver-i386.cc              |  1 +
 gcc/config/i386/i386-builtins.cc            |  1 +
 gcc/config/i386/i386-expand.cc              |  1 +
 gcc/config/i386/i386-features.cc            |  1 +
 gcc/config/i386/i386-options.cc             |  1 +
 gcc/config/loongarch/loongarch-builtins.cc  |  1 +
 gcc/config/mingw/winnt-cxx.cc               |  1 +
 gcc/config/mingw/winnt.cc                   |  1 +
 gcc/config/mips/mips.cc                     |  1 +
 gcc/config/msp430/driver-msp430.cc          |  1 +
 gcc/config/nvptx/mkoffload.cc               |  1 +
 gcc/config/nvptx/nvptx.cc                   |  1 +
 gcc/config/riscv/riscv-avlprop.cc           |  1 +
 gcc/config/riscv/riscv-vector-builtins.cc   |  1 +
 gcc/config/riscv/riscv-vsetvl.cc            |  1 +
 gcc/config/rs6000/driver-rs6000.cc          |  1 +
 gcc/config/rs6000/host-darwin.cc            |  1 +
 gcc/config/rs6000/rs6000-c.cc               |  1 +
 gcc/config/s390/s390-c.cc                   |  1 +
 gcc/config/s390/s390.cc                     |  1 +
 gcc/config/sol2-cxx.cc                      |  1 +
 gcc/config/vms/vms-c.cc                     |  1 +
 gcc/config/xtensa/xtensa-dynconfig.cc       |  1 +
 gcc/coroutine-passes.cc                     |  1 +
 gcc/coverage.cc                             |  1 +
 gcc/cp/call.cc                              |  1 +
 gcc/cp/class.cc                             |  1 +
 gcc/cp/constexpr.cc                         |  1 +
 gcc/cp/constraint.cc                        |  1 +
 gcc/cp/contracts.cc                         |  1 +
 gcc/cp/coroutines.cc                        |  1 +
 gcc/cp/cp-gimplify.cc                       |  1 +
 gcc/cp/cp-lang.cc                           |  1 +
 gcc/cp/cp-objcp-common.cc                   |  1 +
 gcc/cp/cp-ubsan.cc                          |  1 +
 gcc/cp/cvt.cc                               |  1 +
 gcc/cp/cxx-pretty-print.cc                  |  6 ++-
 gcc/cp/cxx-pretty-print.h                   |  2 +-
 gcc/cp/decl2.cc                             |  1 +
 gcc/cp/dump.cc                              |  1 +
 gcc/cp/except.cc                            |  1 +
 gcc/cp/expr.cc                              |  1 +
 gcc/cp/friend.cc                            |  1 +
 gcc/cp/init.cc                              |  1 +
 gcc/cp/lambda.cc                            |  1 +
 gcc/cp/logic.cc                             |  1 +
 gcc/cp/mangle.cc                            |  1 +
 gcc/cp/method.cc                            |  1 +
 gcc/cp/optimize.cc                          |  1 +
 gcc/cp/pt.cc                                |  1 +
 gcc/cp/ptree.cc                             |  1 +
 gcc/cp/rtti.cc                              |  1 +
 gcc/cp/search.cc                            |  1 +
 gcc/cp/semantics.cc                         |  1 +
 gcc/cp/tree.cc                              |  1 +
 gcc/cp/typeck.cc                            |  1 +
 gcc/cp/typeck2.cc                           |  1 +
 gcc/cp/vtable-class-hierarchy.cc            |  1 +
 gcc/d/d-attribs.cc                          |  1 +
 gcc/d/d-builtins.cc                         |  1 +
 gcc/d/d-codegen.cc                          |  1 +
 gcc/d/d-convert.cc                          |  1 +
 gcc/d/d-diagnostic.cc                       |  1 +
 gcc/d/d-frontend.cc                         |  1 +
 gcc/d/d-lang.cc                             |  1 +
 gcc/d/d-longdouble.cc                       |  1 +
 gcc/d/d-target.cc                           |  1 +
 gcc/d/decl.cc                               |  1 +
 gcc/d/expr.cc                               |  1 +
 gcc/d/intrinsics.cc                         |  1 +
 gcc/d/modules.cc                            |  1 +
 gcc/d/toir.cc                               |  1 +
 gcc/d/typeinfo.cc                           |  1 +
 gcc/d/types.cc                              |  1 +
 gcc/data-streamer-in.cc                     |  1 +
 gcc/data-streamer-out.cc                    |  1 +
 gcc/data-streamer.cc                        |  1 +
 gcc/diagnostic-client-data-hooks.h          |  2 +-
 gcc/diagnostic-format-json.cc               |  2 +-
 gcc/diagnostic-format-sarif.cc              |  4 +-
 gcc/diagnostic-format-text.cc               |  1 +
 gcc/diagnostic-global-context.cc            |  1 +
 gcc/diagnostic-macro-unwinding.cc           |  1 +
 gcc/diagnostic-show-locus.cc                |  1 +
 gcc/diagnostic-spec.cc                      |  1 +
 gcc/diagnostic.cc                           | 27 ++++++-----
 gcc/diagnostic.h                            | 51 ++++++++++++++++-----
 gcc/digraph.cc                              |  1 +
 gcc/dwarf2out.cc                            |  1 +
 gcc/edit-context.cc                         |  1 +
 gcc/except.cc                               |  1 +
 gcc/expr.cc                                 |  1 +
 gcc/file-prefix-map.cc                      |  1 +
 gcc/final.cc                                |  1 +
 gcc/fortran/arith.cc                        |  1 +
 gcc/fortran/array.cc                        |  1 +
 gcc/fortran/bbt.cc                          |  1 +
 gcc/fortran/check.cc                        |  1 +
 gcc/fortran/class.cc                        |  1 +
 gcc/fortran/constructor.cc                  |  1 +
 gcc/fortran/convert.cc                      |  1 +
 gcc/fortran/cpp.cc                          |  1 +
 gcc/fortran/data.cc                         |  1 +
 gcc/fortran/decl.cc                         |  1 +
 gcc/fortran/dependency.cc                   |  1 +
 gcc/fortran/dump-parse-tree.cc              |  1 +
 gcc/fortran/error.cc                        |  1 +
 gcc/fortran/expr.cc                         |  1 +
 gcc/fortran/f95-lang.cc                     |  1 +
 gcc/fortran/frontend-passes.cc              |  1 +
 gcc/fortran/interface.cc                    |  1 +
 gcc/fortran/intrinsic.cc                    |  1 +
 gcc/fortran/io.cc                           |  1 +
 gcc/fortran/iresolve.cc                     |  1 +
 gcc/fortran/match.cc                        |  1 +
 gcc/fortran/matchexp.cc                     |  1 +
 gcc/fortran/misc.cc                         |  1 +
 gcc/fortran/module.cc                       |  1 +
 gcc/fortran/openmp.cc                       |  1 +
 gcc/fortran/options.cc                      |  1 +
 gcc/fortran/parse.cc                        |  1 +
 gcc/fortran/primary.cc                      |  1 +
 gcc/fortran/resolve.cc                      |  1 +
 gcc/fortran/scanner.cc                      |  1 +
 gcc/fortran/simplify.cc                     |  1 +
 gcc/fortran/st.cc                           |  1 +
 gcc/fortran/symbol.cc                       |  1 +
 gcc/fortran/target-memory.cc                |  1 +
 gcc/fortran/trans-array.cc                  |  1 +
 gcc/fortran/trans-common.cc                 |  1 +
 gcc/fortran/trans-const.cc                  |  1 +
 gcc/fortran/trans-decl.cc                   |  1 +
 gcc/fortran/trans-expr.cc                   |  1 +
 gcc/fortran/trans-intrinsic.cc              |  1 +
 gcc/fortran/trans-io.cc                     |  1 +
 gcc/fortran/trans-openmp.cc                 |  1 +
 gcc/fortran/trans-stmt.cc                   |  1 +
 gcc/fortran/trans-types.cc                  |  1 +
 gcc/fortran/trans.cc                        |  1 +
 gcc/fwprop.cc                               |  1 +
 gcc/gcc-rich-location.cc                    |  1 +
 gcc/gcc-urlifier.cc                         |  6 ++-
 gcc/gcc-urlifier.h                          |  2 +-
 gcc/gcc.cc                                  |  2 +
 gcc/gcov-dump.cc                            |  1 +
 gcc/gcov-tool.cc                            |  1 +
 gcc/gengtype.cc                             |  1 +
 gcc/gimple-fold.cc                          |  1 +
 gcc/gimple-harden-conditionals.cc           |  1 +
 gcc/gimple-harden-control-flow.cc           |  1 +
 gcc/gimple-if-to-switch.cc                  |  1 +
 gcc/gimple-lower-bitint.cc                  |  1 +
 gcc/gimple-predicate-analysis.cc            |  1 +
 gcc/gimple-pretty-print.cc                  |  1 +
 gcc/gimple-range-cache.cc                   |  1 +
 gcc/gimple-range-edge.cc                    |  1 +
 gcc/gimple-range-fold.cc                    |  1 +
 gcc/gimple-range-gori.cc                    |  1 +
 gcc/gimple-range-infer.cc                   |  1 +
 gcc/gimple-range-op.cc                      |  1 +
 gcc/gimple-range-path.cc                    |  1 +
 gcc/gimple-range-phi.cc                     |  1 +
 gcc/gimple-range-trace.cc                   |  1 +
 gcc/gimple-range.cc                         |  1 +
 gcc/gimple-ssa-backprop.cc                  |  1 +
 gcc/gimple-ssa-sprintf.cc                   |  1 +
 gcc/gimple-ssa-store-merging.cc             |  1 +
 gcc/gimple-ssa-strength-reduction.cc        |  1 +
 gcc/gimple-ssa-warn-access.cc               |  1 +
 gcc/gimple-ssa-warn-alloca.cc               |  1 +
 gcc/gimple-ssa-warn-restrict.cc             |  1 +
 gcc/gimple-streamer-in.cc                   |  1 +
 gcc/gimple-streamer-out.cc                  |  1 +
 gcc/gimple.cc                               |  1 +
 gcc/gimplify.cc                             |  1 +
 gcc/go/go-backend.cc                        |  1 +
 gcc/go/go-lang.cc                           |  1 +
 gcc/graph.cc                                |  1 +
 gcc/graphviz.cc                             |  1 +
 gcc/input.cc                                |  1 +
 gcc/ipa-cp.cc                               |  1 +
 gcc/ipa-devirt.cc                           |  1 +
 gcc/ipa-fnsummary.cc                        |  1 +
 gcc/ipa-free-lang-data.cc                   |  1 +
 gcc/ipa-icf-gimple.cc                       |  1 +
 gcc/ipa-icf.cc                              |  1 +
 gcc/ipa-inline-analysis.cc                  |  1 +
 gcc/ipa-inline.cc                           |  1 +
 gcc/ipa-modref-tree.cc                      |  1 +
 gcc/ipa-modref.cc                           |  1 +
 gcc/ipa-param-manipulation.cc               |  1 +
 gcc/ipa-polymorphic-call.cc                 |  1 +
 gcc/ipa-predicate.cc                        |  1 +
 gcc/ipa-profile.cc                          |  1 +
 gcc/ipa-prop.cc                             |  1 +
 gcc/ipa-pure-const.cc                       |  1 +
 gcc/ipa-reference.cc                        |  1 +
 gcc/ipa-split.cc                            |  1 +
 gcc/ipa-sra.cc                              |  1 +
 gcc/ipa-strub.cc                            |  1 +
 gcc/ipa-utils.cc                            |  1 +
 gcc/jit/dummy-frontend.cc                   |  1 +
 gcc/jit/jit-playback.cc                     |  1 +
 gcc/jit/jit-recording.cc                    |  1 +
 gcc/langhooks.cc                            |  1 +
 gcc/late-combine.cc                         |  1 +
 gcc/lto-cgraph.cc                           |  1 +
 gcc/lto-compress.cc                         |  1 +
 gcc/lto-opts.cc                             |  1 +
 gcc/lto-section-in.cc                       |  1 +
 gcc/lto-section-out.cc                      |  1 +
 gcc/lto-streamer-in.cc                      |  1 +
 gcc/lto-streamer-out.cc                     |  1 +
 gcc/lto-streamer.cc                         |  1 +
 gcc/lto-wrapper.cc                          |  5 +-
 gcc/lto/lto-common.cc                       |  1 +
 gcc/lto/lto-dump.cc                         |  1 +
 gcc/lto/lto-partition.cc                    |  1 +
 gcc/lto/lto-symtab.cc                       |  1 +
 gcc/lto/lto.cc                              |  1 +
 gcc/m2/gm2-gcc/gcc-consolidation.h          |  1 +
 gcc/m2/gm2-gcc/m2configure.cc               |  1 +
 gcc/multiple_target.cc                      |  1 +
 gcc/objc/objc-act.cc                        |  1 +
 gcc/objc/objc-encoding.cc                   |  1 +
 gcc/objc/objc-gnu-runtime-abi-01.cc         |  1 +
 gcc/objc/objc-lang.cc                       |  2 +-
 gcc/objc/objc-next-runtime-abi-01.cc        |  1 +
 gcc/objc/objc-next-runtime-abi-02.cc        |  1 +
 gcc/objc/objc-runtime-shared-support.cc     |  1 +
 gcc/objcp/objcp-decl.cc                     |  1 +
 gcc/objcp/objcp-lang.cc                     |  1 +
 gcc/omp-expand.cc                           |  1 +
 gcc/omp-general.cc                          |  1 +
 gcc/omp-low.cc                              |  1 +
 gcc/omp-oacc-neuter-broadcast.cc            |  1 +
 gcc/omp-offload.cc                          |  1 +
 gcc/omp-simd-clone.cc                       |  1 +
 gcc/optc-gen.awk                            |  1 +
 gcc/optc-save-gen.awk                       |  1 +
 gcc/options-urls-cc-gen.awk                 |  1 +
 gcc/opts-common.cc                          |  1 +
 gcc/opts-global.cc                          |  1 +
 gcc/opts.cc                                 |  1 +
 gcc/pair-fusion.cc                          |  1 +
 gcc/passes.cc                               |  1 +
 gcc/pointer-query.cc                        |  1 +
 gcc/predict.cc                              |  2 +-
 gcc/pretty-print.cc                         |  4 +-
 gcc/pretty-print.h                          | 10 +++-
 gcc/print-rtl.cc                            |  1 +
 gcc/print-tree.cc                           |  1 +
 gcc/profile-count.cc                        |  1 +
 gcc/range-op-float.cc                       |  1 +
 gcc/range-op-ptr.cc                         |  1 +
 gcc/range-op.cc                             |  1 +
 gcc/range.cc                                |  1 +
 gcc/read-rtl-function.cc                    |  1 +
 gcc/rtl-error.cc                            |  1 +
 gcc/rtl-ssa/accesses.cc                     |  1 +
 gcc/rtl-ssa/blocks.cc                       |  1 +
 gcc/rtl-ssa/changes.cc                      |  1 +
 gcc/rtl-ssa/functions.cc                    |  1 +
 gcc/rtl-ssa/insns.cc                        |  1 +
 gcc/rtl-ssa/movement.cc                     |  1 +
 gcc/rtl-tests.cc                            |  1 +
 gcc/rust/resolve/rust-ast-resolve-expr.cc   |  1 +
 gcc/rust/rust-attribs.cc                    |  1 +
 gcc/rust/rust-system.h                      |  1 +
 gcc/sanopt.cc                               |  1 +
 gcc/sched-rgn.cc                            |  1 +
 gcc/selftest-diagnostic-path.cc             |  1 +
 gcc/selftest-diagnostic.cc                  |  1 +
 gcc/splay-tree-utils.cc                     |  1 +
 gcc/sreal.cc                                |  1 +
 gcc/stmt.cc                                 |  1 +
 gcc/substring-locations.cc                  |  1 +
 gcc/symtab-clones.cc                        |  1 +
 gcc/symtab-thunks.cc                        |  1 +
 gcc/symtab.cc                               |  1 +
 gcc/text-art/box-drawing.cc                 |  1 +
 gcc/text-art/canvas.cc                      |  1 +
 gcc/text-art/ruler.cc                       |  1 +
 gcc/text-art/selftests.cc                   |  1 +
 gcc/text-art/theme.cc                       |  1 +
 gcc/toplev.cc                               |  8 ++--
 gcc/trans-mem.cc                            |  1 +
 gcc/tree-affine.cc                          |  1 +
 gcc/tree-call-cdce.cc                       |  1 +
 gcc/tree-cfg.cc                             |  1 +
 gcc/tree-chrec.cc                           |  1 +
 gcc/tree-dfa.cc                             |  1 +
 gcc/tree-diagnostic-client-data-hooks.cc    |  5 +-
 gcc/tree-diagnostic.cc                      |  1 +
 gcc/tree-dump.cc                            |  1 +
 gcc/tree-inline.cc                          |  1 +
 gcc/tree-into-ssa.cc                        |  1 +
 gcc/tree-logical-location.cc                |  1 +
 gcc/tree-nested.cc                          |  1 +
 gcc/tree-nrv.cc                             |  1 +
 gcc/tree-object-size.cc                     |  1 +
 gcc/tree-outof-ssa.cc                       |  1 +
 gcc/tree-pretty-print.cc                    |  1 +
 gcc/tree-profile.cc                         |  1 +
 gcc/tree-scalar-evolution.cc                |  1 +
 gcc/tree-sra.cc                             |  1 +
 gcc/tree-ssa-address.cc                     |  1 +
 gcc/tree-ssa-alias.cc                       |  1 +
 gcc/tree-ssa-ccp.cc                         |  1 +
 gcc/tree-ssa-coalesce.cc                    |  1 +
 gcc/tree-ssa-copy.cc                        |  1 +
 gcc/tree-ssa-dce.cc                         |  1 +
 gcc/tree-ssa-dom.cc                         |  1 +
 gcc/tree-ssa-forwprop.cc                    |  1 +
 gcc/tree-ssa-ifcombine.cc                   |  1 +
 gcc/tree-ssa-loop-ch.cc                     |  1 +
 gcc/tree-ssa-loop-im.cc                     |  1 +
 gcc/tree-ssa-loop-manip.cc                  |  1 +
 gcc/tree-ssa-loop-niter.cc                  |  1 +
 gcc/tree-ssa-loop-split.cc                  |  1 +
 gcc/tree-ssa-math-opts.cc                   |  1 +
 gcc/tree-ssa-operands.cc                    |  1 +
 gcc/tree-ssa-phiprop.cc                     |  1 +
 gcc/tree-ssa-pre.cc                         |  1 +
 gcc/tree-ssa-propagate.cc                   |  1 +
 gcc/tree-ssa-reassoc.cc                     |  1 +
 gcc/tree-ssa-sccvn.cc                       |  1 +
 gcc/tree-ssa-scopedtables.cc                |  1 +
 gcc/tree-ssa-sink.cc                        |  1 +
 gcc/tree-ssa-strlen.cc                      |  1 +
 gcc/tree-ssa-structalias.cc                 |  1 +
 gcc/tree-ssa-ter.cc                         |  1 +
 gcc/tree-ssa-uninit.cc                      |  1 +
 gcc/tree-ssa.cc                             |  1 +
 gcc/tree-ssanames.cc                        |  1 +
 gcc/tree-stdarg.cc                          |  1 +
 gcc/tree-streamer-in.cc                     |  1 +
 gcc/tree-streamer-out.cc                    |  1 +
 gcc/tree-streamer.cc                        |  1 +
 gcc/tree-switch-conversion.cc               |  1 +
 gcc/tree-tailcall.cc                        |  1 +
 gcc/tree-vrp.cc                             |  1 +
 gcc/tree.cc                                 |  1 +
 gcc/ubsan.cc                                |  1 +
 gcc/value-pointer-equiv.cc                  |  1 +
 gcc/value-prof.cc                           |  1 +
 gcc/value-query.cc                          |  1 +
 gcc/value-range-pretty-print.cc             |  1 +
 gcc/value-range-storage.cc                  |  1 +
 gcc/value-range.cc                          |  1 +
 gcc/value-relation.cc                       |  1 +
 gcc/var-tracking.cc                         |  1 +
 gcc/varpool.cc                              |  1 +
 gcc/vr-values.cc                            |  1 +
 gcc/wide-int-print.cc                       |  1 +
 libgcc/libgcov-util.c                       |  1 +
 415 files changed, 535 insertions(+), 97 deletions(-)

Comments

Gaius Mulley Oct. 17, 2024, 2:07 a.m. UTC | #1
David Malcolm <dmalcolm@redhat.com> writes:

> I've successfully built stage 1 on all configurations with this patch
> *without* Modula 2.
>
> Unfortuately, for Modula 2 there are numerous generated sources, many
> of which start with:
>
>   #include "config.h"
>   #include "system.h"
>   #include "gcc-consolidation.h"
>
> I've tried fixing this by adding:
>
> 	print (p, '#define INCLUDE_MEMORY\n');
>
> to gcc/m2/mc/keyc.mod, but my various attempts to regenerate the
> Modula 2 sources keep failing; sorry.
>
> So I'm hoping that either Gaius can help me here with regenerating
> the Modula 2 sources, or the "always include <memory> from system.h"
> approach is acceptable/preferable.

yes sure, here is a proposed patch for m2 containing the changes in the
two bootstrap tools affected (mc and pge).  I've added the #define
INCLUDE_MEMORY as above for consistency with your patch [I note that my
patch has dropped attribute noreturns from M2RTS, which I'll look into
later tomorrow]

regards,
Gaius


PR modula2/116613: RFC Followup for use unique_ptr in pretty_printer/diagnostics

This patch adds #define INCLUDE_MEMORY to the bootstrap tool mc
and contains a regenerated versions of mc and pge.
Bootstrap tested on x86_64 and ppc64le.

gcc/m2/ChangeLog:

	* mc-boot/GASCII.cc: Regenerate.
	* mc-boot/GASCII.h: Ditto.
	* mc-boot/GArgs.cc: Ditto.
	* mc-boot/GArgs.h: Ditto.
	* mc-boot/GAssertion.cc: Ditto.
	* mc-boot/GAssertion.h: Ditto.
	* mc-boot/GBreak.cc: Ditto.
	* mc-boot/GBreak.h: Ditto.
	* mc-boot/GCOROUTINES.h: Ditto.
	* mc-boot/GCmdArgs.cc: Ditto.
	* mc-boot/GCmdArgs.h: Ditto.
	* mc-boot/GDebug.cc: Ditto.
	* mc-boot/GDebug.h: Ditto.
	* mc-boot/GDynamicStrings.cc: Ditto.
	* mc-boot/GDynamicStrings.h: Ditto.
	* mc-boot/GEnvironment.cc: Ditto.
	* mc-boot/GEnvironment.h: Ditto.
	* mc-boot/GFIO.cc: Ditto.
	* mc-boot/GFIO.h: Ditto.
	* mc-boot/GFormatStrings.cc: Ditto.
	* mc-boot/GFormatStrings.h: Ditto.
	* mc-boot/GFpuIO.cc: Ditto.
	* mc-boot/GFpuIO.h: Ditto.
	* mc-boot/GIO.cc: Ditto.
	* mc-boot/GIO.h: Ditto.
	* mc-boot/GIndexing.cc: Ditto.
	* mc-boot/GIndexing.h: Ditto.
	* mc-boot/GM2Dependent.cc: Ditto.
	* mc-boot/GM2Dependent.h: Ditto.
	* mc-boot/GM2EXCEPTION.cc: Ditto.
	* mc-boot/GM2EXCEPTION.h: Ditto.
	* mc-boot/GM2RTS.cc: Ditto.
	* mc-boot/GM2RTS.h: Ditto.
	* mc-boot/GMemUtils.cc: Ditto.
	* mc-boot/GMemUtils.h: Ditto.
	* mc-boot/GNumberIO.cc: Ditto.
	* mc-boot/GNumberIO.h: Ditto.
	* mc-boot/GPushBackInput.cc: Ditto.
	* mc-boot/GPushBackInput.h: Ditto.
	* mc-boot/GRTExceptions.cc: Ditto.
	* mc-boot/GRTExceptions.h: Ditto.
	* mc-boot/GRTco.h: Ditto.
	* mc-boot/GRTentity.h: Ditto.
	* mc-boot/GRTint.cc: Ditto.
	* mc-boot/GRTint.h: Ditto.
	* mc-boot/GSArgs.cc: Ditto.
	* mc-boot/GSArgs.h: Ditto.
	* mc-boot/GSFIO.cc: Ditto.
	* mc-boot/GSFIO.h: Ditto.
	* mc-boot/GSYSTEM.h: Ditto.
	* mc-boot/GSelective.h: Ditto.
	* mc-boot/GStdIO.cc: Ditto.
	* mc-boot/GStdIO.h: Ditto.
	* mc-boot/GStorage.cc: Ditto.
	* mc-boot/GStorage.h: Ditto.
	* mc-boot/GStrCase.cc: Ditto.
	* mc-boot/GStrCase.h: Ditto.
	* mc-boot/GStrIO.cc: Ditto.
	* mc-boot/GStrIO.h: Ditto.
	* mc-boot/GStrLib.cc: Ditto.
	* mc-boot/GStrLib.h: Ditto.
	* mc-boot/GStringConvert.cc: Ditto.
	* mc-boot/GStringConvert.h: Ditto.
	* mc-boot/GSysExceptions.h: Ditto.
	* mc-boot/GSysStorage.cc: Ditto.
	* mc-boot/GSysStorage.h: Ditto.
	* mc-boot/GTimeString.cc: Ditto.
	* mc-boot/GTimeString.h: Ditto.
	* mc-boot/GUnixArgs.h: Ditto.
	* mc-boot/Galists.cc: Ditto.
	* mc-boot/Galists.h: Ditto.
	* mc-boot/Gdecl.cc: Ditto.
	* mc-boot/Gdecl.h: Ditto.
	* mc-boot/Gdtoa.h: Ditto.
	* mc-boot/Gerrno.h: Ditto.
	* mc-boot/Gkeyc.cc: Ditto.
	* mc-boot/Gkeyc.h: Ditto.
	* mc-boot/Gldtoa.h: Ditto.
	* mc-boot/Glibc.h: Ditto.
	* mc-boot/Glibm.h: Ditto.
	* mc-boot/Glists.cc: Ditto.
	* mc-boot/Glists.h: Ditto.
	* mc-boot/GmcComment.cc: Ditto.
	* mc-boot/GmcComment.h: Ditto.
	* mc-boot/GmcComp.cc: Ditto.
	* mc-boot/GmcComp.h: Ditto.
	* mc-boot/GmcDebug.cc: Ditto.
	* mc-boot/GmcDebug.h: Ditto.
	* mc-boot/GmcError.cc: Ditto.
	* mc-boot/GmcError.h: Ditto.
	* mc-boot/GmcFileName.cc: Ditto.
	* mc-boot/GmcFileName.h: Ditto.
	* mc-boot/GmcLexBuf.cc: Ditto.
	* mc-boot/GmcLexBuf.h: Ditto.
	* mc-boot/GmcMetaError.cc: Ditto.
	* mc-boot/GmcMetaError.h: Ditto.
	* mc-boot/GmcOptions.cc: Ditto.
	* mc-boot/GmcOptions.h: Ditto.
	* mc-boot/GmcPreprocess.cc: Ditto.
	* mc-boot/GmcPreprocess.h: Ditto.
	* mc-boot/GmcPretty.cc: Ditto.
	* mc-boot/GmcPretty.h: Ditto.
	* mc-boot/GmcPrintf.cc: Ditto.
	* mc-boot/GmcPrintf.h: Ditto.
	* mc-boot/GmcQuiet.cc: Ditto.
	* mc-boot/GmcQuiet.h: Ditto.
	* mc-boot/GmcReserved.cc: Ditto.
	* mc-boot/GmcReserved.h: Ditto.
	* mc-boot/GmcSearch.cc: Ditto.
	* mc-boot/GmcSearch.h: Ditto.
	* mc-boot/GmcStack.cc: Ditto.
	* mc-boot/GmcStack.h: Ditto.
	* mc-boot/GmcStream.cc: Ditto.
	* mc-boot/GmcStream.h: Ditto.
	* mc-boot/Gmcflex.h: Ditto.
	* mc-boot/Gmcp1.cc: Ditto.
	* mc-boot/Gmcp1.h: Ditto.
	* mc-boot/Gmcp2.cc: Ditto.
	* mc-boot/Gmcp2.h: Ditto.
	* mc-boot/Gmcp3.cc: Ditto.
	* mc-boot/Gmcp3.h: Ditto.
	* mc-boot/Gmcp4.cc: Ditto.
	* mc-boot/Gmcp4.h: Ditto.
	* mc-boot/Gmcp5.cc: Ditto.
	* mc-boot/Gmcp5.h: Ditto.
	* mc-boot/GnameKey.cc: Ditto.
	* mc-boot/GnameKey.h: Ditto.
	* mc-boot/GsymbolKey.cc: Ditto.
	* mc-boot/GsymbolKey.h: Ditto.
	* mc-boot/Gtermios.h: Ditto.
	* mc-boot/Gtop.cc: Ditto.
	* mc-boot/Gvarargs.cc: Ditto.
	* mc-boot/Gvarargs.h: Ditto.
	* mc-boot/Gwlists.cc: Ditto.
	* mc-boot/Gwlists.h: Ditto.
	* mc-boot/Gwrapc.h: Ditto.
	* mc/keyc.mod (checkGccConfigSystem): Add
	#define INCLUDE_MEMORY.
	* pge-boot/GASCII.cc: Regenerate.
	* pge-boot/GASCII.h: Ditto.
	* pge-boot/GArgs.cc: Ditto.
	* pge-boot/GArgs.h: Ditto.
	* pge-boot/GAssertion.cc: Ditto.
	* pge-boot/GAssertion.h: Ditto.
	* pge-boot/GBreak.h: Ditto.
	* pge-boot/GCmdArgs.h: Ditto.
	* pge-boot/GDebug.cc: Ditto.
	* pge-boot/GDebug.h: Ditto.
	* pge-boot/GDynamicStrings.cc: Ditto.
	* pge-boot/GDynamicStrings.h: Ditto.
	* pge-boot/GEnvironment.h: Ditto.
	* pge-boot/GFIO.cc: Ditto.
	* pge-boot/GFIO.h: Ditto.
	* pge-boot/GFormatStrings.h: Ditto.
	* pge-boot/GFpuIO.h: Ditto.
	* pge-boot/GIO.cc: Ditto.
	* pge-boot/GIO.h: Ditto.
	* pge-boot/GIndexing.cc: Ditto.
	* pge-boot/GIndexing.h: Ditto.
	* pge-boot/GLists.cc: Ditto.
	* pge-boot/GLists.h: Ditto.
	* pge-boot/GM2Dependent.cc: Ditto.
	* pge-boot/GM2Dependent.h: Ditto.
	* pge-boot/GM2EXCEPTION.cc: Ditto.
	* pge-boot/GM2EXCEPTION.h: Ditto.
	* pge-boot/GM2RTS.cc: Ditto.
	* pge-boot/GM2RTS.h: Ditto.
	* pge-boot/GNameKey.cc: Ditto.
	* pge-boot/GNameKey.h: Ditto.
	* pge-boot/GNumberIO.cc: Ditto.
	* pge-boot/GNumberIO.h: Ditto.
	* pge-boot/GOutput.cc: Ditto.
	* pge-boot/GOutput.h: Ditto.
	* pge-boot/GPushBackInput.cc: Ditto.
	* pge-boot/GPushBackInput.h: Ditto.
	* pge-boot/GRTExceptions.cc: Ditto.
	* pge-boot/GRTExceptions.h: Ditto.
	* pge-boot/GSArgs.h: Ditto.
	* pge-boot/GSEnvironment.h: Ditto.
	* pge-boot/GSFIO.cc: Ditto.
	* pge-boot/GSFIO.h: Ditto.
	* pge-boot/GSYSTEM.h: Ditto.
	* pge-boot/GScan.h: Ditto.
	* pge-boot/GStdIO.cc: Ditto.
	* pge-boot/GStdIO.h: Ditto.
	* pge-boot/GStorage.cc: Ditto.
	* pge-boot/GStorage.h: Ditto.
	* pge-boot/GStrCase.cc: Ditto.
	* pge-boot/GStrCase.h: Ditto.
	* pge-boot/GStrIO.cc: Ditto.
	* pge-boot/GStrIO.h: Ditto.
	* pge-boot/GStrLib.cc: Ditto.
	* pge-boot/GStrLib.h: Ditto.
	* pge-boot/GStringConvert.h: Ditto.
	* pge-boot/GSymbolKey.cc: Ditto.
	* pge-boot/GSymbolKey.h: Ditto.
	* pge-boot/GSysExceptions.h: Ditto.
	* pge-boot/GSysStorage.cc: Ditto.
	* pge-boot/GSysStorage.h: Ditto.
	* pge-boot/GTimeString.h: Ditto.
	* pge-boot/GUnixArgs.h: Ditto.
	* pge-boot/Gbnflex.cc: Ditto.
	* pge-boot/Gbnflex.h: Ditto.
	* pge-boot/Gdtoa.h: Ditto.
	* pge-boot/Gerrno.h: Ditto.
	* pge-boot/Gldtoa.h: Ditto.
	* pge-boot/Glibc.h: Ditto.
	* pge-boot/Glibm.h: Ditto.
	* pge-boot/Gpge.cc: Ditto.
	* pge-boot/Gtermios.h: Ditto.
	* pge-boot/Gwrapc.h: Ditto.


diff --git a/gcc/m2/mc-boot/GASCII.cc b/gcc/m2/mc-boot/GASCII.cc
index a5c59fd3c4b..76e1dd901ed 100644
--- a/gcc/m2/mc-boot/GASCII.cc
+++ b/gcc/m2/mc-boot/GASCII.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GASCII.h b/gcc/m2/mc-boot/GASCII.h
index c157a8b7686..76c961a9d57 100644
--- a/gcc/m2/mc-boot/GASCII.h
+++ b/gcc/m2/mc-boot/GASCII.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_ASCII_H)
 #   define _ASCII_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GArgs.cc b/gcc/m2/mc-boot/GArgs.cc
index 182def800ea..8fc16a4ebea 100644
--- a/gcc/m2/mc-boot/GArgs.cc
+++ b/gcc/m2/mc-boot/GArgs.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GArgs.h b/gcc/m2/mc-boot/GArgs.h
index 1171cef8d72..752345f691c 100644
--- a/gcc/m2/mc-boot/GArgs.h
+++ b/gcc/m2/mc-boot/GArgs.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Args_H)
 #   define _Args_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GAssertion.cc b/gcc/m2/mc-boot/GAssertion.cc
index b6b47952108..34989b9737f 100644
--- a/gcc/m2/mc-boot/GAssertion.cc
+++ b/gcc/m2/mc-boot/GAssertion.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GAssertion.h b/gcc/m2/mc-boot/GAssertion.h
index d909fdee7a3..c5bcdd98d37 100644
--- a/gcc/m2/mc-boot/GAssertion.h
+++ b/gcc/m2/mc-boot/GAssertion.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Assertion_H)
 #   define _Assertion_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GBreak.cc b/gcc/m2/mc-boot/GBreak.cc
index 4fea839214b..ffbe2f172a5 100644
--- a/gcc/m2/mc-boot/GBreak.cc
+++ b/gcc/m2/mc-boot/GBreak.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GBreak.h b/gcc/m2/mc-boot/GBreak.h
index bd2f1ccf6f1..df0ee16b5ed 100644
--- a/gcc/m2/mc-boot/GBreak.h
+++ b/gcc/m2/mc-boot/GBreak.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Break_H)
 #   define _Break_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GCOROUTINES.h b/gcc/m2/mc-boot/GCOROUTINES.h
index a744d9c6ebe..dff08a0c185 100644
--- a/gcc/m2/mc-boot/GCOROUTINES.h
+++ b/gcc/m2/mc-boot/GCOROUTINES.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_COROUTINES_H)
 #   define _COROUTINES_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GCmdArgs.cc b/gcc/m2/mc-boot/GCmdArgs.cc
index cb8fa8ace58..0e33d916051 100644
--- a/gcc/m2/mc-boot/GCmdArgs.cc
+++ b/gcc/m2/mc-boot/GCmdArgs.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GCmdArgs.h b/gcc/m2/mc-boot/GCmdArgs.h
index 7f39815bc09..852e8dc0037 100644
--- a/gcc/m2/mc-boot/GCmdArgs.h
+++ b/gcc/m2/mc-boot/GCmdArgs.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_CmdArgs_H)
 #   define _CmdArgs_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GDebug.cc b/gcc/m2/mc-boot/GDebug.cc
index 3f0ec51507e..edda6c952c5 100644
--- a/gcc/m2/mc-boot/GDebug.cc
+++ b/gcc/m2/mc-boot/GDebug.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GDebug.h b/gcc/m2/mc-boot/GDebug.h
index 8787752b9a3..08c4da1abed 100644
--- a/gcc/m2/mc-boot/GDebug.h
+++ b/gcc/m2/mc-boot/GDebug.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Debug_H)
 #   define _Debug_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GDynamicStrings.cc b/gcc/m2/mc-boot/GDynamicStrings.cc
index 2b182b9b2c0..bccbeda2f23 100644
--- a/gcc/m2/mc-boot/GDynamicStrings.cc
+++ b/gcc/m2/mc-boot/GDynamicStrings.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GDynamicStrings.h b/gcc/m2/mc-boot/GDynamicStrings.h
index e0652a7d3bd..fefce9d6f6b 100644
--- a/gcc/m2/mc-boot/GDynamicStrings.h
+++ b/gcc/m2/mc-boot/GDynamicStrings.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_DynamicStrings_H)
 #   define _DynamicStrings_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GEnvironment.cc b/gcc/m2/mc-boot/GEnvironment.cc
index aad1bb46c01..95dab816595 100644
--- a/gcc/m2/mc-boot/GEnvironment.cc
+++ b/gcc/m2/mc-boot/GEnvironment.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GEnvironment.h b/gcc/m2/mc-boot/GEnvironment.h
index 4f94d583334..2da03aeba75 100644
--- a/gcc/m2/mc-boot/GEnvironment.h
+++ b/gcc/m2/mc-boot/GEnvironment.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Environment_H)
 #   define _Environment_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GFIO.cc b/gcc/m2/mc-boot/GFIO.cc
index b05c33000bd..45a39d66116 100644
--- a/gcc/m2/mc-boot/GFIO.cc
+++ b/gcc/m2/mc-boot/GFIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GFIO.h b/gcc/m2/mc-boot/GFIO.h
index d82396449ff..04cbc768505 100644
--- a/gcc/m2/mc-boot/GFIO.h
+++ b/gcc/m2/mc-boot/GFIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FIO_H)
 #   define _FIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GFormatStrings.cc b/gcc/m2/mc-boot/GFormatStrings.cc
index d3acec3bc6c..36998f693c5 100644
--- a/gcc/m2/mc-boot/GFormatStrings.cc
+++ b/gcc/m2/mc-boot/GFormatStrings.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GFormatStrings.h b/gcc/m2/mc-boot/GFormatStrings.h
index 1d8ce34ce62..858403d5690 100644
--- a/gcc/m2/mc-boot/GFormatStrings.h
+++ b/gcc/m2/mc-boot/GFormatStrings.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FormatStrings_H)
 #   define _FormatStrings_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GFpuIO.cc b/gcc/m2/mc-boot/GFpuIO.cc
index 09fd4fb95cd..3c4fb6121dc 100644
--- a/gcc/m2/mc-boot/GFpuIO.cc
+++ b/gcc/m2/mc-boot/GFpuIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GFpuIO.h b/gcc/m2/mc-boot/GFpuIO.h
index 5d830606130..1e0575b7f82 100644
--- a/gcc/m2/mc-boot/GFpuIO.h
+++ b/gcc/m2/mc-boot/GFpuIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FpuIO_H)
 #   define _FpuIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GIO.cc b/gcc/m2/mc-boot/GIO.cc
index 4b76ed6bc80..76495e745fd 100644
--- a/gcc/m2/mc-boot/GIO.cc
+++ b/gcc/m2/mc-boot/GIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GIO.h b/gcc/m2/mc-boot/GIO.h
index 4f4af9a59a0..3e58ea5cff2 100644
--- a/gcc/m2/mc-boot/GIO.h
+++ b/gcc/m2/mc-boot/GIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_IO_H)
 #   define _IO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GIndexing.cc b/gcc/m2/mc-boot/GIndexing.cc
index dd314001108..9f41d879f62 100644
--- a/gcc/m2/mc-boot/GIndexing.cc
+++ b/gcc/m2/mc-boot/GIndexing.cc
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GIndexing.h b/gcc/m2/mc-boot/GIndexing.h
index b986469c331..e2e728c2566 100644
--- a/gcc/m2/mc-boot/GIndexing.h
+++ b/gcc/m2/mc-boot/GIndexing.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_Indexing_H)
 #   define _Indexing_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GM2Dependent.cc b/gcc/m2/mc-boot/GM2Dependent.cc
index c965f4bf7f3..f4fe04cd2b6 100644
--- a/gcc/m2/mc-boot/GM2Dependent.cc
+++ b/gcc/m2/mc-boot/GM2Dependent.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GM2Dependent.h b/gcc/m2/mc-boot/GM2Dependent.h
index 0353236f8c1..3b32e165a48 100644
--- a/gcc/m2/mc-boot/GM2Dependent.h
+++ b/gcc/m2/mc-boot/GM2Dependent.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2Dependent_H)
 #   define _M2Dependent_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.cc b/gcc/m2/mc-boot/GM2EXCEPTION.cc
index 97417cf6c82..af1218f922a 100644
--- a/gcc/m2/mc-boot/GM2EXCEPTION.cc
+++ b/gcc/m2/mc-boot/GM2EXCEPTION.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.h b/gcc/m2/mc-boot/GM2EXCEPTION.h
index 4ee5404733c..fef5e2b1740 100644
--- a/gcc/m2/mc-boot/GM2EXCEPTION.h
+++ b/gcc/m2/mc-boot/GM2EXCEPTION.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2EXCEPTION_H)
 #   define _M2EXCEPTION_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GM2RTS.cc b/gcc/m2/mc-boot/GM2RTS.cc
index ef5f7cf5ce1..844006ac529 100644
--- a/gcc/m2/mc-boot/GM2RTS.cc
+++ b/gcc/m2/mc-boot/GM2RTS.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GM2RTS.h b/gcc/m2/mc-boot/GM2RTS.h
index 055cc95675b..88e21849c05 100644
--- a/gcc/m2/mc-boot/GM2RTS.h
+++ b/gcc/m2/mc-boot/GM2RTS.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2RTS_H)
 #   define _M2RTS_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GMemUtils.cc b/gcc/m2/mc-boot/GMemUtils.cc
index 1d9feed27d6..04474ecbf39 100644
--- a/gcc/m2/mc-boot/GMemUtils.cc
+++ b/gcc/m2/mc-boot/GMemUtils.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GMemUtils.h b/gcc/m2/mc-boot/GMemUtils.h
index 1d23091ce93..dea7aafda6d 100644
--- a/gcc/m2/mc-boot/GMemUtils.h
+++ b/gcc/m2/mc-boot/GMemUtils.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_MemUtils_H)
 #   define _MemUtils_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GNumberIO.cc b/gcc/m2/mc-boot/GNumberIO.cc
index 75720dd85e6..15b3be191f0 100644
--- a/gcc/m2/mc-boot/GNumberIO.cc
+++ b/gcc/m2/mc-boot/GNumberIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GNumberIO.h b/gcc/m2/mc-boot/GNumberIO.h
index 34aee337383..decd31b4dd8 100644
--- a/gcc/m2/mc-boot/GNumberIO.h
+++ b/gcc/m2/mc-boot/GNumberIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_NumberIO_H)
 #   define _NumberIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GPushBackInput.cc b/gcc/m2/mc-boot/GPushBackInput.cc
index 9bc2a83abd4..5c50f967c18 100644
--- a/gcc/m2/mc-boot/GPushBackInput.cc
+++ b/gcc/m2/mc-boot/GPushBackInput.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GPushBackInput.h b/gcc/m2/mc-boot/GPushBackInput.h
index 076b99657a0..27c572b53e0 100644
--- a/gcc/m2/mc-boot/GPushBackInput.h
+++ b/gcc/m2/mc-boot/GPushBackInput.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_PushBackInput_H)
 #   define _PushBackInput_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GRTExceptions.cc b/gcc/m2/mc-boot/GRTExceptions.cc
index a0eff3ecc8a..d42c1f31107 100644
--- a/gcc/m2/mc-boot/GRTExceptions.cc
+++ b/gcc/m2/mc-boot/GRTExceptions.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GRTExceptions.h b/gcc/m2/mc-boot/GRTExceptions.h
index 9e188bcbad4..b335d800ca6 100644
--- a/gcc/m2/mc-boot/GRTExceptions.h
+++ b/gcc/m2/mc-boot/GRTExceptions.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_RTExceptions_H)
 #   define _RTExceptions_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GRTco.h b/gcc/m2/mc-boot/GRTco.h
index 778b75f3d2e..2e014d333cf 100644
--- a/gcc/m2/mc-boot/GRTco.h
+++ b/gcc/m2/mc-boot/GRTco.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_RTco_H)
 #   define _RTco_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GRTentity.h b/gcc/m2/mc-boot/GRTentity.h
index 9acb0775575..3eb8822fc9d 100644
--- a/gcc/m2/mc-boot/GRTentity.h
+++ b/gcc/m2/mc-boot/GRTentity.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_RTentity_H)
 #   define _RTentity_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GRTint.cc b/gcc/m2/mc-boot/GRTint.cc
index 11b4228074a..f1c268843c8 100644
--- a/gcc/m2/mc-boot/GRTint.cc
+++ b/gcc/m2/mc-boot/GRTint.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GRTint.h b/gcc/m2/mc-boot/GRTint.h
index 4f81546e8d6..a9fb9d182ec 100644
--- a/gcc/m2/mc-boot/GRTint.h
+++ b/gcc/m2/mc-boot/GRTint.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_RTint_H)
 #   define _RTint_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSArgs.cc b/gcc/m2/mc-boot/GSArgs.cc
index 93083a056dc..0c99f2d2594 100644
--- a/gcc/m2/mc-boot/GSArgs.cc
+++ b/gcc/m2/mc-boot/GSArgs.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GSArgs.h b/gcc/m2/mc-boot/GSArgs.h
index a7b10bf4a1f..6a12e7ec4f3 100644
--- a/gcc/m2/mc-boot/GSArgs.h
+++ b/gcc/m2/mc-boot/GSArgs.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SArgs_H)
 #   define _SArgs_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSFIO.cc b/gcc/m2/mc-boot/GSFIO.cc
index b568cce23eb..232d3f5883e 100644
--- a/gcc/m2/mc-boot/GSFIO.cc
+++ b/gcc/m2/mc-boot/GSFIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GSFIO.h b/gcc/m2/mc-boot/GSFIO.h
index 108d8ea79f0..bba25eb8436 100644
--- a/gcc/m2/mc-boot/GSFIO.h
+++ b/gcc/m2/mc-boot/GSFIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SFIO_H)
 #   define _SFIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSYSTEM.h b/gcc/m2/mc-boot/GSYSTEM.h
index a18a1765dc5..ff4b7b24ac3 100644
--- a/gcc/m2/mc-boot/GSYSTEM.h
+++ b/gcc/m2/mc-boot/GSYSTEM.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SYSTEM_H)
 #   define _SYSTEM_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSelective.h b/gcc/m2/mc-boot/GSelective.h
index 67b7f0643f0..17e926d1a44 100644
--- a/gcc/m2/mc-boot/GSelective.h
+++ b/gcc/m2/mc-boot/GSelective.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Selective_H)
 #   define _Selective_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStdIO.cc b/gcc/m2/mc-boot/GStdIO.cc
index c9d3774ec06..ddcb8ec040a 100644
--- a/gcc/m2/mc-boot/GStdIO.cc
+++ b/gcc/m2/mc-boot/GStdIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStdIO.h b/gcc/m2/mc-boot/GStdIO.h
index 0a45ebc7e34..3c84cede87b 100644
--- a/gcc/m2/mc-boot/GStdIO.h
+++ b/gcc/m2/mc-boot/GStdIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StdIO_H)
 #   define _StdIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStorage.cc b/gcc/m2/mc-boot/GStorage.cc
index 67e7a8b7274..24ced14ce6a 100644
--- a/gcc/m2/mc-boot/GStorage.cc
+++ b/gcc/m2/mc-boot/GStorage.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStorage.h b/gcc/m2/mc-boot/GStorage.h
index 8c26b465b2c..a119a8f6e58 100644
--- a/gcc/m2/mc-boot/GStorage.h
+++ b/gcc/m2/mc-boot/GStorage.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Storage_H)
 #   define _Storage_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStrCase.cc b/gcc/m2/mc-boot/GStrCase.cc
index 9492774596b..03993e5fbd6 100644
--- a/gcc/m2/mc-boot/GStrCase.cc
+++ b/gcc/m2/mc-boot/GStrCase.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStrCase.h b/gcc/m2/mc-boot/GStrCase.h
index c3f064728d8..9fd23285525 100644
--- a/gcc/m2/mc-boot/GStrCase.h
+++ b/gcc/m2/mc-boot/GStrCase.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrCase_H)
 #   define _StrCase_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStrIO.cc b/gcc/m2/mc-boot/GStrIO.cc
index d0c6e2085cd..7e94ef521ea 100644
--- a/gcc/m2/mc-boot/GStrIO.cc
+++ b/gcc/m2/mc-boot/GStrIO.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStrIO.h b/gcc/m2/mc-boot/GStrIO.h
index 2ed2ac33f11..653e020d399 100644
--- a/gcc/m2/mc-boot/GStrIO.h
+++ b/gcc/m2/mc-boot/GStrIO.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrIO_H)
 #   define _StrIO_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStrLib.cc b/gcc/m2/mc-boot/GStrLib.cc
index dc6d0ff2aa0..19ac230e9a4 100644
--- a/gcc/m2/mc-boot/GStrLib.cc
+++ b/gcc/m2/mc-boot/GStrLib.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStrLib.h b/gcc/m2/mc-boot/GStrLib.h
index b292d8990a1..ddd7457a6ff 100644
--- a/gcc/m2/mc-boot/GStrLib.h
+++ b/gcc/m2/mc-boot/GStrLib.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrLib_H)
 #   define _StrLib_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GStringConvert.cc b/gcc/m2/mc-boot/GStringConvert.cc
index 80efd0c9fc4..822813cd141 100644
--- a/gcc/m2/mc-boot/GStringConvert.cc
+++ b/gcc/m2/mc-boot/GStringConvert.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GStringConvert.h b/gcc/m2/mc-boot/GStringConvert.h
index 284eef236cc..3983d6cc375 100644
--- a/gcc/m2/mc-boot/GStringConvert.h
+++ b/gcc/m2/mc-boot/GStringConvert.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StringConvert_H)
 #   define _StringConvert_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSysExceptions.h b/gcc/m2/mc-boot/GSysExceptions.h
index 00dd52117d1..eee2631c8be 100644
--- a/gcc/m2/mc-boot/GSysExceptions.h
+++ b/gcc/m2/mc-boot/GSysExceptions.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SysExceptions_H)
 #   define _SysExceptions_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GSysStorage.cc b/gcc/m2/mc-boot/GSysStorage.cc
index 1ef723074d4..fe06a5d8775 100644
--- a/gcc/m2/mc-boot/GSysStorage.cc
+++ b/gcc/m2/mc-boot/GSysStorage.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GSysStorage.h b/gcc/m2/mc-boot/GSysStorage.h
index 639f6811e19..2aa6f85aaff 100644
--- a/gcc/m2/mc-boot/GSysStorage.h
+++ b/gcc/m2/mc-boot/GSysStorage.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SysStorage_H)
 #   define _SysStorage_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GTimeString.cc b/gcc/m2/mc-boot/GTimeString.cc
index af7b7e40814..37405659be0 100644
--- a/gcc/m2/mc-boot/GTimeString.cc
+++ b/gcc/m2/mc-boot/GTimeString.cc
@@ -25,6 +25,7 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GTimeString.h b/gcc/m2/mc-boot/GTimeString.h
index 7ba51f8081e..27d128769f5 100644
--- a/gcc/m2/mc-boot/GTimeString.h
+++ b/gcc/m2/mc-boot/GTimeString.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_TimeString_H)
 #   define _TimeString_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GUnixArgs.h b/gcc/m2/mc-boot/GUnixArgs.h
index cf9756ea177..6c04a944825 100644
--- a/gcc/m2/mc-boot/GUnixArgs.h
+++ b/gcc/m2/mc-boot/GUnixArgs.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_UnixArgs_H)
 #   define _UnixArgs_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Galists.cc b/gcc/m2/mc-boot/Galists.cc
index ca582f3ce43..a2ad92238b7 100644
--- a/gcc/m2/mc-boot/Galists.cc
+++ b/gcc/m2/mc-boot/Galists.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Galists.h b/gcc/m2/mc-boot/Galists.h
index 3ed524152f4..3bb6599422c 100644
--- a/gcc/m2/mc-boot/Galists.h
+++ b/gcc/m2/mc-boot/Galists.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_alists_H)
 #   define _alists_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gdecl.cc b/gcc/m2/mc-boot/Gdecl.cc
index 9af2842ca18..28c5ccd5c2f 100644
--- a/gcc/m2/mc-boot/Gdecl.cc
+++ b/gcc/m2/mc-boot/Gdecl.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gdecl.h b/gcc/m2/mc-boot/Gdecl.h
index 99d78087ae2..8b7aa91b38a 100644
--- a/gcc/m2/mc-boot/Gdecl.h
+++ b/gcc/m2/mc-boot/Gdecl.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_decl_H)
 #   define _decl_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gdtoa.h b/gcc/m2/mc-boot/Gdtoa.h
index c1b3619ce47..d06a03480f9 100644
--- a/gcc/m2/mc-boot/Gdtoa.h
+++ b/gcc/m2/mc-boot/Gdtoa.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_dtoa_H)
 #   define _dtoa_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gerrno.h b/gcc/m2/mc-boot/Gerrno.h
index 7f065ccb24d..9d315c3d2ce 100644
--- a/gcc/m2/mc-boot/Gerrno.h
+++ b/gcc/m2/mc-boot/Gerrno.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_errno_H)
 #   define _errno_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gkeyc.cc b/gcc/m2/mc-boot/Gkeyc.cc
index 3a5dd5ccc1d..a56abc56ee3 100644
--- a/gcc/m2/mc-boot/Gkeyc.cc
+++ b/gcc/m2/mc-boot/Gkeyc.cc
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
@@ -575,6 +576,7 @@ static void checkGccConfigSystem (mcPretty_pretty p)
       if (! initializedGCC)
         {
           initializedGCC = true;
+          mcPretty_print (p, (const char *) "#define INCLUDE_MEMORY\\n", 24);
           mcPretty_print (p, (const char *) "#include \"config.h\"\\n", 21);
           mcPretty_print (p, (const char *) "#include \"system.h\"\\n", 21);
           checkGccTypes (p);
diff --git a/gcc/m2/mc-boot/Gkeyc.h b/gcc/m2/mc-boot/Gkeyc.h
index afa945d03c0..f0911ee8488 100644
--- a/gcc/m2/mc-boot/Gkeyc.h
+++ b/gcc/m2/mc-boot/Gkeyc.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_keyc_H)
 #   define _keyc_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gldtoa.h b/gcc/m2/mc-boot/Gldtoa.h
index c4b4d904fb0..a8f72ea4bd1 100644
--- a/gcc/m2/mc-boot/Gldtoa.h
+++ b/gcc/m2/mc-boot/Gldtoa.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_ldtoa_H)
 #   define _ldtoa_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Glibc.h b/gcc/m2/mc-boot/Glibc.h
index def419fb3c9..50384ecf897 100644
--- a/gcc/m2/mc-boot/Glibc.h
+++ b/gcc/m2/mc-boot/Glibc.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_libc_H)
 #   define _libc_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Glibm.h b/gcc/m2/mc-boot/Glibm.h
index d3c9415070c..19ee9e599ce 100644
--- a/gcc/m2/mc-boot/Glibm.h
+++ b/gcc/m2/mc-boot/Glibm.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_libm_H)
 #   define _libm_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Glists.cc b/gcc/m2/mc-boot/Glists.cc
index e33c91d8500..d354e867e77 100644
--- a/gcc/m2/mc-boot/Glists.cc
+++ b/gcc/m2/mc-boot/Glists.cc
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Glists.h b/gcc/m2/mc-boot/Glists.h
index 5cb8058415c..e8414b080fe 100644
--- a/gcc/m2/mc-boot/Glists.h
+++ b/gcc/m2/mc-boot/Glists.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_lists_H)
 #   define _lists_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcComment.cc b/gcc/m2/mc-boot/GmcComment.cc
index 4c7650283ec..6b27d93e6fa 100644
--- a/gcc/m2/mc-boot/GmcComment.cc
+++ b/gcc/m2/mc-boot/GmcComment.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcComment.h b/gcc/m2/mc-boot/GmcComment.h
index 39ba8c21595..57952a1cec2 100644
--- a/gcc/m2/mc-boot/GmcComment.h
+++ b/gcc/m2/mc-boot/GmcComment.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcComment_H)
 #   define _mcComment_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcComp.cc b/gcc/m2/mc-boot/GmcComp.cc
index c941c618030..ca192aa7456 100644
--- a/gcc/m2/mc-boot/GmcComp.cc
+++ b/gcc/m2/mc-boot/GmcComp.cc
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcComp.h b/gcc/m2/mc-boot/GmcComp.h
index 9ab78a54723..088b6636f96 100644
--- a/gcc/m2/mc-boot/GmcComp.h
+++ b/gcc/m2/mc-boot/GmcComp.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcComp_H)
 #   define _mcComp_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcDebug.cc b/gcc/m2/mc-boot/GmcDebug.cc
index 0085384f2c9..7ded4aee139 100644
--- a/gcc/m2/mc-boot/GmcDebug.cc
+++ b/gcc/m2/mc-boot/GmcDebug.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcDebug.h b/gcc/m2/mc-boot/GmcDebug.h
index e8ec34b2be4..8de6dc46e7e 100644
--- a/gcc/m2/mc-boot/GmcDebug.h
+++ b/gcc/m2/mc-boot/GmcDebug.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcDebug_H)
 #   define _mcDebug_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcError.cc b/gcc/m2/mc-boot/GmcError.cc
index 5893201913f..cb5e30fa8cc 100644
--- a/gcc/m2/mc-boot/GmcError.cc
+++ b/gcc/m2/mc-boot/GmcError.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcError.h b/gcc/m2/mc-boot/GmcError.h
index 6a62fcd540f..0c369b2d006 100644
--- a/gcc/m2/mc-boot/GmcError.h
+++ b/gcc/m2/mc-boot/GmcError.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcError_H)
 #   define _mcError_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcFileName.cc b/gcc/m2/mc-boot/GmcFileName.cc
index 3b516594c59..f0f69129e06 100644
--- a/gcc/m2/mc-boot/GmcFileName.cc
+++ b/gcc/m2/mc-boot/GmcFileName.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcFileName.h b/gcc/m2/mc-boot/GmcFileName.h
index a5a9afa8376..42c05b97090 100644
--- a/gcc/m2/mc-boot/GmcFileName.h
+++ b/gcc/m2/mc-boot/GmcFileName.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcFileName_H)
 #   define _mcFileName_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcLexBuf.cc b/gcc/m2/mc-boot/GmcLexBuf.cc
index 4cbd54429d1..39860c25ff7 100644
--- a/gcc/m2/mc-boot/GmcLexBuf.cc
+++ b/gcc/m2/mc-boot/GmcLexBuf.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcLexBuf.h b/gcc/m2/mc-boot/GmcLexBuf.h
index ca71dd83adb..714d0491b00 100644
--- a/gcc/m2/mc-boot/GmcLexBuf.h
+++ b/gcc/m2/mc-boot/GmcLexBuf.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcLexBuf_H)
 #   define _mcLexBuf_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcMetaError.cc b/gcc/m2/mc-boot/GmcMetaError.cc
index af64604534e..e5921a227e8 100644
--- a/gcc/m2/mc-boot/GmcMetaError.cc
+++ b/gcc/m2/mc-boot/GmcMetaError.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcMetaError.h b/gcc/m2/mc-boot/GmcMetaError.h
index a3c19c4c3a3..78dc1287905 100644
--- a/gcc/m2/mc-boot/GmcMetaError.h
+++ b/gcc/m2/mc-boot/GmcMetaError.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcMetaError_H)
 #   define _mcMetaError_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcOptions.cc b/gcc/m2/mc-boot/GmcOptions.cc
index 5a060604709..f6e4417b659 100644
--- a/gcc/m2/mc-boot/GmcOptions.cc
+++ b/gcc/m2/mc-boot/GmcOptions.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcOptions.h b/gcc/m2/mc-boot/GmcOptions.h
index 4bb82ecfbe2..b2ead1e4b41 100644
--- a/gcc/m2/mc-boot/GmcOptions.h
+++ b/gcc/m2/mc-boot/GmcOptions.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcOptions_H)
 #   define _mcOptions_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcPreprocess.cc b/gcc/m2/mc-boot/GmcPreprocess.cc
index 741109ad7fb..54d89bf33e7 100644
--- a/gcc/m2/mc-boot/GmcPreprocess.cc
+++ b/gcc/m2/mc-boot/GmcPreprocess.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcPreprocess.h b/gcc/m2/mc-boot/GmcPreprocess.h
index f12c781d173..fcbd0c3dfd5 100644
--- a/gcc/m2/mc-boot/GmcPreprocess.h
+++ b/gcc/m2/mc-boot/GmcPreprocess.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcPreprocess_H)
 #   define _mcPreprocess_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcPretty.cc b/gcc/m2/mc-boot/GmcPretty.cc
index 0bffa1ff6fe..e9a56b0002c 100644
--- a/gcc/m2/mc-boot/GmcPretty.cc
+++ b/gcc/m2/mc-boot/GmcPretty.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcPretty.h b/gcc/m2/mc-boot/GmcPretty.h
index 1a61c893261..c1d59ced8cb 100644
--- a/gcc/m2/mc-boot/GmcPretty.h
+++ b/gcc/m2/mc-boot/GmcPretty.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcPretty_H)
 #   define _mcPretty_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcPrintf.cc b/gcc/m2/mc-boot/GmcPrintf.cc
index e91e55acc14..dafa728437f 100644
--- a/gcc/m2/mc-boot/GmcPrintf.cc
+++ b/gcc/m2/mc-boot/GmcPrintf.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcPrintf.h b/gcc/m2/mc-boot/GmcPrintf.h
index 46aeaacf888..1f242a88554 100644
--- a/gcc/m2/mc-boot/GmcPrintf.h
+++ b/gcc/m2/mc-boot/GmcPrintf.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcPrintf_H)
 #   define _mcPrintf_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcQuiet.cc b/gcc/m2/mc-boot/GmcQuiet.cc
index d0f2f009b2a..3309f13d736 100644
--- a/gcc/m2/mc-boot/GmcQuiet.cc
+++ b/gcc/m2/mc-boot/GmcQuiet.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcQuiet.h b/gcc/m2/mc-boot/GmcQuiet.h
index 9065ff9c578..be6f4eaa001 100644
--- a/gcc/m2/mc-boot/GmcQuiet.h
+++ b/gcc/m2/mc-boot/GmcQuiet.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcQuiet_H)
 #   define _mcQuiet_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcReserved.cc b/gcc/m2/mc-boot/GmcReserved.cc
index a42f1b1b0ac..02132e48b4b 100644
--- a/gcc/m2/mc-boot/GmcReserved.cc
+++ b/gcc/m2/mc-boot/GmcReserved.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcReserved.h b/gcc/m2/mc-boot/GmcReserved.h
index ab844ee5c93..b7817027249 100644
--- a/gcc/m2/mc-boot/GmcReserved.h
+++ b/gcc/m2/mc-boot/GmcReserved.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcReserved_H)
 #   define _mcReserved_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcSearch.cc b/gcc/m2/mc-boot/GmcSearch.cc
index e1a2aa63e29..14d3e3fe0ab 100644
--- a/gcc/m2/mc-boot/GmcSearch.cc
+++ b/gcc/m2/mc-boot/GmcSearch.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcSearch.h b/gcc/m2/mc-boot/GmcSearch.h
index f4324a02436..36ed6093637 100644
--- a/gcc/m2/mc-boot/GmcSearch.h
+++ b/gcc/m2/mc-boot/GmcSearch.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcSearch_H)
 #   define _mcSearch_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcStack.cc b/gcc/m2/mc-boot/GmcStack.cc
index 70f937b4299..8edae475e6d 100644
--- a/gcc/m2/mc-boot/GmcStack.cc
+++ b/gcc/m2/mc-boot/GmcStack.cc
@@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcStack.h b/gcc/m2/mc-boot/GmcStack.h
index 70b22be94f1..476ff65fe69 100644
--- a/gcc/m2/mc-boot/GmcStack.h
+++ b/gcc/m2/mc-boot/GmcStack.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcStack_H)
 #   define _mcStack_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GmcStream.cc b/gcc/m2/mc-boot/GmcStream.cc
index da44d8f66a8..18430606d0f 100644
--- a/gcc/m2/mc-boot/GmcStream.cc
+++ b/gcc/m2/mc-boot/GmcStream.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GmcStream.h b/gcc/m2/mc-boot/GmcStream.h
index a156d880d54..473b05df7ac 100644
--- a/gcc/m2/mc-boot/GmcStream.h
+++ b/gcc/m2/mc-boot/GmcStream.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcStream_H)
 #   define _mcStream_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcflex.h b/gcc/m2/mc-boot/Gmcflex.h
index 9e6d4c48edf..ff14f9fdfef 100644
--- a/gcc/m2/mc-boot/Gmcflex.h
+++ b/gcc/m2/mc-boot/Gmcflex.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcflex_H)
 #   define _mcflex_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcp1.cc b/gcc/m2/mc-boot/Gmcp1.cc
index b4ccf806cb0..8971c323b67 100644
--- a/gcc/m2/mc-boot/Gmcp1.cc
+++ b/gcc/m2/mc-boot/Gmcp1.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING.  If not,
 see <https://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gmcp1.h b/gcc/m2/mc-boot/Gmcp1.h
index 878d1642c62..758d8c0ae3e 100644
--- a/gcc/m2/mc-boot/Gmcp1.h
+++ b/gcc/m2/mc-boot/Gmcp1.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcp1_H)
 #   define _mcp1_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcp2.cc b/gcc/m2/mc-boot/Gmcp2.cc
index f61e42220d4..2a3a38c63ea 100644
--- a/gcc/m2/mc-boot/Gmcp2.cc
+++ b/gcc/m2/mc-boot/Gmcp2.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING.  If not,
 see <https://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gmcp2.h b/gcc/m2/mc-boot/Gmcp2.h
index b483b2dc248..ec894e1ba26 100644
--- a/gcc/m2/mc-boot/Gmcp2.h
+++ b/gcc/m2/mc-boot/Gmcp2.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcp2_H)
 #   define _mcp2_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcp3.cc b/gcc/m2/mc-boot/Gmcp3.cc
index 5cb83f464e7..b5ade482801 100644
--- a/gcc/m2/mc-boot/Gmcp3.cc
+++ b/gcc/m2/mc-boot/Gmcp3.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING.  If not,
 see <https://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gmcp3.h b/gcc/m2/mc-boot/Gmcp3.h
index 0e00ddcdd9b..87856ed51e1 100644
--- a/gcc/m2/mc-boot/Gmcp3.h
+++ b/gcc/m2/mc-boot/Gmcp3.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcp3_H)
 #   define _mcp3_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcp4.cc b/gcc/m2/mc-boot/Gmcp4.cc
index ce8cb78f443..869763713d6 100644
--- a/gcc/m2/mc-boot/Gmcp4.cc
+++ b/gcc/m2/mc-boot/Gmcp4.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING.  If not,
 see <https://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gmcp4.h b/gcc/m2/mc-boot/Gmcp4.h
index 643b939a634..c229beb3c20 100644
--- a/gcc/m2/mc-boot/Gmcp4.h
+++ b/gcc/m2/mc-boot/Gmcp4.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcp4_H)
 #   define _mcp4_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gmcp5.cc b/gcc/m2/mc-boot/Gmcp5.cc
index 909c62215c8..ec241691a95 100644
--- a/gcc/m2/mc-boot/Gmcp5.cc
+++ b/gcc/m2/mc-boot/Gmcp5.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING.  If not,
 see <https://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gmcp5.h b/gcc/m2/mc-boot/Gmcp5.h
index 7989101e86a..de3edb17922 100644
--- a/gcc/m2/mc-boot/Gmcp5.h
+++ b/gcc/m2/mc-boot/Gmcp5.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_mcp5_H)
 #   define _mcp5_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GnameKey.cc b/gcc/m2/mc-boot/GnameKey.cc
index 3e868886e29..8f4a330d0d9 100644
--- a/gcc/m2/mc-boot/GnameKey.cc
+++ b/gcc/m2/mc-boot/GnameKey.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GnameKey.h b/gcc/m2/mc-boot/GnameKey.h
index a2ea330b063..d4cce1b6bd3 100644
--- a/gcc/m2/mc-boot/GnameKey.h
+++ b/gcc/m2/mc-boot/GnameKey.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_nameKey_H)
 #   define _nameKey_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/GsymbolKey.cc b/gcc/m2/mc-boot/GsymbolKey.cc
index 17072597304..50b8c8f56c3 100644
--- a/gcc/m2/mc-boot/GsymbolKey.cc
+++ b/gcc/m2/mc-boot/GsymbolKey.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/GsymbolKey.h b/gcc/m2/mc-boot/GsymbolKey.h
index 69670985516..5d05977e50a 100644
--- a/gcc/m2/mc-boot/GsymbolKey.h
+++ b/gcc/m2/mc-boot/GsymbolKey.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_symbolKey_H)
 #   define _symbolKey_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gtermios.h b/gcc/m2/mc-boot/Gtermios.h
index acb7fcf0c76..70c0c49948e 100644
--- a/gcc/m2/mc-boot/Gtermios.h
+++ b/gcc/m2/mc-boot/Gtermios.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_termios_H)
 #   define _termios_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gtop.cc b/gcc/m2/mc-boot/Gtop.cc
index dfefe42c1da..1a8597a0426 100644
--- a/gcc/m2/mc-boot/Gtop.cc
+++ b/gcc/m2/mc-boot/Gtop.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gvarargs.cc b/gcc/m2/mc-boot/Gvarargs.cc
index 69f5f2c5756..32f984d24fc 100644
--- a/gcc/m2/mc-boot/Gvarargs.cc
+++ b/gcc/m2/mc-boot/Gvarargs.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gvarargs.h b/gcc/m2/mc-boot/Gvarargs.h
index 82b5b753ba1..8e3e91a1c42 100644
--- a/gcc/m2/mc-boot/Gvarargs.h
+++ b/gcc/m2/mc-boot/Gvarargs.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_varargs_H)
 #   define _varargs_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gwlists.cc b/gcc/m2/mc-boot/Gwlists.cc
index 87daa42c3ef..9262329e77a 100644
--- a/gcc/m2/mc-boot/Gwlists.cc
+++ b/gcc/m2/mc-boot/Gwlists.cc
@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <stdbool.h>
diff --git a/gcc/m2/mc-boot/Gwlists.h b/gcc/m2/mc-boot/Gwlists.h
index 05d65945b58..53bad73339a 100644
--- a/gcc/m2/mc-boot/Gwlists.h
+++ b/gcc/m2/mc-boot/Gwlists.h
@@ -24,6 +24,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_wlists_H)
 #   define _wlists_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc-boot/Gwrapc.h b/gcc/m2/mc-boot/Gwrapc.h
index e4db1e2a99f..fdbeabcdade 100644
--- a/gcc/m2/mc-boot/Gwrapc.h
+++ b/gcc/m2/mc-boot/Gwrapc.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_wrapc_H)
 #   define _wrapc_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/mc/keyc.mod b/gcc/m2/mc/keyc.mod
index f3f09309ad5..a182e120692 100644
--- a/gcc/m2/mc/keyc.mod
+++ b/gcc/m2/mc/keyc.mod
@@ -95,6 +95,7 @@ BEGIN
       IF NOT initializedGCC
       THEN
          initializedGCC := TRUE ;
+         print (p, '#define INCLUDE_MEMORY\n');
          print (p, '#include "config.h"\n');
          print (p, '#include "system.h"\n');
          checkGccTypes (p)
diff --git a/gcc/m2/pge-boot/GASCII.cc b/gcc/m2/pge-boot/GASCII.cc
index 19e98ede436..0023496a955 100644
--- a/gcc/m2/pge-boot/GASCII.cc
+++ b/gcc/m2/pge-boot/GASCII.cc
@@ -32,9 +32,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _ASCII_H
 #define _ASCII_C
 
+#include "GASCII.h"
 
 #   define ASCII_nul (char) 000
 #   define ASCII_soh (char) 001
diff --git a/gcc/m2/pge-boot/GASCII.h b/gcc/m2/pge-boot/GASCII.h
index c157a8b7686..6346caa1189 100644
--- a/gcc/m2/pge-boot/GASCII.h
+++ b/gcc/m2/pge-boot/GASCII.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_ASCII_H)
 #   define _ASCII_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GArgs.cc b/gcc/m2/pge-boot/GArgs.cc
index 284567d750a..78b1ed8d581 100644
--- a/gcc/m2/pge-boot/GArgs.cc
+++ b/gcc/m2/pge-boot/GArgs.cc
@@ -32,9 +32,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Args_H
 #define _Args_C
 
+#include "GArgs.h"
 #   include "GUnixArgs.h"
 #   include "GASCII.h"
 
@@ -84,13 +84,13 @@ extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n)
       Source = static_cast<Args__T1> (UnixArgs_GetArgV ());
       while ((j < High) && ((*(*Source).array[i]).array[j] != ASCII_nul))
         {
-          a[j] = (*(*Source).array[i]).array[j];
+          const_cast<char *>(a)[j] = (*(*Source).array[i]).array[j];
           j += 1;
         }
     }
   if (j <= High)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
   return i < (UnixArgs_GetArgC ());
   /* static analysis guarentees a RETURN statement will be used before here.  */
diff --git a/gcc/m2/pge-boot/GArgs.h b/gcc/m2/pge-boot/GArgs.h
index 1171cef8d72..b912da63c7c 100644
--- a/gcc/m2/pge-boot/GArgs.h
+++ b/gcc/m2/pge-boot/GArgs.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Args_H)
 #   define _Args_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GAssertion.cc b/gcc/m2/pge-boot/GAssertion.cc
index 3dae36d748a..2de1b585383 100644
--- a/gcc/m2/pge-boot/GAssertion.cc
+++ b/gcc/m2/pge-boot/GAssertion.cc
@@ -32,9 +32,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Assertion_H
 #define _Assertion_C
 
+#include "GAssertion.h"
 #   include "GStrIO.h"
 #   include "GM2RTS.h"
 
diff --git a/gcc/m2/pge-boot/GAssertion.h b/gcc/m2/pge-boot/GAssertion.h
index d909fdee7a3..9e0777fc60b 100644
--- a/gcc/m2/pge-boot/GAssertion.h
+++ b/gcc/m2/pge-boot/GAssertion.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Assertion_H)
 #   define _Assertion_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GBreak.h b/gcc/m2/pge-boot/GBreak.h
index bd2f1ccf6f1..635d82cfbe3 100644
--- a/gcc/m2/pge-boot/GBreak.h
+++ b/gcc/m2/pge-boot/GBreak.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Break_H)
 #   define _Break_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GCmdArgs.h b/gcc/m2/pge-boot/GCmdArgs.h
index 7f39815bc09..c7b3dd22d46 100644
--- a/gcc/m2/pge-boot/GCmdArgs.h
+++ b/gcc/m2/pge-boot/GCmdArgs.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_CmdArgs_H)
 #   define _CmdArgs_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GDebug.cc b/gcc/m2/pge-boot/GDebug.cc
index deb7f9e7aeb..f608ee9f5dc 100644
--- a/gcc/m2/pge-boot/GDebug.cc
+++ b/gcc/m2/pge-boot/GDebug.cc
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <string.h>
 #include <limits.h>
-#define _Debug_H
 #define _Debug_C
 
+#include "GDebug.h"
 #   include "GASCII.h"
 #   include "GNumberIO.h"
 #   include "GStdIO.h"
diff --git a/gcc/m2/pge-boot/GDebug.h b/gcc/m2/pge-boot/GDebug.h
index 8787752b9a3..c853211e16e 100644
--- a/gcc/m2/pge-boot/GDebug.h
+++ b/gcc/m2/pge-boot/GDebug.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Debug_H)
 #   define _Debug_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GDynamicStrings.cc b/gcc/m2/pge-boot/GDynamicStrings.cc
index 32969692985..92913d32655 100644
--- a/gcc/m2/pge-boot/GDynamicStrings.cc
+++ b/gcc/m2/pge-boot/GDynamicStrings.cc
@@ -25,8 +25,6 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-#include "system.h"
 #include <stdbool.h>
 #   if !defined (PROC_D)
 #      define PROC_D
@@ -42,7 +40,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
+#include <stddef.h>
+#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
 #   include "GStorage.h"
+#include <unistd.h>
 #if defined(__cplusplus)
 #   undef NULL
 #   define NULL 0
@@ -2064,7 +2067,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
   DynamicStrings_String__opaque d;
   DynamicStrings_String__opaque t;
   int start;
-  int end;
+  int stop;
   int o;
 
   if (PoisonOn)
@@ -2107,7 +2110,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
                 {
                   start = low-o;
                 }
-              end = Max (Min (MaxBuf, static_cast<unsigned int> (high-o)), 0);
+              stop = Max (Min (MaxBuf, static_cast<unsigned int> (high-o)), 0);
               while (t->contents.len == MaxBuf)
                 {
                   if (t->contents.next == NULL)
@@ -2123,7 +2126,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
                     }
                   t = t->contents.next;
                 }
-              ConcatContentsAddress (&t->contents, &static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[start], static_cast<unsigned int> (end-start));
+              ConcatContentsAddress (&t->contents, &static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[start], static_cast<unsigned int> (stop-start));
               o += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
               s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
             }
diff --git a/gcc/m2/pge-boot/GDynamicStrings.h b/gcc/m2/pge-boot/GDynamicStrings.h
index e0652a7d3bd..4d77cecc591 100644
--- a/gcc/m2/pge-boot/GDynamicStrings.h
+++ b/gcc/m2/pge-boot/GDynamicStrings.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_DynamicStrings_H)
 #   define _DynamicStrings_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GEnvironment.h b/gcc/m2/pge-boot/GEnvironment.h
index 4f94d583334..4645a495415 100644
--- a/gcc/m2/pge-boot/GEnvironment.h
+++ b/gcc/m2/pge-boot/GEnvironment.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Environment_H)
 #   define _Environment_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GFIO.cc b/gcc/m2/pge-boot/GFIO.cc
index 3e56792f20f..c0de99efabd 100644
--- a/gcc/m2/pge-boot/GFIO.cc
+++ b/gcc/m2/pge-boot/GFIO.cc
@@ -52,9 +52,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _FIO_H
 #define _FIO_C
 
+#include "GFIO.h"
 #   include "GSYSTEM.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
@@ -67,9 +67,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 typedef unsigned int FIO_File;
 
-FIO_File FIO_StdErr;
-FIO_File FIO_StdOut;
-FIO_File FIO_StdIn;
 #   define MaxBufferLength (1024*16)
 #   define MaxErrorString (1024*8)
 #   define CreatePermissions 0666
@@ -643,7 +640,7 @@ static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength,
             {
               fd->buffer->left = 0;
             }
-          fd->buffer->contents = reinterpret_cast<FIO__T7 *> (fd->buffer->address);  /* provides easy access for reading characters  */
+          fd->buffer->contents = static_cast<FIO__T7 *> (fd->buffer->address);  /* provides easy access for reading characters  */
           fd->state = fstate;  /* provides easy access for reading characters  */
         }
     }
@@ -917,7 +914,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
       if (src[(*i)+1] == 'n')
         {
           /* requires a newline  */
-          dest[(*j)] = ASCII_nl;
+          const_cast<char *>(dest)[(*j)] = ASCII_nl;
           (*j) += 1;
           (*i) += 2;
         }
@@ -925,7 +922,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
         {
           /* avoid dangling else.  */
           /* requires a tab (yuck) tempted to fake this but I better not..  */
-          dest[(*j)] = ASCII_tab;
+          const_cast<char *>(dest)[(*j)] = ASCII_tab;
           (*j) += 1;
           (*i) += 2;
         }
@@ -934,7 +931,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
           /* avoid dangling else.  */
           /* copy escaped character  */
           (*i) += 1;
-          dest[(*j)] = src[(*i)];
+          const_cast<char *>(dest)[(*j)] = src[(*i)];
           (*j) += 1;
           (*i) += 1;
         }
@@ -958,7 +955,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
     {
       for (i=0; i<=_a_high; i++)
         {
-          a[i] = b[i];
+          const_cast<unsigned char *>(a)[i] = b[i];
         }
     }
   else
@@ -1008,7 +1005,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
         }
       else
         {
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
@@ -1021,13 +1018,13 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
           Cast ((unsigned char *) &p, (sizeof (p)-1), (const unsigned char *) w, _w_high);
           while ((j < HighDest) && ((*p) != ASCII_nul))
             {
-              dest[j] = (*p);
+              const_cast<char *>(dest)[j] = (*p);
               j += 1;
               p += 1;
             }
           if (j < HighDest)
             {
-              dest[j] = ASCII_nul;
+              const_cast<char *>(dest)[j] = ASCII_nul;
             }
           j = StrLib_StrLen ((const char *) dest, _dest_high);
           i += 2;
@@ -1035,7 +1032,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
       else if (src[i+1] == 'd')
         {
           /* avoid dangling else.  */
-          dest[j] = ASCII_nul;
+          const_cast<char *>(dest)[j] = ASCII_nul;
           Cast ((unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) w, _w_high);
           NumberIO_CardToStr (c, 0, (char *) &str.array[0], MaxErrorString);
           StrLib_StrConCat ((const char *) dest, _dest_high, (const char *) &str.array[0], MaxErrorString, (char *) dest, _dest_high);
@@ -1045,7 +1042,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
       else
         {
           /* avoid dangling else.  */
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
@@ -1059,14 +1056,14 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
         }
       else
         {
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
     }
   if (j < HighDest)
     {
-      dest[j] = ASCII_nul;
+      const_cast<char *>(dest)[j] = ASCII_nul;
     }
 }
 
@@ -1316,7 +1313,7 @@ static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_h
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  if ((InitializeFile (f, &fname, StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
+  if ((InitializeFile (f, const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
     {
       fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
       if (f == Error)
@@ -1418,7 +1415,7 @@ extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high)
   /* 
    The following functions are wrappers for the above.
   */
-  return FIO_exists (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_exists (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1430,7 +1427,7 @@ extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openToRead (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_openToRead (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1442,7 +1439,7 @@ extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_hig
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openToWrite (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_openToWrite (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1454,7 +1451,7 @@ extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_h
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openForRandom (&fname, StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
+  return FIO_openForRandom (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1970,7 +1967,7 @@ extern "C" void FIO_WriteString (FIO_File f, const char *a_, unsigned int _a_hig
   memcpy (a, a_, _a_high+1);
 
   l = StrLib_StrLen ((const char *) a, _a_high);
-  if ((FIO_WriteNBytes (f, l, &a)) != l)
+  if ((FIO_WriteNBytes (f, l, const_cast<void*> (static_cast<const void*>(a)))) != l)
     {}  /* empty.  */
 }
 
@@ -1997,12 +1994,12 @@ extern "C" void FIO_ReadString (FIO_File f, char *a, unsigned int _a_high)
         /* avoid gcc warning by using compound statement even if not strictly necessary.  */
         if (((ch == ASCII_nl) || (! (FIO_IsNoError (f)))) || (FIO_EOF (f)))
           {
-            a[i] = ASCII_nul;
+            const_cast<char *>(a)[i] = ASCII_nul;
             i += 1;
           }
         else
           {
-            a[i] = ch;
+            const_cast<char *>(a)[i] = ch;
             i += 1;
           }
       }
@@ -2226,7 +2223,7 @@ extern "C" void FIO_GetFileName (FIO_File f, char *a, unsigned int _a_high)
               i = 0;
               while (((*p) != ASCII_nul) && (i <= _a_high))
                 {
-                  a[i] = (*p);
+                  const_cast<char *>(a)[i] = (*p);
                   p += 1;
                   i += 1;
                 }
diff --git a/gcc/m2/pge-boot/GFIO.h b/gcc/m2/pge-boot/GFIO.h
index d82396449ff..160fadee5dd 100644
--- a/gcc/m2/pge-boot/GFIO.h
+++ b/gcc/m2/pge-boot/GFIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FIO_H)
 #   define _FIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GFormatStrings.h b/gcc/m2/pge-boot/GFormatStrings.h
index 1d8ce34ce62..61f738bb323 100644
--- a/gcc/m2/pge-boot/GFormatStrings.h
+++ b/gcc/m2/pge-boot/GFormatStrings.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FormatStrings_H)
 #   define _FormatStrings_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GFpuIO.h b/gcc/m2/pge-boot/GFpuIO.h
index 5d830606130..70cc45dfcb5 100644
--- a/gcc/m2/pge-boot/GFpuIO.h
+++ b/gcc/m2/pge-boot/GFpuIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_FpuIO_H)
 #   define _FpuIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GIO.cc b/gcc/m2/pge-boot/GIO.cc
index 7d391bb72ff..f728a3adfd1 100644
--- a/gcc/m2/pge-boot/GIO.cc
+++ b/gcc/m2/pge-boot/GIO.cc
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <stdlib.h>
 #include <unistd.h>
-#define _IO_H
 #define _IO_C
 
+#include "GIO.h"
 #   include "GStrLib.h"
 #   include "GSYSTEM.h"
 #   include "Glibc.h"
diff --git a/gcc/m2/pge-boot/GIO.h b/gcc/m2/pge-boot/GIO.h
index 4f4af9a59a0..ae16019fb70 100644
--- a/gcc/m2/pge-boot/GIO.h
+++ b/gcc/m2/pge-boot/GIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_IO_H)
 #   define _IO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GIndexing.cc b/gcc/m2/pge-boot/GIndexing.cc
index 21e3a43a8c8..d1a7a668ba5 100644
--- a/gcc/m2/pge-boot/GIndexing.cc
+++ b/gcc/m2/pge-boot/GIndexing.cc
@@ -48,9 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _Indexing_H
 #define _Indexing_C
 
+#include "GIndexing.h"
 #   include "Glibc.h"
 #   include "GStorage.h"
 #   include "GSYSTEM.h"
@@ -66,10 +66,7 @@ typedef void * *Indexing_PtrToAddress;
 
 typedef unsigned char *Indexing_PtrToByte;
 
-typedef Indexing__T2 *Indexing_Index;
-
-typedef void (*Indexing_IndexProcedure_t) (void *);
-struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
+typedef Indexing__T2 *Indexing_Index__opaque;
 
 struct Indexing__T2_r {
                         void * ArrayStart;
@@ -178,6 +175,13 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
 
 extern "C" bool Indexing_IsEmpty (Indexing_Index i);
 
+/*
+   FindIndice - returns the indice containing a.
+                It returns zero if a is not found in array i.
+*/
+
+extern "C" unsigned int Indexing_FindIndice (Indexing_Index i, void * a);
+
 
 /*
    InitIndexTuned - creates a dynamic array with low indice.
@@ -188,7 +192,7 @@ extern "C" bool Indexing_IsEmpty (Indexing_Index i);
 
 extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor)
 {
-  Indexing_Index i;
+  Indexing_Index__opaque i;
 
   Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2));
   i->Low = low;
@@ -200,7 +204,7 @@ extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned in
   i->Used = 0;
   i->Map = (unsigned int) 0;
   i->GrowFactor = growfactor;
-  return i;
+  return static_cast<Indexing_Index> (i);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -224,9 +228,9 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
 
 extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
 {
-  Storage_DEALLOCATE (&i->ArrayStart, i->ArraySize);
+  Storage_DEALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
   Storage_DEALLOCATE ((void **) &i, sizeof (Indexing__T2));
-  return NULL;
+  return static_cast<Indexing_Index> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -238,7 +242,7 @@ extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
 
 extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i)
 {
-  i->Debug = true;
+  static_cast<Indexing_Index__opaque> (i)->Debug = true;
   return i;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -259,7 +263,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
     }
   else
     {
-      return (n >= i->Low) && (n <= i->High);
+      return (n >= static_cast<Indexing_Index__opaque> (i)->Low) && (n <= static_cast<Indexing_Index__opaque> (i)->High);
     }
   ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
   __builtin_unreachable ();
@@ -279,7 +283,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i)
     }
   else
     {
-      return i->High;
+      return static_cast<Indexing_Index__opaque> (i)->High;
     }
   ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
   __builtin_unreachable ();
@@ -299,7 +303,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i)
     }
   else
     {
-      return i->Low;
+      return static_cast<Indexing_Index__opaque> (i)->Low;
     }
   ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1);
   __builtin_unreachable ();
@@ -321,19 +325,19 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
   if (! (Indexing_InBounds (i, n)))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (n < i->Low)
+      if (n < static_cast<Indexing_Index__opaque> (i)->Low)
         {
           M2RTS_HALT (-1);
           __builtin_unreachable ();
         }
       else
         {
-          oldSize = i->ArraySize;
-          while (((n-i->Low)*sizeof (void *)) >= i->ArraySize)
+          oldSize = static_cast<Indexing_Index__opaque> (i)->ArraySize;
+          while (((n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *)) >= static_cast<Indexing_Index__opaque> (i)->ArraySize)
             {
-              i->ArraySize = i->ArraySize*i->GrowFactor;
+              static_cast<Indexing_Index__opaque> (i)->ArraySize = static_cast<Indexing_Index__opaque> (i)->ArraySize*static_cast<Indexing_Index__opaque> (i)->GrowFactor;
             }
-          if (oldSize != i->ArraySize)
+          if (oldSize != static_cast<Indexing_Index__opaque> (i)->ArraySize)
             {
               /* 
                IF Debug
@@ -343,25 +347,25 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
                           oldSize, ArraySize)
                END ;
   */
-              Storage_REALLOCATE (&i->ArrayStart, i->ArraySize);
+              Storage_REALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
               /* and initialize the remainder of the array to NIL  */
-              b = i->ArrayStart;
+              b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
               b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+oldSize);
-              b = libc_memset (b, 0, static_cast<size_t> (i->ArraySize-oldSize));
+              b = libc_memset (b, 0, static_cast<size_t> (static_cast<Indexing_Index__opaque> (i)->ArraySize-oldSize));
             }
-          i->High = n;
+          static_cast<Indexing_Index__opaque> (i)->High = n;
         }
     }
-  b = i->ArrayStart;
-  b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-i->Low)*sizeof (void *));
+  b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
+  b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *));
   p = static_cast<PutIndice__T1> (b);
-  (*p) = reinterpret_cast<unsigned int *> (a);
-  i->Used += 1;
-  if (i->Debug)
+  (*p) = static_cast<unsigned int *> (a);
+  static_cast<Indexing_Index__opaque> (i)->Used += 1;
+  if (static_cast<Indexing_Index__opaque> (i)->Debug)
     {
       if (n < 32)
         {
-          i->Map |= (1 << (n ));
+          static_cast<Indexing_Index__opaque> (i)->Map |= (1 << (n ));
         }
     }
 }
@@ -381,12 +385,12 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n)
       M2RTS_HALT (-1);
       __builtin_unreachable ();
     }
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  b += (n-i->Low)*sizeof (void *);
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  b += (n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *);
   p = (Indexing_PtrToAddress) (b);
-  if (i->Debug)
+  if (static_cast<Indexing_Index__opaque> (i)->Debug)
     {
-      if (((n < 32) && (! ((((1 << (n)) & (i->Map)) != 0)))) && ((*p) != NULL))
+      if (((n < 32) && (! ((((1 << (n)) & (static_cast<Indexing_Index__opaque> (i)->Map)) != 0)))) && ((*p) != NULL))
         {
           M2RTS_HALT (-1);
           __builtin_unreachable ();
@@ -408,9 +412,9 @@ extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
   Indexing_PtrToByte b;
   Indexing_PtrToAddress p;
 
-  j = i->Low;
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  while (j <= i->High)
+  j = static_cast<Indexing_Index__opaque> (i)->Low;
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  while (j <= static_cast<Indexing_Index__opaque> (i)->High)
     {
       p = (Indexing_PtrToAddress) (b);
       if ((*p) == a)
@@ -437,9 +441,9 @@ extern "C" void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a)
   Indexing_PtrToAddress p;
   Indexing_PtrToByte b;
 
-  j = i->Low;
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  while (j <= i->High)
+  j = static_cast<Indexing_Index__opaque> (i)->Low;
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  while (j <= static_cast<Indexing_Index__opaque> (i)->High)
     {
       p = (Indexing_PtrToAddress) (b);
       b += sizeof (void *);
@@ -463,13 +467,13 @@ extern "C" void Indexing_DeleteIndice (Indexing_Index i, unsigned int j)
 
   if (Indexing_InBounds (i, j))
     {
-      b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-      b += sizeof (void *)*(j-i->Low);
+      b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+      b += sizeof (void *)*(j-static_cast<Indexing_Index__opaque> (i)->Low);
       p = (Indexing_PtrToAddress) (b);
       b += sizeof (void *);
-      p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((i->High-j)*sizeof (void *))));
-      i->High -= 1;
-      i->Used -= 1;
+      p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast <void *> (p), reinterpret_cast <void *> (b), static_cast<size_t> ((static_cast<Indexing_Index__opaque> (i)->High-j)*sizeof (void *))));
+      static_cast<Indexing_Index__opaque> (i)->High -= 1;
+      static_cast<Indexing_Index__opaque> (i)->Used -= 1;
     }
   else
     {
@@ -489,7 +493,7 @@ extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a)
   if (! (Indexing_IsIndiceInIndex (i, a)))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (i->Used == 0)
+      if (static_cast<Indexing_Index__opaque> (i)->Used == 0)
         {
           Indexing_PutIndice (i, Indexing_LowIndice (i), a);
         }
@@ -524,7 +528,36 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
 
 extern "C" bool Indexing_IsEmpty (Indexing_Index i)
 {
-  return i->Used == 0;
+  return static_cast<Indexing_Index__opaque> (i)->Used == 0;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
+
+/*
+   FindIndice - returns the indice containing a.
+                It returns zero if a is not found in array i.
+*/
+
+extern "C" unsigned int Indexing_FindIndice (Indexing_Index i, void * a)
+{
+  unsigned int j;
+  Indexing_PtrToAddress p;
+  Indexing_PtrToByte b;
+
+  j = static_cast<Indexing_Index__opaque> (i)->Low;
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  while (j <= static_cast<Indexing_Index__opaque> (i)->High)
+    {
+      p = (Indexing_PtrToAddress) (b);
+      b += sizeof (void *);
+      if ((*p) == a)
+        {
+          return j;
+        }
+      j += 1;
+    }
+  return 0;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
diff --git a/gcc/m2/pge-boot/GIndexing.h b/gcc/m2/pge-boot/GIndexing.h
index d65e8bd91dd..264e60ef4cf 100644
--- a/gcc/m2/pge-boot/GIndexing.h
+++ b/gcc/m2/pge-boot/GIndexing.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Indexing_H)
 #   define _Indexing_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
@@ -154,6 +155,13 @@ EXTERN void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexPro
 */
 
 EXTERN bool Indexing_IsEmpty (Indexing_Index i);
+
+/*
+   FindIndice - returns the indice containing a.
+                It returns zero if a is not found in array i.
+*/
+
+EXTERN unsigned int Indexing_FindIndice (Indexing_Index i, void * a);
 #   ifdef __cplusplus
 }
 #   endif
diff --git a/gcc/m2/pge-boot/GLists.cc b/gcc/m2/pge-boot/GLists.cc
index 4b15e2068f8..0b5d9538790 100644
--- a/gcc/m2/pge-boot/GLists.cc
+++ b/gcc/m2/pge-boot/GLists.cc
@@ -41,9 +41,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _Lists_H
 #define _Lists_C
 
+#include "GLists.h"
 #   include "GStorage.h"
 
 typedef struct SymbolKey_PerformOperation_p SymbolKey_PerformOperation;
@@ -53,16 +53,13 @@ typedef struct Lists_list_r Lists_list;
 
 typedef struct Lists__T1_a Lists__T1;
 
-typedef Lists_list *Lists_List;
-
-typedef void (*SymbolKey_PerformOperation_t) (unsigned int);
-struct SymbolKey_PerformOperation_p { SymbolKey_PerformOperation_t proc; };
+typedef Lists_list *Lists_List__opaque;
 
 struct Lists__T1_a { unsigned int array[MaxNoOfElements-1+1]; };
 struct Lists_list_r {
                       unsigned int NoOfElements;
                       Lists__T1 Elements;
-                      Lists_List Next;
+                      Lists_List__opaque Next;
                     };
 
 
@@ -136,14 +133,14 @@ extern "C" Lists_List Lists_DuplicateList (Lists_List l);
    RemoveItem - remove an element at index, i, from the list data type.
 */
 
-static void RemoveItem (Lists_List p, Lists_List l, unsigned int i);
+static void RemoveItem (Lists_List__opaque p, Lists_List__opaque l, unsigned int i);
 
 
 /*
    RemoveItem - remove an element at index, i, from the list data type.
 */
 
-static void RemoveItem (Lists_List p, Lists_List l, unsigned int i)
+static void RemoveItem (Lists_List__opaque p, Lists_List__opaque l, unsigned int i)
 {
   l->NoOfElements -= 1;
   while (i <= l->NoOfElements)
@@ -166,8 +163,8 @@ static void RemoveItem (Lists_List p, Lists_List l, unsigned int i)
 extern "C" void Lists_InitList (Lists_List *l)
 {
   Storage_ALLOCATE ((void **) &(*l), sizeof (Lists_list));
-  (*l)->NoOfElements = 0;
-  (*l)->Next = NULL;
+  static_cast<Lists_List__opaque> ((*l))->NoOfElements = 0;
+  static_cast<Lists_List__opaque> ((*l))->Next = static_cast<Lists_List__opaque> (NULL);
 }
 
 
@@ -179,9 +176,9 @@ extern "C" void Lists_KillList (Lists_List *l)
 {
   if ((*l) != NULL)
     {
-      if ((*l)->Next != NULL)
+      if (static_cast<Lists_List__opaque> ((*l))->Next != NULL)
         {
-          Lists_KillList (&(*l)->Next);
+          Lists_KillList (reinterpret_cast<Lists_List *> (&static_cast<Lists_List__opaque> ((*l))->Next));
         }
       Storage_DEALLOCATE ((void **) &(*l), sizeof (Lists_list));
     }
@@ -194,21 +191,21 @@ extern "C" void Lists_KillList (Lists_List *l)
 
 extern "C" void Lists_PutItemIntoList (Lists_List l, unsigned int c)
 {
-  if (l->NoOfElements < MaxNoOfElements)
+  if (static_cast<Lists_List__opaque> (l)->NoOfElements < MaxNoOfElements)
     {
-      l->NoOfElements += 1;
-      l->Elements.array[l->NoOfElements-1] = c;
+      static_cast<Lists_List__opaque> (l)->NoOfElements += 1;
+      static_cast<Lists_List__opaque> (l)->Elements.array[static_cast<Lists_List__opaque> (l)->NoOfElements-1] = c;
     }
-  else if (l->Next != NULL)
+  else if (static_cast<Lists_List__opaque> (l)->Next != NULL)
     {
       /* avoid dangling else.  */
-      Lists_PutItemIntoList (l->Next, c);
+      Lists_PutItemIntoList (static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next), c);
     }
   else
     {
       /* avoid dangling else.  */
-      Lists_InitList (&l->Next);
-      Lists_PutItemIntoList (l->Next, c);
+      Lists_InitList (reinterpret_cast<Lists_List *> (&static_cast<Lists_List__opaque> (l)->Next));
+      Lists_PutItemIntoList (static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next), c);
     }
 }
 
@@ -217,15 +214,15 @@ extern "C" unsigned int Lists_GetItemFromList (Lists_List l, unsigned int n)
   /* iterative solution  */
   while (l != NULL)
     {
-      if (n <= l->NoOfElements)
+      if (n <= static_cast<Lists_List__opaque> (l)->NoOfElements)
         {
-          return l->Elements.array[n-1];
+          return static_cast<Lists_List__opaque> (l)->Elements.array[n-1];
         }
       else
         {
-          n -= l->NoOfElements;
+          n -= static_cast<Lists_List__opaque> (l)->NoOfElements;
         }
-      l = l->Next;
+      l = static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next);
     }
   return static_cast<unsigned int> (0);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -250,9 +247,9 @@ extern "C" unsigned int Lists_GetIndexOfList (Lists_List l, unsigned int c)
   else
     {
       i = 1;
-      while (i <= l->NoOfElements)
+      while (i <= static_cast<Lists_List__opaque> (l)->NoOfElements)
         {
-          if (l->Elements.array[i-1] == c)
+          if (static_cast<Lists_List__opaque> (l)->Elements.array[i-1] == c)
             {
               return i;
             }
@@ -261,7 +258,7 @@ extern "C" unsigned int Lists_GetIndexOfList (Lists_List l, unsigned int c)
               i += 1;
             }
         }
-      return l->NoOfElements+(Lists_GetIndexOfList (l->Next, c));
+      return static_cast<Lists_List__opaque> (l)->NoOfElements+(Lists_GetIndexOfList (static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next), c));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -285,8 +282,8 @@ extern "C" unsigned int Lists_NoOfItemsInList (Lists_List l)
     {
       t = 0;
       do {
-        t += l->NoOfElements;
-        l = l->Next;
+        t += static_cast<Lists_List__opaque> (l)->NoOfElements;
+        l = static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next);
       } while (! (l == NULL));
       return t;
     }
@@ -316,33 +313,33 @@ extern "C" void Lists_IncludeItemIntoList (Lists_List l, unsigned int c)
 
 extern "C" void Lists_RemoveItemFromList (Lists_List l, unsigned int c)
 {
-  Lists_List p;
+  Lists_List__opaque p;
   unsigned int i;
   bool Found;
 
   if (l != NULL)
     {
       Found = false;
-      p = NULL;
+      p = static_cast<Lists_List__opaque> (NULL);
       do {
         i = 1;
-        while ((i <= l->NoOfElements) && (l->Elements.array[i-1] != c))
+        while ((i <= static_cast<Lists_List__opaque> (l)->NoOfElements) && (static_cast<Lists_List__opaque> (l)->Elements.array[i-1] != c))
           {
             i += 1;
           }
-        if ((i <= l->NoOfElements) && (l->Elements.array[i-1] == c))
+        if ((i <= static_cast<Lists_List__opaque> (l)->NoOfElements) && (static_cast<Lists_List__opaque> (l)->Elements.array[i-1] == c))
           {
             Found = true;
           }
         else
           {
-            p = l;
-            l = l->Next;
+            p = static_cast<Lists_List__opaque> (l);
+            l = static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next);
           }
       } while (! ((l == NULL) || Found));
       if (Found)
         {
-          RemoveItem (p, l, i);
+          RemoveItem (p, static_cast<Lists_List__opaque> (l), i);
         }
     }
 }
@@ -358,9 +355,9 @@ extern "C" bool Lists_IsItemInList (Lists_List l, unsigned int c)
 
   do {
     i = 1;
-    while (i <= l->NoOfElements)
+    while (i <= static_cast<Lists_List__opaque> (l)->NoOfElements)
       {
-        if (l->Elements.array[i-1] == c)
+        if (static_cast<Lists_List__opaque> (l)->Elements.array[i-1] == c)
           {
             return true;
           }
@@ -369,7 +366,7 @@ extern "C" bool Lists_IsItemInList (Lists_List l, unsigned int c)
             i += 1;
           }
       }
-    l = l->Next;
+    l = static_cast<Lists_List> (static_cast<Lists_List__opaque> (l)->Next);
   } while (! (l == NULL));
   return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -402,19 +399,19 @@ extern "C" void Lists_ForeachItemInListDo (Lists_List l, SymbolKey_PerformOperat
 
 extern "C" Lists_List Lists_DuplicateList (Lists_List l)
 {
-  Lists_List m;
+  Lists_List__opaque m;
   unsigned int n;
   unsigned int i;
 
-  Lists_InitList (&m);
+  Lists_InitList (reinterpret_cast<Lists_List *> (&m));
   n = Lists_NoOfItemsInList (l);
   i = 1;
   while (i <= n)
     {
-      Lists_PutItemIntoList (m, Lists_GetItemFromList (l, i));
+      Lists_PutItemIntoList (static_cast<Lists_List> (m), Lists_GetItemFromList (l, i));
       i += 1;
     }
-  return m;
+  return static_cast<Lists_List> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
diff --git a/gcc/m2/pge-boot/GLists.h b/gcc/m2/pge-boot/GLists.h
index e9680057328..0d92571444e 100644
--- a/gcc/m2/pge-boot/GLists.h
+++ b/gcc/m2/pge-boot/GLists.h
@@ -24,8 +24,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_Lists_H)
 #   define _Lists_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GM2Dependent.cc b/gcc/m2/pge-boot/GM2Dependent.cc
index 89c80832889..6a71ac9a9e2 100644
--- a/gcc/m2/pge-boot/GM2Dependent.cc
+++ b/gcc/m2/pge-boot/GM2Dependent.cc
@@ -50,9 +50,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _M2Dependent_H
 #define _M2Dependent_C
 
+#include "GM2Dependent.h"
 #   include "Glibc.h"
 #   include "GASCII.h"
 #   include "GSYSTEM.h"
@@ -79,9 +79,6 @@ typedef struct M2Dependent__T4_a M2Dependent__T4;
 
 typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
 
-typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
-struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
-
 struct M2Dependent_DependencyList_r {
                                       PROC proc;
                                       bool forced;
@@ -641,11 +638,11 @@ static void toCString (char *str, unsigned int _str_high)
         {
           if (str[i+1] == 'n')
             {
-              str[i] = ASCII_nl;
+              const_cast<char *>(str)[i] = ASCII_nl;
               j = i+1;
               while (j < high)
                 {
-                  str[j] = str[j+1];
+                  const_cast<char *>(str)[j] = str[j+1];
                   j += 1;
                 }
             }
@@ -965,7 +962,7 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *de
 
   if (Modules.array[state-M2Dependent_unregistered] != NULL)
     {
-      libc_printf ((const char *) "%s modules\\n", 12, &desc);
+      libc_printf ((const char *) "%s modules\\n", 12, const_cast<void*> (static_cast<const void*>(desc)));
       mptr = Modules.array[state-M2Dependent_unregistered];
       count = 0;
       do {
@@ -1214,7 +1211,7 @@ static bool equal (void * cstr, const char *str_, unsigned int _str_high)
   /* make a local copy of each unbounded array.  */
   memcpy (str, str_, _str_high+1);
 
-  return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
+  return (strncmp (reinterpret_cast <M2Dependent_PtrToChar> (cstr), reinterpret_cast <M2Dependent_PtrToChar> (const_cast<void*> (static_cast<const void*>(str))), StrLib_StrLen ((const char *) str, _str_high))) == 0;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1252,7 +1249,7 @@ static void SetupDebugFlags (void)
   ForceTrace = false;
   HexTrace = false;
   WarningTrace = false;
-  pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG"))));
+  pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (static_cast<const void*>("GCC_M2LINK_RTFLAG"))));
   while ((pc != NULL) && ((*pc) != ASCII_nul))
     {
       if (equal (reinterpret_cast <void *> (pc), (const char *) "all", 3))
diff --git a/gcc/m2/pge-boot/GM2Dependent.h b/gcc/m2/pge-boot/GM2Dependent.h
index 0353236f8c1..29c61f69509 100644
--- a/gcc/m2/pge-boot/GM2Dependent.h
+++ b/gcc/m2/pge-boot/GM2Dependent.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2Dependent_H)
 #   define _M2Dependent_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GM2EXCEPTION.cc b/gcc/m2/pge-boot/GM2EXCEPTION.cc
index 274f29a9553..d4f4327fa09 100644
--- a/gcc/m2/pge-boot/GM2EXCEPTION.cc
+++ b/gcc/m2/pge-boot/GM2EXCEPTION.cc
@@ -34,14 +34,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <limits.h>
 #   include "Gmcrts.h"
-#define _M2EXCEPTION_H
 #define _M2EXCEPTION_C
 
+#include "GM2EXCEPTION.h"
 #   include "GSYSTEM.h"
 #   include "GRTExceptions.h"
 
-typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
-
 extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
 extern "C" bool M2EXCEPTION_IsM2Exception (void);
 
@@ -57,7 +55,7 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
   n = RTExceptions_GetNumber (e);
   if (n == (UINT_MAX))
     {
-      RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
+      RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (static_cast<const void*>("M2Exception")), const_cast<void*> (static_cast<const void*>("current coroutine is not in the exceptional execution state")));
     }
   else
     {
diff --git a/gcc/m2/pge-boot/GM2EXCEPTION.h b/gcc/m2/pge-boot/GM2EXCEPTION.h
index 4ee5404733c..5fd59cfa0a6 100644
--- a/gcc/m2/pge-boot/GM2EXCEPTION.h
+++ b/gcc/m2/pge-boot/GM2EXCEPTION.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2EXCEPTION_H)
 #   define _M2EXCEPTION_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GM2RTS.cc b/gcc/m2/pge-boot/GM2RTS.cc
index ef5f7cf5ce1..761bb824b37 100644
--- a/gcc/m2/pge-boot/GM2RTS.cc
+++ b/gcc/m2/pge-boot/GM2RTS.cc
@@ -25,8 +25,6 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-#include "system.h"
 #include <stdbool.h>
 #   if !defined (PROC_D)
 #      define PROC_D
@@ -42,6 +40,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
+#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
 #define _M2RTS_C
 
 #include "GM2RTS.h"
@@ -133,7 +135,7 @@ extern "C" void M2RTS_ExecuteTerminationProcedures (void);
                not call ExecuteTerminationProcedures.
 */
 
-extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn));
+extern "C" void M2RTS_Terminate (void);
 
 /*
    HALT - terminate the current program.  The procedure
@@ -146,7 +148,7 @@ extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn));
           then calling HALT with no parameter.
 */
 
-extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn));
+extern "C" void M2RTS_HALT (int exitcode);
 
 /*
    Halt - provides a more user friendly version of HALT, which takes
@@ -154,7 +156,7 @@ extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn));
           to stderr and calls exit (1).
 */
 
-extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line) __attribute__ ((noreturn));
+extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line);
 
 /*
    HaltC - provides a more user friendly version of HALT, which takes
@@ -162,7 +164,7 @@ extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_
            to stderr and calls exit (1).
 */
 
-extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn));
+extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line);
 
 /*
    ExitOnHalt - if HALT is executed then call exit with the exit code, e.
@@ -174,7 +176,7 @@ extern "C" void M2RTS_ExitOnHalt (int e);
    ErrorMessage - emits an error message to stderr and then calls exit (1).
 */
 
-extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn));
+extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high);
 
 /*
    Length - returns the length of a string, a. This is called whenever
@@ -183,30 +185,30 @@ extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_
 */
 
 extern "C" unsigned int M2RTS_Length (const char *a_, unsigned int _a_high);
-extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
+extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
+extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
 
 /*
    ErrorString - writes a string to stderr.
@@ -224,7 +226,7 @@ static void ErrorStringC (void * str);
    ErrorMessageC - emits an error message to stderr and then calls exit (1).
 */
 
-static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn));
+static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function);
 
 /*
    Init - initialize the initial, terminate procedure lists and booleans.
diff --git a/gcc/m2/pge-boot/GM2RTS.h b/gcc/m2/pge-boot/GM2RTS.h
index 055cc95675b..df0367808be 100644
--- a/gcc/m2/pge-boot/GM2RTS.h
+++ b/gcc/m2/pge-boot/GM2RTS.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_M2RTS_H)
 #   define _M2RTS_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GNameKey.cc b/gcc/m2/pge-boot/GNameKey.cc
index 52b90a03cf6..8d955346502 100644
--- a/gcc/m2/pge-boot/GNameKey.cc
+++ b/gcc/m2/pge-boot/GNameKey.cc
@@ -44,9 +44,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _NameKey_H
 #define _NameKey_C
 
+#include "GNameKey.h"
 #   include "GSYSTEM.h"
 #   include "GStorage.h"
 #   include "GIndexing.h"
@@ -401,13 +401,13 @@ extern "C" void NameKey_GetKey (NameKey_Name key, char *a, unsigned int _a_high)
   higha = _a_high;
   while (((p != NULL) && (i <= higha)) && ((*p) != ASCII_nul))
     {
-      a[i] = (*p);
+      const_cast<char *>(a)[i] = (*p);
       p += 1;
       i += 1;
     }
   if (i <= higha)
     {
-      a[i] = ASCII_nul;
+      const_cast<char *>(a)[i] = ASCII_nul;
     }
 }
 
diff --git a/gcc/m2/pge-boot/GNameKey.h b/gcc/m2/pge-boot/GNameKey.h
index bb003f79d38..fc80892eaca 100644
--- a/gcc/m2/pge-boot/GNameKey.h
+++ b/gcc/m2/pge-boot/GNameKey.h
@@ -24,8 +24,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_NameKey_H)
 #   define _NameKey_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GNumberIO.cc b/gcc/m2/pge-boot/GNumberIO.cc
index 04e9d3cb084..493e500257c 100644
--- a/gcc/m2/pge-boot/GNumberIO.cc
+++ b/gcc/m2/pge-boot/GNumberIO.cc
@@ -43,9 +43,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <string.h>
 #include <limits.h>
 #include <stdlib.h>
-#define _NumberIO_H
 #define _NumberIO_C
 
+#include "GNumberIO.h"
 #   include "GASCII.h"
 #   include "GStrIO.h"
 #   include "GStrLib.h"
@@ -173,19 +173,19 @@ extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, uns
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -271,7 +271,7 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = '0';
+      const_cast<char *>(a)[j] = '0';
       j += 1;
       n -= 1;
     }
@@ -279,18 +279,18 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
     {
       if (buf.array[i-1] < 10)
         {
-          a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+          const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
         }
       else
         {
-          a[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
+          const_cast<char *>(a)[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
         }
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -350,24 +350,24 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   if (Negative)
     {
-      a[j] = '-';
+      const_cast<char *>(a)[j] = '-';
       j += 1;
     }
   while ((i != 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -491,19 +491,19 @@ extern "C" void NumberIO_OctToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -568,19 +568,19 @@ extern "C" void NumberIO_BinToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
diff --git a/gcc/m2/pge-boot/GNumberIO.h b/gcc/m2/pge-boot/GNumberIO.h
index 34aee337383..3da6f1aa971 100644
--- a/gcc/m2/pge-boot/GNumberIO.h
+++ b/gcc/m2/pge-boot/GNumberIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_NumberIO_H)
 #   define _NumberIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GOutput.cc b/gcc/m2/pge-boot/GOutput.cc
index f6d85004899..bb774db5dc8 100644
--- a/gcc/m2/pge-boot/GOutput.cc
+++ b/gcc/m2/pge-boot/GOutput.cc
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _Output_H
 #define _Output_C
 
+#include "GOutput.h"
 #   include "GFIO.h"
 #   include "GSFIO.h"
 #   include "GStrLib.h"
diff --git a/gcc/m2/pge-boot/GOutput.h b/gcc/m2/pge-boot/GOutput.h
index 79feda8f790..c95c77d5164 100644
--- a/gcc/m2/pge-boot/GOutput.h
+++ b/gcc/m2/pge-boot/GOutput.h
@@ -24,8 +24,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_Output_H)
 #   define _Output_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GPushBackInput.cc b/gcc/m2/pge-boot/GPushBackInput.cc
index 6fb0fbea9d3..849ffddd6ac 100644
--- a/gcc/m2/pge-boot/GPushBackInput.cc
+++ b/gcc/m2/pge-boot/GPushBackInput.cc
@@ -43,9 +43,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _PushBackInput_H
 #define _PushBackInput_C
 
+#include "GPushBackInput.h"
 #   include "GFIO.h"
 #   include "GDynamicStrings.h"
 #   include "GASCII.h"
diff --git a/gcc/m2/pge-boot/GPushBackInput.h b/gcc/m2/pge-boot/GPushBackInput.h
index 076b99657a0..7b441796c8e 100644
--- a/gcc/m2/pge-boot/GPushBackInput.h
+++ b/gcc/m2/pge-boot/GPushBackInput.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_PushBackInput_H)
 #   define _PushBackInput_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GRTExceptions.cc b/gcc/m2/pge-boot/GRTExceptions.cc
index 2b6557eb7be..b390863b1da 100644
--- a/gcc/m2/pge-boot/GRTExceptions.cc
+++ b/gcc/m2/pge-boot/GRTExceptions.cc
@@ -50,9 +50,9 @@ extern void throw (unsigned int);
 #   undef NULL
 #   define NULL 0
 #endif
-#define _RTExceptions_H
 #define _RTExceptions_C
 
+#include "GRTExceptions.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
 #   include "GStorage.h"
@@ -75,17 +75,14 @@ typedef struct RTExceptions__T3_r RTExceptions__T3;
 
 typedef RTExceptions__T3 *RTExceptions_Handler;
 
-typedef RTExceptions__T1 *RTExceptions_EHBlock;
-
-typedef void (*RTExceptions_ProcedureHandler_t) (void);
-struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
+typedef RTExceptions__T1 *RTExceptions_EHBlock__opaque;
 
 struct RTExceptions__T2_a { char array[MaxBuffer+1]; };
 struct RTExceptions__T1_r {
                             RTExceptions__T2 buffer;
                             unsigned int number;
                             RTExceptions_Handler handlers;
-                            RTExceptions_EHBlock right;
+                            RTExceptions_EHBlock__opaque right;
                           };
 
 struct RTExceptions__T3_r {
@@ -98,8 +95,8 @@ struct RTExceptions__T3_r {
 
 static bool inException;
 static RTExceptions_Handler freeHandler;
-static RTExceptions_EHBlock freeEHB;
-static RTExceptions_EHBlock currentEHB;
+static RTExceptions_EHBlock__opaque freeEHB;
+static RTExceptions_EHBlock__opaque currentEHB;
 static void * currentSource;
 
 /*
@@ -236,7 +233,7 @@ static void ErrorString (const char *a_, unsigned int _a_high);
    findHandler -
 */
 
-static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number);
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number);
 
 /*
    InvokeHandler - invokes the associated handler for the current
@@ -289,7 +286,7 @@ static void addNum (unsigned int n, unsigned int *i);
    New - returns a new EHBlock.
 */
 
-static RTExceptions_EHBlock New (void);
+static RTExceptions_EHBlock__opaque New (void);
 
 /*
    NewHandler - returns a new handler.
@@ -325,7 +322,7 @@ static void SubHandler (RTExceptions_Handler h);
    AddHandler - add, e, to the end of the list of handlers.
 */
 
-static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h);
+static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h);
 
 /*
    indexf - raise an index out of bounds exception.
@@ -442,7 +439,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  n = static_cast<int> (libc_write (2, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
+  n = static_cast<int> (libc_write (2, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
 }
 
 
@@ -450,7 +447,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
    findHandler -
 */
 
-static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number)
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number)
 {
   RTExceptions_Handler h;
 
@@ -543,7 +540,7 @@ static void * stripPath (void * s)
           p += 1;
         }
     }
-  return reinterpret_cast<void *> (f);
+  return static_cast<void *> (f);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -608,9 +605,9 @@ static void addNum (unsigned int n, unsigned int *i)
    New - returns a new EHBlock.
 */
 
-static RTExceptions_EHBlock New (void)
+static RTExceptions_EHBlock__opaque New (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   if (freeEHB == NULL)
     {
@@ -710,7 +707,7 @@ static void SubHandler (RTExceptions_Handler h)
    AddHandler - add, e, to the end of the list of handlers.
 */
 
-static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
+static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h)
 {
   h->right = e->handlers;
   h->left = e->handlers->left;
@@ -725,7 +722,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
 
 static void indexf (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (reinterpret_cast<const void*>("indexf")), const_cast<void*> (reinterpret_cast<const void*>("array index out of bounds")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (static_cast<const void*>("indexf")), const_cast<void*> (static_cast<const void*>("array index out of bounds")));
 }
 
 
@@ -735,7 +732,7 @@ static void indexf (void * a)
 
 static void range (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (reinterpret_cast<const void*>("range")), const_cast<void*> (reinterpret_cast<const void*>("assignment out of range")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (static_cast<const void*>("range")), const_cast<void*> (static_cast<const void*>("assignment out of range")));
 }
 
 
@@ -745,7 +742,7 @@ static void range (void * a)
 
 static void casef (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (reinterpret_cast<const void*>("casef")), const_cast<void*> (reinterpret_cast<const void*>("case selector out of range")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (static_cast<const void*>("casef")), const_cast<void*> (static_cast<const void*>("case selector out of range")));
 }
 
 
@@ -755,7 +752,7 @@ static void casef (void * a)
 
 static void invalidloc (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (reinterpret_cast<const void*>("invalidloc")), const_cast<void*> (reinterpret_cast<const void*>("invalid address referenced")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (static_cast<const void*>("invalidloc")), const_cast<void*> (static_cast<const void*>("invalid address referenced")));
 }
 
 
@@ -765,7 +762,7 @@ static void invalidloc (void * a)
 
 static void function (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (reinterpret_cast<const void*>("function")), const_cast<void*> (reinterpret_cast<const void*>("... function ... ")));  /* --fixme-- what has happened ?  */
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (static_cast<const void*>("function")), const_cast<void*> (static_cast<const void*>("... function ... ")));  /* --fixme-- what has happened ?  */
 }
 
 
@@ -775,7 +772,7 @@ static void function (void * a)
 
 static void wholevalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (reinterpret_cast<const void*>("wholevalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (static_cast<const void*>("wholevalue")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
 }
 
 
@@ -785,7 +782,7 @@ static void wholevalue (void * a)
 
 static void wholediv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (reinterpret_cast<const void*>("wholediv")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (static_cast<const void*>("wholediv")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
 }
 
 
@@ -795,7 +792,7 @@ static void wholediv (void * a)
 
 static void realvalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (reinterpret_cast<const void*>("realvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal real value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (static_cast<const void*>("realvalue")), const_cast<void*> (static_cast<const void*>("illegal real value exception")));
 }
 
 
@@ -805,7 +802,7 @@ static void realvalue (void * a)
 
 static void realdiv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (reinterpret_cast<const void*>("realdiv")), const_cast<void*> (reinterpret_cast<const void*>("real number division by zero exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (static_cast<const void*>("realdiv")), const_cast<void*> (static_cast<const void*>("real number division by zero exception")));
 }
 
 
@@ -815,7 +812,7 @@ static void realdiv (void * a)
 
 static void complexvalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (reinterpret_cast<const void*>("complexvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal complex value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (static_cast<const void*>("complexvalue")), const_cast<void*> (static_cast<const void*>("illegal complex value exception")));
 }
 
 
@@ -825,7 +822,7 @@ static void complexvalue (void * a)
 
 static void complexdiv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (reinterpret_cast<const void*>("complexdiv")), const_cast<void*> (reinterpret_cast<const void*>("complex number division by zero exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (static_cast<const void*>("complexdiv")), const_cast<void*> (static_cast<const void*>("complex number division by zero exception")));
 }
 
 
@@ -835,7 +832,7 @@ static void complexdiv (void * a)
 
 static void protection (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (static_cast<const void*>("protection")), const_cast<void*> (static_cast<const void*>("protection exception")));
 }
 
 
@@ -845,7 +842,7 @@ static void protection (void * a)
 
 static void systemf (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (static_cast<const void*>("systemf")), const_cast<void*> (static_cast<const void*>("system exception")));
 }
 
 
@@ -855,7 +852,7 @@ static void systemf (void * a)
 
 static void coroutine (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (static_cast<const void*>("coroutine")), const_cast<void*> (static_cast<const void*>("coroutine exception")));
 }
 
 
@@ -865,7 +862,7 @@ static void coroutine (void * a)
 
 static void exception (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (static_cast<const void*>("exception")), const_cast<void*> (static_cast<const void*>("exception exception")));
 }
 
 
@@ -877,8 +874,8 @@ static void Init (void)
 {
   inException = false;
   freeHandler = NULL;
-  freeEHB = NULL;
-  currentEHB = RTExceptions_InitExceptionBlock ();
+  freeEHB = static_cast<RTExceptions_EHBlock__opaque> (NULL);
+  currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_InitExceptionBlock ());
   currentSource = NULL;
   RTExceptions_BaseExceptionsThrow ();
   SysExceptions_InitExceptionHandlers ((SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) indexf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) range}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) casef}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) invalidloc}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) function}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholevalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholediv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) protection}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) systemf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) coroutine}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) exception});
@@ -892,11 +889,11 @@ static void Init (void)
 static void TidyUp (void)
 {
   RTExceptions_Handler f;
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   if (currentEHB != NULL)
     {
-      currentEHB = RTExceptions_KillExceptionBlock (currentEHB);
+      currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_KillExceptionBlock (static_cast<RTExceptions_EHBlock> (currentEHB)));
     }
   while (freeHandler != NULL)
     {
@@ -956,7 +953,7 @@ extern "C" void RTExceptions_Raise (unsigned int number, void * file, unsigned i
 
 extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
 {
-  currentEHB = source;
+  currentEHB = static_cast<RTExceptions_EHBlock__opaque> (source);
 }
 
 
@@ -966,7 +963,7 @@ extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
 
 extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
 {
-  return currentEHB;
+  return static_cast<RTExceptions_EHBlock> (currentEHB);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -978,7 +975,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
 
 extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
 {
-  return &e->buffer;
+  return &static_cast<RTExceptions_EHBlock__opaque> (e)->buffer;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -990,7 +987,7 @@ extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
 
 extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
 {
-  return sizeof (e->buffer);
+  return sizeof (static_cast<RTExceptions_EHBlock__opaque> (e)->buffer);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1003,7 +1000,7 @@ extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
 
 extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
 {
-  return source->number;
+  return static_cast<RTExceptions_EHBlock__opaque> (source)->number;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1015,7 +1012,7 @@ extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
 
 extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   e = New ();
   e->number = UINT_MAX;
@@ -1023,7 +1020,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
   e->handlers->right = e->handlers;  /* add the dummy onto the head  */
   e->handlers->left = e->handlers;
   e->right = e;
-  return e;
+  return static_cast<RTExceptions_EHBlock> (e);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1035,10 +1032,10 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
 
 extern "C" RTExceptions_EHBlock RTExceptions_KillExceptionBlock (RTExceptions_EHBlock e)
 {
-  e->handlers = KillHandlers (e->handlers);
-  e->right = freeEHB;
-  freeEHB = e;
-  return NULL;
+  static_cast<RTExceptions_EHBlock__opaque> (e)->handlers = KillHandlers (static_cast<RTExceptions_EHBlock__opaque> (e)->handlers);
+  static_cast<RTExceptions_EHBlock__opaque> (e)->right = freeEHB;
+  freeEHB = static_cast<RTExceptions_EHBlock__opaque> (e);
+  return static_cast<RTExceptions_EHBlock> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1053,7 +1050,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
   RTExceptions_Handler h;
   RTExceptions_Handler i;
 
-  h = findHandler (e, number);
+  h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
   if (h == NULL)
     {
       i = InitHandler (NewHandler (), NULL, NULL, NULL, number, p);
@@ -1066,7 +1063,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
       i = InitHandler (NewHandler (), NULL, NULL, h, number, p);
     }
   /* add new handler  */
-  AddHandler (e, i);
+  AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), i);
 }
 
 
@@ -1079,14 +1076,14 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
 {
   RTExceptions_Handler h;
 
-  h = findHandler (e, number);
+  h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
   if (h != NULL)
     {
       /* remove, h,  */
       SubHandler (h);
       if (h->stack != NULL)
         {
-          AddHandler (e, h->stack);
+          AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), h->stack);
         }
       h = KillHandler (h);
     }
@@ -1101,11 +1098,11 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
 
 extern "C" void RTExceptions_DefaultErrorCatch (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
   int n;
 
-  e = RTExceptions_GetExceptionBlock ();
-  n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (e), libc_strlen (RTExceptions_GetTextBuffer (e))));
+  e = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_GetExceptionBlock ());
+  n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)), libc_strlen (RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)))));
   M2RTS_HALT (-1);
   __builtin_unreachable ();
 }
@@ -1187,7 +1184,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void)
     }
   else
     {
-      return currentEHB;
+      return static_cast<RTExceptions_EHBlock> (currentEHB);
     }
   ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
   __builtin_unreachable ();
diff --git a/gcc/m2/pge-boot/GRTExceptions.h b/gcc/m2/pge-boot/GRTExceptions.h
index 9e188bcbad4..631a4acd4c7 100644
--- a/gcc/m2/pge-boot/GRTExceptions.h
+++ b/gcc/m2/pge-boot/GRTExceptions.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_RTExceptions_H)
 #   define _RTExceptions_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSArgs.h b/gcc/m2/pge-boot/GSArgs.h
index a7b10bf4a1f..4fe04d725e9 100644
--- a/gcc/m2/pge-boot/GSArgs.h
+++ b/gcc/m2/pge-boot/GSArgs.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SArgs_H)
 #   define _SArgs_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSEnvironment.h b/gcc/m2/pge-boot/GSEnvironment.h
index ba607238f32..ccd96b7994d 100644
--- a/gcc/m2/pge-boot/GSEnvironment.h
+++ b/gcc/m2/pge-boot/GSEnvironment.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SEnvironment_H)
 #   define _SEnvironment_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/pge-boot/GSFIO.cc b/gcc/m2/pge-boot/GSFIO.cc
index 3c0dad0bc00..882a79a2320 100644
--- a/gcc/m2/pge-boot/GSFIO.cc
+++ b/gcc/m2/pge-boot/GSFIO.cc
@@ -37,9 +37,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _SFIO_H
 #define _SFIO_C
 
+#include "GSFIO.h"
 #   include "GASCII.h"
 #   include "GDynamicStrings.h"
 #   include "GFIO.h"
diff --git a/gcc/m2/pge-boot/GSFIO.h b/gcc/m2/pge-boot/GSFIO.h
index 108d8ea79f0..2926596c7d7 100644
--- a/gcc/m2/pge-boot/GSFIO.h
+++ b/gcc/m2/pge-boot/GSFIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SFIO_H)
 #   define _SFIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSYSTEM.h b/gcc/m2/pge-boot/GSYSTEM.h
index a18a1765dc5..79f08c1868d 100644
--- a/gcc/m2/pge-boot/GSYSTEM.h
+++ b/gcc/m2/pge-boot/GSYSTEM.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SYSTEM_H)
 #   define _SYSTEM_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GScan.h b/gcc/m2/pge-boot/GScan.h
index e059cdc6473..ed3e780612b 100644
--- a/gcc/m2/pge-boot/GScan.h
+++ b/gcc/m2/pge-boot/GScan.h
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Scan_H)
 #   define _Scan_H
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #   ifdef __cplusplus
diff --git a/gcc/m2/pge-boot/GStdIO.cc b/gcc/m2/pge-boot/GStdIO.cc
index cf02566757d..23e8e84d280 100644
--- a/gcc/m2/pge-boot/GStdIO.cc
+++ b/gcc/m2/pge-boot/GStdIO.cc
@@ -33,9 +33,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   endif
 
 #   include "Gmcrts.h"
-#define _StdIO_H
 #define _StdIO_C
 
+#include "GStdIO.h"
 #   include "GIO.h"
 #   include "GM2RTS.h"
 
@@ -48,12 +48,6 @@ typedef struct StdIO__T1_a StdIO__T1;
 
 typedef struct StdIO__T2_a StdIO__T2;
 
-typedef void (*StdIO_ProcWrite_t) (char);
-struct StdIO_ProcWrite_p { StdIO_ProcWrite_t proc; };
-
-typedef void (*StdIO_ProcRead_t) (char *);
-struct StdIO_ProcRead_p { StdIO_ProcRead_t proc; };
-
 struct StdIO__T1_a { StdIO_ProcWrite array[MaxStack+1]; };
 struct StdIO__T2_a { StdIO_ProcRead array[MaxStack+1]; };
 static StdIO__T1 StackW;
diff --git a/gcc/m2/pge-boot/GStdIO.h b/gcc/m2/pge-boot/GStdIO.h
index 0a45ebc7e34..c54d009b3aa 100644
--- a/gcc/m2/pge-boot/GStdIO.h
+++ b/gcc/m2/pge-boot/GStdIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StdIO_H)
 #   define _StdIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GStorage.cc b/gcc/m2/pge-boot/GStorage.cc
index 08e878cab51..3e4ec437cca 100644
--- a/gcc/m2/pge-boot/GStorage.cc
+++ b/gcc/m2/pge-boot/GStorage.cc
@@ -32,9 +32,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Storage_H
 #define _Storage_C
 
+#include "GStorage.h"
 #   include "GSysStorage.h"
 
 extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size);
diff --git a/gcc/m2/pge-boot/GStorage.h b/gcc/m2/pge-boot/GStorage.h
index 8c26b465b2c..e07fee0a44f 100644
--- a/gcc/m2/pge-boot/GStorage.h
+++ b/gcc/m2/pge-boot/GStorage.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_Storage_H)
 #   define _Storage_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GStrCase.cc b/gcc/m2/pge-boot/GStrCase.cc
index 8ea7d3c0ce3..64e5781a921 100644
--- a/gcc/m2/pge-boot/GStrCase.cc
+++ b/gcc/m2/pge-boot/GStrCase.cc
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <string.h>
 #include <limits.h>
-#define _StrCase_H
 #define _StrCase_C
 
+#include "GStrCase.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
 
@@ -92,12 +92,12 @@ extern "C" void StrCase_StrToUpperCase (const char *a_, unsigned int _a_high, ch
   i = 0;
   while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
     {
-      b[i] = StrCase_Cap (a[i]);
+      const_cast<char *>(b)[i] = StrCase_Cap (a[i]);
       i += 1;
     }
   if (i < highb)
     {
-      b[i] = ASCII_nul;
+      const_cast<char *>(b)[i] = ASCII_nul;
     }
 }
 
@@ -122,12 +122,12 @@ extern "C" void StrCase_StrToLowerCase (const char *a_, unsigned int _a_high, ch
   i = 0;
   while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
     {
-      b[i] = StrCase_Lower (a[i]);
+      const_cast<char *>(b)[i] = StrCase_Lower (a[i]);
       i += 1;
     }
   if (i < highb)
     {
-      b[i] = ASCII_nul;
+      const_cast<char *>(b)[i] = ASCII_nul;
     }
 }
 
diff --git a/gcc/m2/pge-boot/GStrCase.h b/gcc/m2/pge-boot/GStrCase.h
index c3f064728d8..a2b1a716a3a 100644
--- a/gcc/m2/pge-boot/GStrCase.h
+++ b/gcc/m2/pge-boot/GStrCase.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrCase_H)
 #   define _StrCase_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GStrIO.cc b/gcc/m2/pge-boot/GStrIO.cc
index 1dd3922bb8a..dc6cca80729 100644
--- a/gcc/m2/pge-boot/GStrIO.cc
+++ b/gcc/m2/pge-boot/GStrIO.cc
@@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <string.h>
 #include <limits.h>
-#define _StrIO_H
 #define _StrIO_C
 
+#include "GStrIO.h"
 #   include "GASCII.h"
 #   include "GStdIO.h"
 #   include "Glibc.h"
@@ -204,16 +204,16 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
         /* avoid dangling else.  */
         if ((ch == ASCII_cr) || (ch == ASCII_lf))
           {
-            a[n] = ASCII_nul;
+            const_cast<char *>(a)[n] = ASCII_nul;
             n += 1;
           }
         else if (ch == ASCII_ff)
           {
             /* avoid dangling else.  */
-            a[0] = ch;
+            const_cast<char *>(a)[0] = ch;
             if (high > 0)
               {
-                a[1] = ASCII_nul;
+                const_cast<char *>(a)[1] = ASCII_nul;
               }
             ch = ASCII_cr;
           }
@@ -221,18 +221,18 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
           {
             /* avoid dangling else.  */
             Echo (ch);
-            a[n] = ch;
+            const_cast<char *>(a)[n] = ch;
             n += 1;
           }
         else if (ch == ASCII_eof)
           {
             /* avoid dangling else.  */
-            a[n] = ch;
+            const_cast<char *>(a)[n] = ch;
             n += 1;
             ch = ASCII_cr;
             if (n <= high)
               {
-                a[n] = ASCII_nul;
+                const_cast<char *>(a)[n] = ASCII_nul;
               }
           }
       }
diff --git a/gcc/m2/pge-boot/GStrIO.h b/gcc/m2/pge-boot/GStrIO.h
index 2ed2ac33f11..2d003c5aeeb 100644
--- a/gcc/m2/pge-boot/GStrIO.h
+++ b/gcc/m2/pge-boot/GStrIO.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrIO_H)
 #   define _StrIO_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GStrLib.cc b/gcc/m2/pge-boot/GStrLib.cc
index 4a92d1c34f8..f888ef120b1 100644
--- a/gcc/m2/pge-boot/GStrLib.cc
+++ b/gcc/m2/pge-boot/GStrLib.cc
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <string.h>
 #include <limits.h>
-#define _StrLib_H
 #define _StrLib_C
 
+#include "GStrLib.h"
 #   include "GASCII.h"
 
 
@@ -127,13 +127,13 @@ extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const ch
   j = 0;
   while ((j < Highb) && (i <= Highc))
     {
-      c[i] = b[j];
+      const_cast<char *>(c)[i] = b[j];
       i += 1;
       j += 1;
     }
   if (i <= Highc)
     {
-      c[i] = ASCII_nul;
+      const_cast<char *>(c)[i] = ASCII_nul;
     }
 }
 
@@ -247,12 +247,12 @@ extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *
   HighDest = _dest_high;
   while ((n < HighSrc) && (n <= HighDest))
     {
-      dest[n] = src[n];
+      const_cast<char *>(dest)[n] = src[n];
       n += 1;
     }
   if (n <= HighDest)
     {
-      dest[n] = ASCII_nul;
+      const_cast<char *>(dest)[n] = ASCII_nul;
     }
 }
 
@@ -328,13 +328,13 @@ extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_hig
     }
   while ((i < higha) && (j <= highb))
     {
-      b[j] = a[i];
+      const_cast<char *>(b)[j] = a[i];
       i += 1;
       j += 1;
     }
   if (j <= highb)
     {
-      b[j] = ASCII_nul;
+      const_cast<char *>(b)[j] = ASCII_nul;
     }
 }
 
diff --git a/gcc/m2/pge-boot/GStrLib.h b/gcc/m2/pge-boot/GStrLib.h
index b292d8990a1..9e81f002146 100644
--- a/gcc/m2/pge-boot/GStrLib.h
+++ b/gcc/m2/pge-boot/GStrLib.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StrLib_H)
 #   define _StrLib_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GStringConvert.h b/gcc/m2/pge-boot/GStringConvert.h
index 284eef236cc..209ec45a2be 100644
--- a/gcc/m2/pge-boot/GStringConvert.h
+++ b/gcc/m2/pge-boot/GStringConvert.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_StringConvert_H)
 #   define _StringConvert_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSymbolKey.cc b/gcc/m2/pge-boot/GSymbolKey.cc
index ec27e2c67b6..e58153240bd 100644
--- a/gcc/m2/pge-boot/GSymbolKey.cc
+++ b/gcc/m2/pge-boot/GSymbolKey.cc
@@ -20,8 +20,6 @@ You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-#include "system.h"
 #include <stdbool.h>
 #   if !defined (PROC_D)
 #      define PROC_D
@@ -33,6 +31,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #      define FALSE (1==0)
 #   endif
 
+#include <stddef.h>
 #   include "GStorage.h"
 #if defined(__cplusplus)
 #   undef NULL
diff --git a/gcc/m2/pge-boot/GSymbolKey.h b/gcc/m2/pge-boot/GSymbolKey.h
index 48be595fb02..2fb363f0081 100644
--- a/gcc/m2/pge-boot/GSymbolKey.h
+++ b/gcc/m2/pge-boot/GSymbolKey.h
@@ -24,8 +24,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_SymbolKey_H)
 #   define _SymbolKey_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSysExceptions.h b/gcc/m2/pge-boot/GSysExceptions.h
index 00dd52117d1..2cfc026b7d8 100644
--- a/gcc/m2/pge-boot/GSysExceptions.h
+++ b/gcc/m2/pge-boot/GSysExceptions.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SysExceptions_H)
 #   define _SysExceptions_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GSysStorage.cc b/gcc/m2/pge-boot/GSysStorage.cc
index 9449a3e2b96..58e86c94d83 100644
--- a/gcc/m2/pge-boot/GSysStorage.cc
+++ b/gcc/m2/pge-boot/GSysStorage.cc
@@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _SysStorage_H
 #define _SysStorage_C
 
+#include "GSysStorage.h"
 #   include "Glibc.h"
 #   include "GDebug.h"
 #   include "GSYSTEM.h"
@@ -229,7 +229,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
   callno = 0;
   if (enableTrace)
     {
-      trace = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
+      trace = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
     }
   else
     {
@@ -237,7 +237,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
     }
   if (enableZero)
     {
-      zero = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
+      zero = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
     }
   else
     {
diff --git a/gcc/m2/pge-boot/GSysStorage.h b/gcc/m2/pge-boot/GSysStorage.h
index 639f6811e19..89d349280b3 100644
--- a/gcc/m2/pge-boot/GSysStorage.h
+++ b/gcc/m2/pge-boot/GSysStorage.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_SysStorage_H)
 #   define _SysStorage_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GTimeString.h b/gcc/m2/pge-boot/GTimeString.h
index 7ba51f8081e..e544d627ff6 100644
--- a/gcc/m2/pge-boot/GTimeString.h
+++ b/gcc/m2/pge-boot/GTimeString.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_TimeString_H)
 #   define _TimeString_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/GUnixArgs.h b/gcc/m2/pge-boot/GUnixArgs.h
index cf9756ea177..0907b94ce35 100644
--- a/gcc/m2/pge-boot/GUnixArgs.h
+++ b/gcc/m2/pge-boot/GUnixArgs.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_UnixArgs_H)
 #   define _UnixArgs_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/Gbnflex.cc b/gcc/m2/pge-boot/Gbnflex.cc
index 36615080d3f..32807377dd0 100644
--- a/gcc/m2/pge-boot/Gbnflex.cc
+++ b/gcc/m2/pge-boot/Gbnflex.cc
@@ -37,9 +37,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 #include <string.h>
 #include <limits.h>
-#define _bnflex_H
 #define _bnflex_C
 
+#include "Gbnflex.h"
 #   include "GPushBackInput.h"
 #   include "GSymbolKey.h"
 #   include "GASCII.h"
@@ -51,8 +51,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   include "GStdIO.h"
 
 #   define MaxNameLength 8192
-typedef enum {bnflex_identtok, bnflex_literaltok, bnflex_codetok, bnflex_lbecomestok, bnflex_rbecomestok, bnflex_bartok, bnflex_lsparatok, bnflex_rsparatok, bnflex_lcparatok, bnflex_rcparatok, bnflex_lparatok, bnflex_rparatok, bnflex_errortok, bnflex_tfunctok, bnflex_symfunctok, bnflex_squotetok, bnflex_dquotetok, bnflex_moduletok, bnflex_begintok, bnflex_rulestok, bnflex_endtok, bnflex_lesstok, bnflex_gretok, bnflex_tokentok, bnflex_specialtok, bnflex_firsttok, bnflex_followtok, bnflex_BNFtok, bnflex_FNBtok, bnflex_declarationtok, bnflex_epsilontok, bnflex_eoftok} bnflex_TokenType;
-
 static FIO_File f;
 static SymbolKey_SymbolTree ReservedWords;
 static NameKey_Name CurrentToken;
diff --git a/gcc/m2/pge-boot/Gbnflex.h b/gcc/m2/pge-boot/Gbnflex.h
index a3da44e56d8..451a73dcb2e 100644
--- a/gcc/m2/pge-boot/Gbnflex.h
+++ b/gcc/m2/pge-boot/Gbnflex.h
@@ -24,8 +24,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #if !defined (_bnflex_H)
 #   define _bnflex_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/Gdtoa.h b/gcc/m2/pge-boot/Gdtoa.h
index 946e339d69a..64ab087afdf 100644
--- a/gcc/m2/pge-boot/Gdtoa.h
+++ b/gcc/m2/pge-boot/Gdtoa.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_dtoa_H)
 #   define _dtoa_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
@@ -68,7 +66,7 @@ EXTERN double dtoa_strtod (void * s, bool *error);
           sign       does the string have a sign?
 */
 
-EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, bool *sign);
+EXTERN void * dtoa_dtoa (double d, int mode, int ndigits, int *decpt, bool *sign);
 #   ifdef __cplusplus
 }
 #   endif
diff --git a/gcc/m2/pge-boot/Gerrno.h b/gcc/m2/pge-boot/Gerrno.h
index 7f065ccb24d..5ab2ab143f7 100644
--- a/gcc/m2/pge-boot/Gerrno.h
+++ b/gcc/m2/pge-boot/Gerrno.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_errno_H)
 #   define _errno_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/Gldtoa.h b/gcc/m2/pge-boot/Gldtoa.h
index 0678e9e2d81..879e2e9078d 100644
--- a/gcc/m2/pge-boot/Gldtoa.h
+++ b/gcc/m2/pge-boot/Gldtoa.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_ldtoa_H)
 #   define _ldtoa_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
@@ -68,7 +66,7 @@ EXTERN long double ldtoa_strtold (void *s, bool *error);
            sign       does the string have a sign?
 */
 
-EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, bool *sign);
+EXTERN void * ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, bool *sign);
 #   ifdef __cplusplus
 }
 #   endif
diff --git a/gcc/m2/pge-boot/Glibc.h b/gcc/m2/pge-boot/Glibc.h
index 0a5481ef523..ee6c61827d8 100644
--- a/gcc/m2/pge-boot/Glibc.h
+++ b/gcc/m2/pge-boot/Glibc.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_libc_H)
 #   define _libc_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
@@ -41,6 +39,8 @@ extern "C" {
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
+#include <stdlib.h>
+#   include <sys/types.h>
 #   include "GSYSTEM.h"
 
 #   if defined (_libc_C)
@@ -85,6 +85,17 @@ typedef libc_exitP_t libc_exitP_C;
 
 struct libc_exitP_p { libc_exitP_t proc; };
 
+EXTERN double libc_atof (void * nptr);
+EXTERN int libc_atoi (void * nptr);
+EXTERN ssize_t libc_atol (void * nptr);
+EXTERN long int libc_atoll (void * nptr);
+EXTERN double libc_strtod (void * nptr, void * endptr);
+EXTERN float libc_strtof (void * nptr, void * endptr);
+EXTERN long double libc_strtold (void * nptr, void * endptr);
+EXTERN ssize_t libc_strtol (void * nptr, void * endptr, int base);
+EXTERN long int libc_strtoll (void * nptr, void * endptr, int base);
+EXTERN size_t libc_strtoul (void * nptr, void * endptr, int base);
+EXTERN long unsigned int libc_strtoull (void * nptr, void * endptr, int base);
 EXTERN ssize_t libc_write (int d, void * buf, size_t nbytes);
 EXTERN ssize_t libc_read (int d, void * buf, size_t nbytes);
 EXTERN int libc_system (void * a);
@@ -198,7 +209,7 @@ EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence);
    perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).
 */
 
-EXTERN void libc_perror (const char *str);
+EXTERN void libc_perror (const char *string_, unsigned int _string_high);
 
 /*
    readv - reads an io vector of bytes.
diff --git a/gcc/m2/pge-boot/Glibm.h b/gcc/m2/pge-boot/Glibm.h
index d3c9415070c..899d7dd6879 100644
--- a/gcc/m2/pge-boot/Glibm.h
+++ b/gcc/m2/pge-boot/Glibm.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_libm_H)
 #   define _libm_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/Gpge.cc b/gcc/m2/pge-boot/Gpge.cc
index e231abeea47..8be2b17f54e 100644
--- a/gcc/m2/pge-boot/Gpge.cc
+++ b/gcc/m2/pge-boot/Gpge.cc
@@ -3621,7 +3621,7 @@ static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, c
   j = 0;
   while ((((i < HighSrc) && (src[i] != ASCII_nul)) && (j < HighDest)) && (src[i] != '%'))
     {
-      dest[j] = src[i];
+      const_cast<char *>(dest)[j] = src[i];
       i += 1;
       j += 1;
     }
@@ -3630,7 +3630,7 @@ static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, c
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
       if (src[i+1] == 's')
         {
-          dest[j] = ASCII_nul;
+          const_cast<char *>(dest)[j] = ASCII_nul;
           NameKey_GetKey (n, (char *) &str.array[0], MaxString);
           StrLib_StrConCat ((const char *) dest, _dest_high, (const char *) &str.array[0], MaxString, (char *) dest, _dest_high);
           j = StrLib_StrLen ((const char *) dest, _dest_high);
@@ -3639,7 +3639,7 @@ static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, c
       else if (src[i+1] == 'd')
         {
           /* avoid dangling else.  */
-          dest[j] = ASCII_nul;
+          const_cast<char *>(dest)[j] = ASCII_nul;
           NumberIO_CardToStr (n, 0, (char *) &str.array[0], MaxString);
           StrLib_StrConCat ((const char *) dest, _dest_high, (const char *) &str.array[0], MaxString, (char *) dest, _dest_high);
           j = StrLib_StrLen ((const char *) dest, _dest_high);
@@ -3648,7 +3648,7 @@ static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, c
       else
         {
           /* avoid dangling else.  */
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
@@ -3656,13 +3656,13 @@ static void Format1 (const char *src_, unsigned int _src_high, unsigned int n, c
   /* and finish off copying src into dest  */
   while (((i < HighSrc) && (src[i] != ASCII_nul)) && (j < HighDest))
     {
-      dest[j] = src[i];
+      const_cast<char *>(dest)[j] = src[i];
       i += 1;
       j += 1;
     }
   if (j < HighDest)
     {
-      dest[j] = ASCII_nul;
+      const_cast<char *>(dest)[j] = ASCII_nul;
     }
 }
 
@@ -7490,9 +7490,9 @@ static bool FindStr (pge_CodeHunk *code, unsigned int *i, const char *str_, unsi
   /* make a local copy of each unbounded array.  */
   memcpy (str, str_, _str_high+1);
 
-  j = StrLib_StrLen ((const char *) str, _str_high);
   t = (*code);
   k = (StrLib_StrLen ((const char *) &(*code)->codetext.array[0], MaxCodeHunkLength))+1;
+  j = StrLib_StrLen ((const char *) str, _str_high);
   while (t != NULL)
     {
       do {
@@ -7804,7 +7804,7 @@ static void OrSet (pge_SetDesc *to, pge_SetDesc from)
 
 
           default:
-            Debug_Halt ((const char *) "unknown element in enumeration type", 35, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "OrSet", 5, 4133);
+            Debug_Halt ((const char *) "unknown element in enumeration type", 35, (const char *) "m2/gm2-auto/pge.mod", 19, (const char *) "OrSet", 5, 4134);
             break;
         }
       from = from->next;
diff --git a/gcc/m2/pge-boot/Gtermios.h b/gcc/m2/pge-boot/Gtermios.h
index acb7fcf0c76..fe510d518b9 100644
--- a/gcc/m2/pge-boot/Gtermios.h
+++ b/gcc/m2/pge-boot/Gtermios.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_termios_H)
 #   define _termios_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff --git a/gcc/m2/pge-boot/Gwrapc.h b/gcc/m2/pge-boot/Gwrapc.h
index e4db1e2a99f..b28f3caf9cd 100644
--- a/gcc/m2/pge-boot/Gwrapc.h
+++ b/gcc/m2/pge-boot/Gwrapc.h
@@ -29,8 +29,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #if !defined (_wrapc_H)
 #   define _wrapc_H
 
-#include "config.h"
-#include "system.h"
 #   ifdef __cplusplus
 extern "C" {
 #   endif
diff mbox series

Patch

diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 2aa1bfd410b2..8c921db7dcdd 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -23,6 +23,7 @@ 
  *                                                                          *
  ****************************************************************************/
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index a073b2d94f1c..5f5cbe5b4774 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -23,6 +23,7 @@ 
  *                                                                          *
  ****************************************************************************/
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index a88a23860d3e..951d3848d09b 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -23,6 +23,7 @@ 
  *                                                                          *
  ****************************************************************************/
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/analyzer/analyzer-logging.cc b/gcc/analyzer/analyzer-logging.cc
index d3b04f2d9b10..2a4d02f83ba6 100644
--- a/gcc/analyzer/analyzer-logging.cc
+++ b/gcc/analyzer/analyzer-logging.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -50,12 +51,12 @@  logger::logger (FILE *f_out,
   m_log_refcount_changes (false),
   m_pp (reference_pp.clone ())
 {
-  pp_show_color (m_pp) = 0;
-  pp_buffer (m_pp)->m_stream = f_out;
+  pp_show_color (m_pp.get ()) = 0;
+  pp_buffer (m_pp.get ())->m_stream = f_out;
 
   /* %qE in logs for SSA_NAMEs should show the ssa names, rather than
      trying to prettify things by showing the underlying var.  */
-  pp_format_decoder (m_pp) = default_tree_printer;
+  pp_format_decoder (m_pp.get ()) = default_tree_printer;
 
   /* Begin the log by writing the GCC version.  */
   print_version (f_out, "", false);
@@ -70,7 +71,6 @@  logger::~logger ()
   /* This should be the last message emitted.  */
   log ("%s", __PRETTY_FUNCTION__);
   gcc_assert (m_refcount == 0);
-  delete m_pp;
 }
 
 /* Increment the reference count of the logger.  */
@@ -145,15 +145,15 @@  void
 logger::log_va_partial (const char *fmt, va_list *ap)
 {
   text_info text (fmt, ap, 0);
-  pp_format (m_pp, &text);
-  pp_output_formatted_text (m_pp);
+  pp_format (m_pp.get (), &text);
+  pp_output_formatted_text (m_pp.get ());
 }
 
 void
 logger::end_log_line ()
 {
-  pp_flush (m_pp);
-  pp_clear_output_area (m_pp);
+  pp_flush (m_pp.get ());
+  pp_clear_output_area (m_pp.get ());
   fprintf (m_f_out, "\n");
   fflush (m_f_out);
 }
diff --git a/gcc/analyzer/analyzer-logging.h b/gcc/analyzer/analyzer-logging.h
index eb2cde7a306b..aaa3d79a30e4 100644
--- a/gcc/analyzer/analyzer-logging.h
+++ b/gcc/analyzer/analyzer-logging.h
@@ -57,7 +57,7 @@  class logger
   void inc_indent () { m_indent_level++; }
   void dec_indent () { m_indent_level--; }
 
-  pretty_printer *get_printer () const { return m_pp; }
+  pretty_printer *get_printer () const { return m_pp.get (); }
   FILE *get_file () const { return m_f_out; }
 
 private:
@@ -67,7 +67,7 @@  private:
   FILE *m_f_out;
   int m_indent_level;
   bool m_log_refcount_changes;
-  pretty_printer *m_pp;
+  std::unique_ptr<pretty_printer> m_pp;
 };
 
 /* The class log_scope is an RAII-style class intended to make
diff --git a/gcc/analyzer/analyzer.cc b/gcc/analyzer/analyzer.cc
index 4a1a36157133..0f998e3f66f7 100644
--- a/gcc/analyzer/analyzer.cc
+++ b/gcc/analyzer/analyzer.cc
@@ -494,11 +494,11 @@  get_user_facing_name (const gcall *call)
 label_text
 make_label_text (bool can_colorize, const char *fmt, ...)
 {
-  pretty_printer *pp = global_dc->m_printer->clone ();
-  pp_clear_output_area (pp);
+  std::unique_ptr<pretty_printer> pp (global_dc->clone_printer ());
+  pp_clear_output_area (pp.get ());
 
   if (!can_colorize)
-    pp_show_color (pp) = false;
+    pp_show_color (pp.get ()) = false;
 
   rich_location rich_loc (line_table, UNKNOWN_LOCATION);
 
@@ -507,13 +507,12 @@  make_label_text (bool can_colorize, const char *fmt, ...)
   va_start (ap, fmt);
 
   text_info ti (_(fmt), &ap, 0, NULL, &rich_loc);
-  pp_format (pp, &ti);
-  pp_output_formatted_text (pp);
+  pp_format (pp.get (), &ti);
+  pp_output_formatted_text (pp.get ());
 
   va_end (ap);
 
-  label_text result = label_text::take (xstrdup (pp_formatted_text (pp)));
-  delete pp;
+  label_text result = label_text::take (xstrdup (pp_formatted_text (pp.get ())));
   return result;
 }
 
@@ -524,11 +523,11 @@  make_label_text_n (bool can_colorize, unsigned HOST_WIDE_INT n,
 		   const char *singular_fmt,
 		   const char *plural_fmt, ...)
 {
-  pretty_printer *pp = global_dc->m_printer->clone ();
-  pp_clear_output_area (pp);
+  std::unique_ptr<pretty_printer> pp (global_dc->clone_printer ());
+  pp_clear_output_area (pp.get ());
 
   if (!can_colorize)
-    pp_show_color (pp) = false;
+    pp_show_color (pp.get ()) = false;
 
   rich_location rich_loc (line_table, UNKNOWN_LOCATION);
 
@@ -540,13 +539,13 @@  make_label_text_n (bool can_colorize, unsigned HOST_WIDE_INT n,
 
   text_info ti (fmt, &ap, 0, NULL, &rich_loc);
 
-  pp_format (pp, &ti);
-  pp_output_formatted_text (pp);
+  pp_format (pp.get (), &ti);
+  pp_output_formatted_text (pp.get ());
 
   va_end (ap);
 
-  label_text result = label_text::take (xstrdup (pp_formatted_text (pp)));
-  delete pp;
+  label_text result
+    = label_text::take (xstrdup (pp_formatted_text (pp.get ())));
   return result;
 }
 
diff --git a/gcc/analyzer/bar-chart.cc b/gcc/analyzer/bar-chart.cc
index 4a4acf5f377c..3a259f80066b 100644
--- a/gcc/analyzer/bar-chart.cc
+++ b/gcc/analyzer/bar-chart.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc
index ec6f5acf21f3..a900839375cb 100644
--- a/gcc/analyzer/pending-diagnostic.cc
+++ b/gcc/analyzer/pending-diagnostic.cc
@@ -93,21 +93,19 @@  interesting_t::dump_to_pp (pretty_printer *pp, bool simple) const
 label_text
 evdesc::event_desc::formatted_print (const char *fmt, ...) const
 {
-  pretty_printer *pp = global_dc->m_printer->clone ();
+  auto pp = global_dc->clone_printer ();
 
-  pp_show_color (pp) = m_colorize;
+  pp_show_color (pp.get ()) = m_colorize;
 
   rich_location rich_loc (line_table, UNKNOWN_LOCATION);
   va_list ap;
   va_start (ap, fmt);
   text_info ti (_(fmt), &ap, 0, nullptr, &rich_loc);
-  pp_format (pp, &ti);
-  pp_output_formatted_text (pp);
+  pp_format (pp.get (), &ti);
+  pp_output_formatted_text (pp.get ());
   va_end (ap);
 
-  label_text result = label_text::take (xstrdup (pp_formatted_text (pp)));
-  delete pp;
-  return result;
+  return label_text::take (xstrdup (pp_formatted_text (pp.get ())));
 }
 
 /* class diagnostic_emission_context.  */
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 11c0e1b1a2fd..12465cbe42b2 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -1648,14 +1648,13 @@  private:
 
   static bool sufficiently_similar_p (tree expr_a, tree expr_b)
   {
-    pretty_printer *pp_a = global_dc->m_printer->clone ();
-    pretty_printer *pp_b = global_dc->m_printer->clone ();
-    pp_printf (pp_a, "%qE", expr_a);
-    pp_printf (pp_b, "%qE", expr_b);
-    bool result = (strcmp (pp_formatted_text (pp_a), pp_formatted_text (pp_b))
+    auto pp_a = global_dc->clone_printer ();
+    auto pp_b = global_dc->clone_printer ();
+    pp_printf (pp_a.get (), "%qE", expr_a);
+    pp_printf (pp_b.get (), "%qE", expr_b);
+    bool result = (strcmp (pp_formatted_text (pp_a.get ()),
+			   pp_formatted_text (pp_b.get ()))
 		   == 0);
-    delete pp_a;
-    delete pp_b;
     return result;
   }
 
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 55bd42a89a1a..826f8f614f75 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -437,16 +437,15 @@  supergraph::dump_dot_to_pp (pretty_printer *pp,
 void
 supergraph::dump_dot_to_file (FILE *fp, const dump_args_t &dump_args) const
 {
-  pretty_printer *pp = global_dc->m_printer->clone ();
-  pp_show_color (pp) = 0;
+  std::unique_ptr<pretty_printer> pp (global_dc->clone_printer ());
+  pp_show_color (pp.get ()) = 0;
   /* %qE in logs for SSA_NAMEs should show the ssa names, rather than
      trying to prettify things by showing the underlying var.  */
-  pp_format_decoder (pp) = default_tree_printer;
+  pp_format_decoder (pp.get ()) = default_tree_printer;
 
   pp->set_output_stream (fp);
-  dump_dot_to_pp (pp, dump_args);
-  pp_flush (pp);
-  delete pp;
+  dump_dot_to_pp (pp.get (), dump_args);
+  pp_flush (pp.get ());
 }
 
 /* Dump this graph in .dot format to PATH, using DUMP_ARGS.  */
diff --git a/gcc/asan.cc b/gcc/asan.cc
index 5f262d54a3ac..0a348a6decdb 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index 9fb564bd55dd..53cf53836e3d 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
@@ -2673,10 +2674,9 @@  attr_access::array_as_string (tree type) const
 
   /* Format the type using the current pretty printer.  The generic tree
      printer does a terrible job.  */
-  pretty_printer *pp = global_dc->m_printer->clone ();
-  pp_printf (pp, "%qT", type);
-  typstr = pp_formatted_text (pp);
-  delete pp;
+  std::unique_ptr<pretty_printer> pp (global_dc->clone_printer ());
+  pp_printf (pp.get (), "%qT", type);
+  typstr = pp_formatted_text (pp.get ());
 
   return typstr;
 }
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index de59b94bcb33..242b71d11655 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MAP
+#define INCLUDE_MEMORY
 #define INCLUDE_SET
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index fbba44362540..db5c0b5d746d 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index 4dd2eecbea54..cf9523aacf56 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index ec6a5da892dd..12098ccfbf0d 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define GCC_C_COMMON_C
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc
index f4a65a5019c3..211fb3be7d91 100644
--- a/gcc/c-family/c-format.cc
+++ b/gcc/c-family/c-format.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc
index 3e29766e092e..93c1935ae564 100644
--- a/gcc/c-family/c-gimplify.cc
+++ b/gcc/c-family/c-gimplify.cc
@@ -23,6 +23,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-indentation.cc b/gcc/c-family/c-indentation.cc
index 38be7d24da0e..7adec84ce2b0 100644
--- a/gcc/c-family/c-indentation.cc
+++ b/gcc/c-family/c-indentation.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 510e0870140e..efbe7980c579 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-pch.cc b/gcc/c-family/c-pch.cc
index f104575d3d08..50479ad43f43 100644
--- a/gcc/c-family/c-pch.cc
+++ b/gcc/c-family/c-pch.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc
index ed2a7a00e9eb..9d7153489f9c 100644
--- a/gcc/c-family/c-pragma.cc
+++ b/gcc/c-family/c-pragma.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc
index 0c764aecc3de..2596685e8b60 100644
--- a/gcc/c-family/c-pretty-print.cc
+++ b/gcc/c-family/c-pretty-print.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -36,6 +37,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "basic-block.h"
 #include "gimple.h"
+#include "make-unique.h"
 
 /* The pretty-printer code is primarily designed to closely follow
    (GNU) C and C++ grammars.  That is to be contrasted with spaghetti
@@ -2971,10 +2973,10 @@  c_pretty_printer::c_pretty_printer ()
 
 /* c_pretty_printer's implementation of pretty_printer::clone vfunc.  */
 
-pretty_printer *
+std::unique_ptr<pretty_printer>
 c_pretty_printer::clone () const
 {
-  return new c_pretty_printer (*this);
+  return ::make_unique<c_pretty_printer> (*this);
 }
 
 /* Print the tree T in full, on file FILE.  */
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index 550e4cb68820..80854b079175 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -51,7 +51,7 @@  class c_pretty_printer : public pretty_printer
 {
 public:
   c_pretty_printer ();
-  pretty_printer *clone () const override;
+  std::unique_ptr<pretty_printer> clone () const override;
 
   // Format string, possibly translated.
   void translate_string (const char *);
diff --git a/gcc/c-family/c-type-mismatch.cc b/gcc/c-family/c-type-mismatch.cc
index 89646854f3c7..abc8cb83cc54 100644
--- a/gcc/c-family/c-type-mismatch.cc
+++ b/gcc/c-family/c-type-mismatch.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc
index 47e0a6bfa073..979467bb7df2 100644
--- a/gcc/c-family/c-warn.cc
+++ b/gcc/c-family/c-warn.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/c/c-aux-info.cc b/gcc/c/c-aux-info.cc
index f6b5980aa830..b422da0e7264 100644
--- a/gcc/c/c-aux-info.cc
+++ b/gcc/c/c-aux-info.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/c-convert.cc b/gcc/c/c-convert.cc
index 7c1064c6691b..9180c6ae14ec 100644
--- a/gcc/c/c-convert.cc
+++ b/gcc/c/c-convert.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    Every language front end must have a `convert' function
    but what kind of conversions it does will depend on the language.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/c-errors.cc b/gcc/c/c-errors.cc
index c6b7c108354b..38b11a7c70a8 100644
--- a/gcc/c/c-errors.cc
+++ b/gcc/c/c-errors.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/c-fold.cc b/gcc/c/c-fold.cc
index 57b67c74bd8e..83b7b4879b93 100644
--- a/gcc/c/c-fold.cc
+++ b/gcc/c/c-fold.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/c-lang.cc b/gcc/c/c-lang.cc
index 870e23b4a33c..7e5604fce6b6 100644
--- a/gcc/c/c-lang.cc
+++ b/gcc/c/c-lang.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc
index eb0c4b85772f..dc91373f5b98 100644
--- a/gcc/c/c-objc-common.cc
+++ b/gcc/c/c-objc-common.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -295,11 +296,11 @@  print_type (c_pretty_printer *cpp, tree t, bool *quoted,
 void
 pp_markup::element_quoted_type::print_type (pp_markup::context &ctxt)
 {
-  c_pretty_printer *cpp = (c_pretty_printer *) ctxt.m_pp.clone ();
+  auto pp = ctxt.m_pp.clone ();
+  c_pretty_printer *cpp = (c_pretty_printer *)pp.get ();
   cpp->set_padding (pp_none);
   ::print_type (cpp, m_type, &ctxt.m_quoted, m_highlight_color);
   pp_string (&ctxt.m_pp, pp_formatted_text (cpp));
-  delete cpp;
 }
 
 /* Called during diagnostic message formatting process to print a
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index ba6d96d26b2b..39d5e3716ab8 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    including computing the types of the result, C-specific error checks,
    and some optimization.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc
index d156d83cd378..8d1db33b8441 100644
--- a/gcc/c/gimple-parser.cc
+++ b/gcc/c/gimple-parser.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/calls.cc b/gcc/calls.cc
index c5c26f65280f..05eaa0d7b148 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cfganal.cc b/gcc/cfganal.cc
index 35c59f3f5d26..863f88ff1eab 100644
--- a/gcc/cfganal.cc
+++ b/gcc/cfganal.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* This file contains various simple utilities to analyze the CFG.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 6c1096363afb..885f488a9d41 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cfghooks.cc b/gcc/cfghooks.cc
index 3ced91c96394..55fdf983e1ce 100644
--- a/gcc/cfghooks.cc
+++ b/gcc/cfghooks.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc
index 5202c3865d16..df0ec7722bc2 100644
--- a/gcc/cfgloop.cc
+++ b/gcc/cfgloop.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 39a3adbc7c35..03d3b30b511a 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
     optimization.  It represents a multi-graph where nodes are functions
     (symbols within symbol table) and edges are call sites. */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index 4fff6873a369..ede720f4b157 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -64,6 +64,7 @@  along with GCC; see the file COPYING3.  If not see
    only difference is that clones are not visible during the
    Generate Summary stage.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 2bd0289ffba5..0052b92715ad 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -157,6 +157,7 @@  along with GCC; see the file COPYING3.  If not see
       and apply simple transformations
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/collect-utils.cc b/gcc/collect-utils.cc
index 981a14a554b9..5397fe2c7a09 100644
--- a/gcc/collect-utils.cc
+++ b/gcc/collect-utils.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/collect2.cc b/gcc/collect2.cc
index 902014a9cc15..2bd618d27c16 100644
--- a/gcc/collect2.cc
+++ b/gcc/collect2.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* Build tables of static constructors and destructors and run ld.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc
index 64b65b7ff9e4..2bfc597e333b 100644
--- a/gcc/common/config/aarch64/aarch64-common.cc
+++ b/gcc/common/config/aarch64/aarch64-common.cc
@@ -19,6 +19,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/common/config/arm/arm-common.cc b/gcc/common/config/arm/arm-common.cc
index dbcbe3f6e996..68674575ccfc 100644
--- a/gcc/common/config/arm/arm-common.cc
+++ b/gcc/common/config/arm/arm-common.cc
@@ -18,6 +18,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #define INCLUDE_LIST
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #define INCLUDE_ALGORITHM
 #include "config.h"
diff --git a/gcc/common/config/avr/avr-common.cc b/gcc/common/config/avr/avr-common.cc
index bb454a208568..f14a4a48e7c9 100644
--- a/gcc/common/config/avr/avr-common.cc
+++ b/gcc/common/config/avr/avr-common.cc
@@ -17,6 +17,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/aarch64/aarch64-cc-fusion.cc b/gcc/config/aarch64/aarch64-cc-fusion.cc
index 3af8c00d8462..3cae4c4d8bd5 100644
--- a/gcc/config/aarch64/aarch64-cc-fusion.cc
+++ b/gcc/config/aarch64/aarch64-cc-fusion.cc
@@ -64,6 +64,7 @@ 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
 #define INCLUDE_ARRAY
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/aarch64/aarch64-early-ra.cc b/gcc/config/aarch64/aarch64-early-ra.cc
index 6e544dd61915..bbd84686e13f 100644
--- a/gcc/config/aarch64/aarch64-early-ra.cc
+++ b/gcc/config/aarch64/aarch64-early-ra.cc
@@ -40,6 +40,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index e7c703c987e8..745c5bcc537d 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -19,6 +19,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index a225adeff573..78b7c7381c1c 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/arm/aarch-common.cc b/gcc/config/arm/aarch-common.cc
index aa405af8192b..44012feb5be7 100644
--- a/gcc/config/arm/aarch-common.cc
+++ b/gcc/config/arm/aarch-common.cc
@@ -23,6 +23,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-builtins.cc
index 7e8217666fee..8909ed3dcc41 100644
--- a/gcc/config/arm/arm-mve-builtins.cc
+++ b/gcc/config/arm/arm-mve-builtins.cc
@@ -19,6 +19,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/avr/avr-devices.cc b/gcc/config/avr/avr-devices.cc
index 456a6b72c8b0..83b4a2ec64cd 100644
--- a/gcc/config/avr/avr-devices.cc
+++ b/gcc/config/avr/avr-devices.cc
@@ -20,6 +20,7 @@ 
 #ifndef IN_GEN_AVR_MMCU_TEXI
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/avr/driver-avr.cc b/gcc/config/avr/driver-avr.cc
index 4dcabc604e85..3eefcabe48dd 100644
--- a/gcc/config/avr/driver-avr.cc
+++ b/gcc/config/avr/driver-avr.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index 2051fa5b08b1..aa00d149c4d3 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/bpf/btfext-out.cc b/gcc/config/bpf/btfext-out.cc
index b3df7b555d5f..ca6241aa52ee 100644
--- a/gcc/config/bpf/btfext-out.cc
+++ b/gcc/config/bpf/btfext-out.cc
@@ -19,6 +19,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/bpf/core-builtins.cc b/gcc/config/bpf/core-builtins.cc
index 86e2e9d6e39f..deb368a1d3db 100644
--- a/gcc/config/bpf/core-builtins.cc
+++ b/gcc/config/bpf/core-builtins.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index 9129378be373..176974706381 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc
index 445f5640155a..26f094cd45d3 100644
--- a/gcc/config/i386/driver-i386.cc
+++ b/gcc/config/i386/driver-i386.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index 4286eeb80e63..a778f049a88c 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 2b774ff7c4e1..81d58ad46566 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index 3434d0069439..16b1e6ca66e5 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 55e0210260f5..5fa6e021778f 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/loongarch/loongarch-builtins.cc b/gcc/config/loongarch/loongarch-builtins.cc
index cf92770de30e..64529da8250c 100644
--- a/gcc/config/loongarch/loongarch-builtins.cc
+++ b/gcc/config/loongarch/loongarch-builtins.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/mingw/winnt-cxx.cc b/gcc/config/mingw/winnt-cxx.cc
index f4d7a50262bf..621366e99743 100644
--- a/gcc/config/mingw/winnt-cxx.cc
+++ b/gcc/config/mingw/winnt-cxx.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 803e5f5ec857..fb4b8a484158 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 173f792bf55a..cd5c5970f0b1 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/msp430/driver-msp430.cc b/gcc/config/msp430/driver-msp430.cc
index a11fd3d7dec8..5ffa8ef35e65 100644
--- a/gcc/config/msp430/driver-msp430.cc
+++ b/gcc/config/msp430/driver-msp430.cc
@@ -20,6 +20,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index df16ee647364..ddb1c6631648 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -29,6 +29,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 96a1134220ed..3ac61b498944 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -20,6 +20,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include <sstream>
 #include "system.h"
diff --git a/gcc/config/riscv/riscv-avlprop.cc b/gcc/config/riscv/riscv-avlprop.cc
index 91d80aa00d62..066377c5c14b 100644
--- a/gcc/config/riscv/riscv-avlprop.cc
+++ b/gcc/config/riscv/riscv-avlprop.cc
@@ -65,6 +65,7 @@  along with GCC; see the file COPYING3.  If not see
 #define IN_TARGET_CODE 1
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 
 #include "config.h"
diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc
index 41730c483ee1..458d9b0886e3 100644
--- a/gcc/config/riscv/riscv-vector-builtins.cc
+++ b/gcc/config/riscv/riscv-vector-builtins.cc
@@ -20,6 +20,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 030ffbe2ebbc..0b53b20f9f6c 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -63,6 +63,7 @@  along with GCC; see the file COPYING3.  If not see
 #define IN_TARGET_CODE 1
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 
 #include "config.h"
diff --git a/gcc/config/rs6000/driver-rs6000.cc b/gcc/config/rs6000/driver-rs6000.cc
index f4900724b98a..fd457e72d972 100644
--- a/gcc/config/rs6000/driver-rs6000.cc
+++ b/gcc/config/rs6000/driver-rs6000.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/rs6000/host-darwin.cc b/gcc/config/rs6000/host-darwin.cc
index e0001776339d..15c40b16e674 100644
--- a/gcc/config/rs6000/host-darwin.cc
+++ b/gcc/config/rs6000/host-darwin.cc
@@ -19,6 +19,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 04882c396bfe..5ff346edc2e2 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -22,6 +22,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 4521a86f0480..0332fb4e904b 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -29,6 +29,7 @@ 
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 25d43ae3e138..874b11274a43 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/sol2-cxx.cc b/gcc/config/sol2-cxx.cc
index aa558be585ef..4f5fbc602249 100644
--- a/gcc/config/sol2-cxx.cc
+++ b/gcc/config/sol2-cxx.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/vms/vms-c.cc b/gcc/config/vms/vms-c.cc
index d0620b4d7a5f..0e9fa2f14d6f 100644
--- a/gcc/config/vms/vms-c.cc
+++ b/gcc/config/vms/vms-c.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define IN_TARGET_CODE 1
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/config/xtensa/xtensa-dynconfig.cc b/gcc/config/xtensa/xtensa-dynconfig.cc
index 3bd2760e4d89..6ddc02a6e9b0 100644
--- a/gcc/config/xtensa/xtensa-dynconfig.cc
+++ b/gcc/config/xtensa/xtensa-dynconfig.cc
@@ -17,6 +17,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/coroutine-passes.cc b/gcc/coroutine-passes.cc
index 0f8e24f8d551..ce74a0278b3e 100644
--- a/gcc/coroutine-passes.cc
+++ b/gcc/coroutine-passes.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/coverage.cc b/gcc/coverage.cc
index 22778361da13..80941ee67ee9 100644
--- a/gcc/coverage.cc
+++ b/gcc/coverage.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define GCOV_LINKAGE
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index 309ab01d12d3..cc25b48d362d 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* High-level class interface.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 646072d4f202..62175e77b437 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* High-level class interface.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 4e4df94f4206..ad68afef96ec 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index cf0e5d37571c..8a36b9c88c4d 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 4d2849a289a1..2a55b87bd036 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -130,6 +130,7 @@  along with GCC; see the file COPYING3.  If not see
    More helpful for optimization might be to make the contracts a wrapper
    function that could be inlined into the caller, the callee, or both.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 86a5ac8999ac..ef64a98972ba 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 003e68f1ea72..68f651e96051 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cp-lang.cc b/gcc/cp/cp-lang.cc
index e1e2ab2e3966..3959b3194e51 100644
--- a/gcc/cp/cp-lang.cc
+++ b/gcc/cp/cp-lang.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc
index cd379514991d..7a0636f16532 100644
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cp-ubsan.cc b/gcc/cp/cp-ubsan.cc
index c4ae0fe7eea3..1055714fa357 100644
--- a/gcc/cp/cp-ubsan.cc
+++ b/gcc/cp/cp-ubsan.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc
index 526937d36181..54e700ceeda5 100644
--- a/gcc/cp/cvt.cc
+++ b/gcc/cp/cvt.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
    Every language front end must have a `convert' function
    but what kind of conversions it does will depend on the language.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc
index 41e6bdfdda50..c0608ac0b26f 100644
--- a/gcc/cp/cxx-pretty-print.cc
+++ b/gcc/cp/cxx-pretty-print.cc
@@ -18,12 +18,14 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "cp-tree.h"
 #include "cxx-pretty-print.h"
 #include "tree-pretty-print.h"
+#include "make-unique.h"
 
 static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
 static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
@@ -2927,8 +2929,8 @@  cxx_pretty_printer::cxx_pretty_printer ()
 
 /* cxx_pretty_printer's implementation of pretty_printer::clone vfunc.  */
 
-pretty_printer *
+std::unique_ptr<pretty_printer>
 cxx_pretty_printer::clone () const
 {
-  return new cxx_pretty_printer (*this);
+  return ::make_unique<cxx_pretty_printer> (*this);
 }
diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h
index a4fcf7c71024..f0865cc9d8ca 100644
--- a/gcc/cp/cxx-pretty-print.h
+++ b/gcc/cp/cxx-pretty-print.h
@@ -34,7 +34,7 @@  class cxx_pretty_printer : public c_pretty_printer
 public:
   cxx_pretty_printer ();
 
-  pretty_printer *clone () const override;
+  std::unique_ptr<pretty_printer> clone () const override;
 
   void constant (tree) final override;
   void id_expression (tree) final override;
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index a0c319086d71..a455eb481b1a 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 /* ??? not all decl nodes are given the most useful possible
    line numbers.  For example, the CONST_DECLs for enum values.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/dump.cc b/gcc/cp/dump.cc
index aafb62ffaa01..8166bbfdee6e 100644
--- a/gcc/cp/dump.cc
+++ b/gcc/cp/dump.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc
index 7b4abd1f56e5..e14a9fd3f9c9 100644
--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/expr.cc b/gcc/cp/expr.cc
index de4991e616cd..e5ec2352f57f 100644
--- a/gcc/cp/expr.cc
+++ b/gcc/cp/expr.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/friend.cc b/gcc/cp/friend.cc
index 2e70d0160c46..5261daa4994c 100644
--- a/gcc/cp/friend.cc
+++ b/gcc/cp/friend.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index f785015e4774..8b1dce594fd9 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* High-level class interface.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index e17c00217b2e..4f404a11a9e6 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -21,6 +21,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/logic.cc b/gcc/cp/logic.cc
index fab2c357dc4e..f36abb2d4e46 100644
--- a/gcc/cp/logic.cc
+++ b/gcc/cp/logic.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_LIST
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 17988d69e1ea..828e32633578 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -44,6 +44,7 @@  along with GCC; see the file COPYING3.  If not see
      mangle_ctor_vtbl_for_type:		`C-in-B' constructor virtual table data
      mangle_thunk:			thunk function or entry  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index d704db2af061..adffa9ba0f33 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 
 /* Handle method declarations.  */
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/optimize.cc b/gcc/cp/optimize.cc
index 8429d856728f..f93e0262fa76 100644
--- a/gcc/cp/optimize.cc
+++ b/gcc/cp/optimize.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 03a1144765b2..6c5810b18aab 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_ALGORITHM // for std::equal
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "cp-tree.h"
diff --git a/gcc/cp/ptree.cc b/gcc/cp/ptree.cc
index 15e46752d011..77bffa0b8997 100644
--- a/gcc/cp/ptree.cc
+++ b/gcc/cp/ptree.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/rtti.cc b/gcc/cp/rtti.cc
index cc006ea927f2..fff89856e6b7 100644
--- a/gcc/cp/rtti.cc
+++ b/gcc/cp/rtti.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/search.cc b/gcc/cp/search.cc
index b0421ee05247..b2d6c2491894 100644
--- a/gcc/cp/search.cc
+++ b/gcc/cp/search.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* High-level class interface.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 0370d81de01f..e919944d6ed1 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -23,6 +23,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 0a7a56cc6e2e..153adab76ee7 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index d1204d922bbd..b0267aeb41df 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
    including computing the types of the result, C and C++ specific error
    checks, and some optimization.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc
index 79b397a69faf..9f57020e2537 100644
--- a/gcc/cp/typeck2.cc
+++ b/gcc/cp/typeck2.cc
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
    including computing the types of the result, C and C++ specific error
    checks, and some optimization.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/cp/vtable-class-hierarchy.cc b/gcc/cp/vtable-class-hierarchy.cc
index afe1e96f5e27..7e4f613c2051 100644
--- a/gcc/cp/vtable-class-hierarchy.cc
+++ b/gcc/cp/vtable-class-hierarchy.cc
@@ -110,6 +110,7 @@  along with GCC; see the file COPYING3.  If not see
   gcc/vtable-verify.h, because they are used both here and in
   gcc/vtable-verify.cc.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc
index 0f7ca10e0175..873140ee7c8b 100644
--- a/gcc/d/d-attribs.cc
+++ b/gcc/d/d-attribs.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 /* Implementation of attribute handlers for user defined attributes and
    internal built-in functions.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc
index 4546c0e9b563..2ca02fe691cb 100644
--- a/gcc/d/d-builtins.cc
+++ b/gcc/d/d-builtins.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc
index 2b3089b5f6dd..eeeb48defa28 100644
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc
index 5c79cdf6e1e4..a07c7d8ba68e 100644
--- a/gcc/d/d-convert.cc
+++ b/gcc/d/d-convert.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc
index 373075ca54de..d584d2ac2b23 100644
--- a/gcc/d/d-diagnostic.cc
+++ b/gcc/d/d-diagnostic.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-frontend.cc b/gcc/d/d-frontend.cc
index 0d7f4a3ec7fd..c3e5d8594adc 100644
--- a/gcc/d/d-frontend.cc
+++ b/gcc/d/d-frontend.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index 89ffa7e61ea1..2aa2a3f9767f 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-longdouble.cc b/gcc/d/d-longdouble.cc
index e4c8c5e6eb06..ba10a3569096 100644
--- a/gcc/d/d-longdouble.cc
+++ b/gcc/d/d-longdouble.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/d-target.cc b/gcc/d/d-target.cc
index dd46e5358918..17cae450623f 100644
--- a/gcc/d/d-target.cc
+++ b/gcc/d/d-target.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 0a87c85ae2e5..0afaa71664d5 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc
index d055e0b4025b..a690f2ef2cf1 100644
--- a/gcc/d/expr.cc
+++ b/gcc/d/expr.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc
index c895c1a1a529..34143b343e8b 100644
--- a/gcc/d/intrinsics.cc
+++ b/gcc/d/intrinsics.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index b111ee90cea0..f9b4a1e8e412 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/toir.cc b/gcc/d/toir.cc
index a6848f2ffa2c..2bbba1035c7f 100644
--- a/gcc/d/toir.cc
+++ b/gcc/d/toir.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index cadcbe8164e9..56aaf29d54eb 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index 9fa2f888cb22..2f78c917de23 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/data-streamer-in.cc b/gcc/data-streamer-in.cc
index 07dbc5e2bc36..64dec35296cc 100644
--- a/gcc/data-streamer-in.cc
+++ b/gcc/data-streamer-in.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/data-streamer-out.cc b/gcc/data-streamer-out.cc
index c237e30f7048..95715436cdc5 100644
--- a/gcc/data-streamer-out.cc
+++ b/gcc/data-streamer-out.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/data-streamer.cc b/gcc/data-streamer.cc
index 896413e8d2b6..1caf72f9e965 100644
--- a/gcc/data-streamer.cc
+++ b/gcc/data-streamer.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic-client-data-hooks.h b/gcc/diagnostic-client-data-hooks.h
index a67a3dbff479..9e2bd606378a 100644
--- a/gcc/diagnostic-client-data-hooks.h
+++ b/gcc/diagnostic-client-data-hooks.h
@@ -53,7 +53,7 @@  class diagnostic_client_data_hooks
    for use in the compiler (i.e. with knowledge of "tree", access to
    langhooks, etc).  */
 
-extern diagnostic_client_data_hooks *make_compiler_data_hooks ();
+extern std::unique_ptr<diagnostic_client_data_hooks> make_compiler_data_hooks ();
 
 class diagnostic_client_plugin_info;
 
diff --git a/gcc/diagnostic-format-json.cc b/gcc/diagnostic-format-json.cc
index b4c1f13ee671..48b836768b15 100644
--- a/gcc/diagnostic-format-json.cc
+++ b/gcc/diagnostic-format-json.cc
@@ -404,7 +404,7 @@  diagnostic_output_format_init_json (diagnostic_context &context,
   pp_show_color (fmt->get_printer ()) = false;
   context.set_show_highlight_colors (false);
 
-  context.set_output_format (fmt.release ());
+  context.set_output_format (std::move (fmt));
 }
 
 /* Populate CONTEXT in preparation for JSON output to stderr.  */
diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc
index 70832513b6d9..0e6e4f32b19f 100644
--- a/gcc/diagnostic-format-sarif.cc
+++ b/gcc/diagnostic-format-sarif.cc
@@ -3396,7 +3396,7 @@  diagnostic_output_format_init_sarif (diagnostic_context &context,
 
   context.m_printer->set_token_printer
     (&fmt->get_builder ().get_token_printer ());
-  context.set_output_format (fmt.release ());
+  context.set_output_format (std::move (fmt));
 }
 
 /* Populate CONTEXT in preparation for SARIF output to stderr.  */
@@ -3982,7 +3982,7 @@  test_message_with_embedded_link (enum sarif_version version)
     };
 
     test_sarif_diagnostic_context dc ("test.c", version);
-    dc.set_urlifier (new test_urlifier ());
+    dc.set_urlifier (::make_unique<test_urlifier> ());
     rich_location richloc (line_table, UNKNOWN_LOCATION);
     dc.report (DK_ERROR, richloc, nullptr, 0,
 	       "foo %<-foption%> %<unrecognized%> bar");
diff --git a/gcc/diagnostic-format-text.cc b/gcc/diagnostic-format-text.cc
index 0d58d5fb082d..4f599437a409 100644
--- a/gcc/diagnostic-format-text.cc
+++ b/gcc/diagnostic-format-text.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic-global-context.cc b/gcc/diagnostic-global-context.cc
index 9e151905a6bb..e82588e54047 100644
--- a/gcc/diagnostic-global-context.cc
+++ b/gcc/diagnostic-global-context.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 /* This file implements the parts of the language independent aspect
    of diagnostic messages that implicitly use global_dc.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic-macro-unwinding.cc b/gcc/diagnostic-macro-unwinding.cc
index a9838ffb52ca..38f827f66381 100644
--- a/gcc/diagnostic-macro-unwinding.cc
+++ b/gcc/diagnostic-macro-unwinding.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic-show-locus.cc b/gcc/diagnostic-show-locus.cc
index 415de42cbc7b..79499dc549d3 100644
--- a/gcc/diagnostic-show-locus.cc
+++ b/gcc/diagnostic-show-locus.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic-spec.cc b/gcc/diagnostic-spec.cc
index addaf089f035..77e4b67dc887 100644
--- a/gcc/diagnostic-spec.cc
+++ b/gcc/diagnostic-spec.cc
@@ -19,6 +19,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 41656a607b81..4f8c7680a03c 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -433,19 +433,21 @@  diagnostic_context::execution_failed_p () const
 }
 
 void
-diagnostic_context::set_output_format (diagnostic_output_format *output_format)
+diagnostic_context::
+set_output_format (std::unique_ptr<diagnostic_output_format> output_format)
 {
-  /* Ideally we'd use a std::unique_ptr here.  */
   delete m_output_format;
-  m_output_format = output_format;
+  /* Ideally this field would be a std::unique_ptr.  */
+  m_output_format = output_format.release ();
 }
 
 void
-diagnostic_context::set_client_data_hooks (diagnostic_client_data_hooks *hooks)
+diagnostic_context::
+set_client_data_hooks (std::unique_ptr<diagnostic_client_data_hooks> hooks)
 {
-  /* Ideally we'd use a std::unique_ptr here.  */
   delete m_client_data_hooks;
-  m_client_data_hooks = hooks;
+  /* Ideally the field would be a std::unique_ptr here.  */
+  m_client_data_hooks = hooks.release ();
 }
 
 void
@@ -462,20 +464,21 @@  diagnostic_context::set_original_argv (unique_argv original_argv)
 }
 
 void
-diagnostic_context::set_option_manager (diagnostic_option_manager *mgr,
-					unsigned lang_mask)
+diagnostic_context::
+set_option_manager (std::unique_ptr<diagnostic_option_manager> mgr,
+		    unsigned lang_mask)
 {
   delete m_option_mgr;
-  m_option_mgr = mgr;
+  m_option_mgr = mgr.release ();
   m_lang_mask = lang_mask;
 }
 
 void
-diagnostic_context::set_urlifier (urlifier *urlifier)
+diagnostic_context::set_urlifier (std::unique_ptr<urlifier> urlifier)
 {
-  /* Ideally we'd use a std::unique_ptr here.  */
   delete m_urlifier;
-  m_urlifier = urlifier;
+  /* Ideally the field would be a std::unique_ptr here.  */
+  m_urlifier = urlifier.release ();
 }
 
 void
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 83d73d2c4b70..60eb370a1883 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -21,6 +21,14 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_DIAGNOSTIC_H
 #define GCC_DIAGNOSTIC_H
 
+/* This header uses std::unique_ptr, but <memory> can't be directly
+   included due to issues with macros.  Hence it must be included from
+   system.h by defining INCLUDE_MEMORY in any source file using it.  */
+
+#ifndef INCLUDE_MEMORY
+# error "You must define INCLUDE_MEMORY before including system.h to use diagnostic.h"
+#endif
+
 #include "unique-argv.h"
 #include "rich-location.h"
 #include "pretty-print.h"
@@ -556,10 +564,10 @@  public:
   }
 
   /* Various setters for use by option-handling logic.  */
-  void set_output_format (diagnostic_output_format *output_format);
+  void set_output_format (std::unique_ptr<diagnostic_output_format> output_format);
   void set_text_art_charset (enum diagnostic_text_art_charset charset);
-  void set_client_data_hooks (diagnostic_client_data_hooks *hooks);
-  void set_urlifier (urlifier *);
+  void set_client_data_hooks (std::unique_ptr<diagnostic_client_data_hooks> hooks);
+  void set_urlifier (std::unique_ptr<urlifier>);
   void create_edit_context ();
   void set_warning_as_error_requested (bool val)
   {
@@ -654,7 +662,7 @@  public:
   }
 
   void
-  set_option_manager (diagnostic_option_manager *mgr,
+  set_option_manager (std::unique_ptr<diagnostic_option_manager> mgr,
 		      unsigned lang_mask);
 
   unsigned get_lang_mask () const
@@ -682,6 +690,11 @@  public:
     return m_option_classifier.pch_restore (f);
   }
 
+  std::unique_ptr<pretty_printer> clone_printer () const
+  {
+    return m_printer->clone ();
+  }
+
 private:
   void error_recursion () ATTRIBUTE_NORETURN;
 
@@ -693,11 +706,15 @@  private:
      Ideally, all of these would be private.  */
 
 public:
-  /* Where most of the diagnostic formatting work is done.  */
+  /* Where most of the diagnostic formatting work is done.
+     Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   pretty_printer *m_printer;
 
 private:
-  /* Cache of source code.  */
+  /* Cache of source code.
+     Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   file_cache *m_file_cache;
 
   /* The number of times we have issued diagnostics.  */
@@ -789,11 +806,15 @@  public:
   void (*m_adjust_diagnostic_info)(diagnostic_context *, diagnostic_info *);
 
 private:
+  /* Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   diagnostic_option_manager *m_option_mgr;
   unsigned m_lang_mask;
 
   /* An optional hook for adding URLs to quoted text strings in
-     diagnostics.  Only used for the main diagnostic message.  */
+     diagnostics.  Only used for the main diagnostic message.
+     Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   urlifier *m_urlifier;
 
 public:
@@ -836,7 +857,9 @@  private:
   enum diagnostics_escape_format m_escape_format;
 
   /* If non-NULL, an edit_context to which fix-it hints should be
-     applied, for generating patches.  */
+     applied, for generating patches.
+     Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   edit_context *m_edit_context_ptr;
 
   /* Fields relating to diagnostic groups.  */
@@ -850,7 +873,9 @@  private:
   } m_diagnostic_groups;
 
   /* How to output diagnostics (text vs a structured format such as JSON).
-     Must be non-NULL; owned by context.  */
+     Must be non-NULL; owned by context.
+     This would be a std::unique_ptr if diagnostic_context had a proper
+     ctor.  */
   diagnostic_output_format *m_output_format;
 
   /* Callback to set the locations of call sites along the inlining
@@ -865,14 +890,18 @@  private:
   /* A bundle of hooks for providing data to the context about its client
      e.g. version information, plugins, etc.
      Used by SARIF output to give metadata about the client that's
-     producing diagnostics.  */
+     producing diagnostics.
+     Owned by the context; this would be a std::unique_ptr if
+     diagnostic_context had a proper ctor.  */
   diagnostic_client_data_hooks *m_client_data_hooks;
 
   /* Support for diagrams.  */
   struct
   {
     /* Theme to use when generating diagrams.
-       Can be NULL (if text art is disabled).  */
+       Can be NULL (if text art is disabled).
+       Owned by the context; this would be a std::unique_ptr if
+       diagnostic_context had a proper ctor.  */
     text_art::theme *m_theme;
 
   } m_diagrams;
diff --git a/gcc/digraph.cc b/gcc/digraph.cc
index b323764a93cd..7b2726d24fe3 100644
--- a/gcc/digraph.cc
+++ b/gcc/digraph.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 38aedb644709..fc23e4ba4601 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -55,6 +55,7 @@  along with GCC; see the file COPYING3.  If not see
    DW_CFA_... = DWARF2 CFA call frame instruction
    DW_TAG_... = DWARF2 DIE tag */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/edit-context.cc b/gcc/edit-context.cc
index 37ac4989de0b..f51ebf0e5158 100644
--- a/gcc/edit-context.cc
+++ b/gcc/edit-context.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/except.cc b/gcc/except.cc
index 5bb5edbd8065..4bec795010b0 100644
--- a/gcc/except.cc
+++ b/gcc/except.cc
@@ -109,6 +109,7 @@  along with GCC; see the file COPYING3.  If not see
    output_call_frame_info (dwarf2out.cc) emits the required unwind data.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 7a471f20e794..85c9e5e08a69 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/file-prefix-map.cc b/gcc/file-prefix-map.cc
index 6b432e2a15af..6841559c5ed8 100644
--- a/gcc/file-prefix-map.cc
+++ b/gcc/file-prefix-map.cc
@@ -15,6 +15,7 @@ 
    along with this program; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/final.cc b/gcc/final.cc
index 5d911586de5b..11141f2b56c8 100644
--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -44,6 +44,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_ALGORITHM /* reverse */
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc
index a214b8bc1b37..3ecbbd30cfa2 100644
--- a/gcc/fortran/arith.cc
+++ b/gcc/fortran/arith.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    would evaluate them.  We use the GNU MP library and the MPFR
    library to do arithmetic, and this file provides the interface.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc
index 773c5b72c851..31bdd736a9ee 100644
--- a/gcc/fortran/array.cc
+++ b/gcc/fortran/array.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/bbt.cc b/gcc/fortran/bbt.cc
index f564ce104e87..556baeec71db 100644
--- a/gcc/fortran/bbt.cc
+++ b/gcc/fortran/bbt.cc
@@ -35,6 +35,7 @@  along with GCC; see the file COPYING3.  If not see
    This implementation is based on Stefan Nilsson's article in the
    July 1997 Doctor Dobb's Journal, "Treaps in Java".  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 79e6668d0afe..55cca8344415 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
    has been sorted into the right order and has NULL arguments in the
    correct places for missing optional arguments.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/class.cc b/gcc/fortran/class.cc
index f9e0d416e487..4b2234a958fc 100644
--- a/gcc/fortran/class.cc
+++ b/gcc/fortran/class.cc
@@ -56,6 +56,7 @@  along with GCC; see the file COPYING3.  If not see
    type-bound procedures.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/constructor.cc b/gcc/fortran/constructor.cc
index 942e26397321..8a4e11d86861 100644
--- a/gcc/fortran/constructor.cc
+++ b/gcc/fortran/constructor.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/convert.cc b/gcc/fortran/convert.cc
index 674e3f425e85..187bda64063e 100644
--- a/gcc/fortran/convert.cc
+++ b/gcc/fortran/convert.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
    different data types for the translation of the gfortran internal
    representation to GIMPLE.  The only entry point is `convert'.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
index 7c5f00cfd690..9d662ac5ab23 100644
--- a/gcc/fortran/cpp.cc
+++ b/gcc/fortran/cpp.cc
@@ -16,6 +16,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/data.cc b/gcc/fortran/data.cc
index d80ba66d358d..a5671d132c5a 100644
--- a/gcc/fortran/data.cc
+++ b/gcc/fortran/data.cc
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
    etc., to convert the initial value. Refer to trans-expr.cc and
    trans-array.cc.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 81e5e6269f6e..991555811899 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
index 15edf1af9dff..2d3db9541bba 100644
--- a/gcc/fortran/dependency.cc
+++ b/gcc/fortran/dependency.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    have different dependency checking functions for different types
    if dependencies.  Ideally these would probably be merged.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index bc8a95a809b2..ea5d2ab66a6f 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 
    TODO: Dump DATA.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc
index d184ffd878ad..3da6867cf259 100644
--- a/gcc/fortran/error.cc
+++ b/gcc/fortran/error.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
    for possible use later.  If a line does not match a legal
    construction, then the saved error message is reported.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 36baa9bb4c8e..5c64e89d7203 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/f95-lang.cc b/gcc/fortran/f95-lang.cc
index 770f31b221d6..611c299b654a 100644
--- a/gcc/fortran/f95-lang.cc
+++ b/gcc/fortran/f95-lang.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* declare required prototypes: */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc
index c7cb9d2a3892..24c71807aeeb 100644
--- a/gcc/fortran/frontend-passes.cc
+++ b/gcc/fortran/frontend-passes.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index b592fe4f6c7f..ca5d4aa10282 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -63,6 +63,7 @@  along with GCC; see the file COPYING3.  If not see
    formal argument list points to symbols within the same namespace as
    the program unit name.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index c6fb0a6de45a..61558d487502 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc
index 6fd69f7c9a8f..7c519f8f0cfa 100644
--- a/gcc/fortran/io.cc
+++ b/gcc/fortran/io.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc
index 9fb221284928..d8b216bcc67c 100644
--- a/gcc/fortran/iresolve.cc
+++ b/gcc/fortran/iresolve.cc
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
    code node is passed.  The result type and library subroutine name
    are generally set according to the function arguments.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 0cd78a57a2f7..f3b21cddae8a 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/matchexp.cc b/gcc/fortran/matchexp.cc
index 9e773cf8feeb..f7185d5aa4ff 100644
--- a/gcc/fortran/matchexp.cc
+++ b/gcc/fortran/matchexp.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/misc.cc b/gcc/fortran/misc.cc
index 991829516efe..0ef6679fee9c 100644
--- a/gcc/fortran/misc.cc
+++ b/gcc/fortran/misc.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 880aef2c7a89..9ab4d2bf1ea3 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -64,6 +64,7 @@  along with GCC; see the file COPYING3.  If not see
    which are zero based.  Symbols are written to the module in no
    particular order.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 2c12f5e362d6..d9e1372c75fb 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #define INCLUDE_STRING
 #include "config.h"
diff --git a/gcc/fortran/options.cc b/gcc/fortran/options.cc
index a55f1f36f3f9..db7bfa001009 100644
--- a/gcc/fortran/options.cc
+++ b/gcc/fortran/options.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc
index 9e06dbf0911d..f1ec2ba14b89 100644
--- a/gcc/fortran/parse.cc
+++ b/gcc/fortran/parse.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index c11359a559b2..99a6e71d9f48 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index ebe449e71190..527eee49efe3 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/scanner.cc b/gcc/fortran/scanner.cc
index 0631e7b8284c..4e835d47570a 100644
--- a/gcc/fortran/scanner.cc
+++ b/gcc/fortran/scanner.cc
@@ -40,6 +40,7 @@  along with GCC; see the file COPYING3.  If not see
    From the scanner's viewpoint, the higher level subroutines ask for
    new characters and do a lot of jumping backwards.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index 2f6c3c39dad8..1e2fa3eb8ea2 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/st.cc b/gcc/fortran/st.cc
index 904b00080705..076b642483da 100644
--- a/gcc/fortran/st.cc
+++ b/gcc/fortran/st.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    GENERIC tree structures and from there to executable code for a
    target.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 557bd3bcc34c..513ff7cad327 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/target-memory.cc b/gcc/fortran/target-memory.cc
index c71c40320900..235ecc49e399 100644
--- a/gcc/fortran/target-memory.cc
+++ b/gcc/fortran/target-memory.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 0b8ef0b5e018..f77d408f52f5 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -75,6 +75,7 @@  along with GCC; see the file COPYING3.  If not see
    After the loop code has been added into its parent scope gfc_cleanup_loop
    is called to free all the SS allocated by the scalarizer.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc
index 481d468040e0..b2b92d39cbeb 100644
--- a/gcc/fortran/trans-common.cc
+++ b/gcc/fortran/trans-common.cc
@@ -94,6 +94,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MAP
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
diff --git a/gcc/fortran/trans-const.cc b/gcc/fortran/trans-const.cc
index 204f4df301c0..9c2d683b1a16 100644
--- a/gcc/fortran/trans-const.cc
+++ b/gcc/fortran/trans-const.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* trans-const.cc -- convert constant values */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 56b6202510e8..1ea8de378b52 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* trans-decl.cc -- Handling of backend function and variable decls, etc */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index b9f585d0d2f1..c71922254431 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* trans-expr.cc-- generate GENERIC trees for gfc_expr.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index 80d75f26b095..20ccbb123c68 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* trans-intrinsic.cc-- generate GENERIC trees for calls to intrinsics.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc
index f3580ce42b5e..83caeb2b8745 100644
--- a/gcc/fortran/trans-io.cc
+++ b/gcc/fortran/trans-io.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index d3783f56a693..01ef51937174 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 86c549704751..d6baa8da9007 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index d59c0cc19d4f..d3cbbc170805 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 
 /* trans-types.cc -- gfortran backend types */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc
index 2c5133a8e05e..7407f0af90dd 100644
--- a/gcc/fortran/trans.cc
+++ b/gcc/fortran/trans.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/fwprop.cc b/gcc/fwprop.cc
index 2ebb2f146cc6..8cba6b7ce9fa 100644
--- a/gcc/fwprop.cc
+++ b/gcc/fwprop.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/gcc-rich-location.cc b/gcc/gcc-rich-location.cc
index 568744b39a31..0fa9db8e66db 100644
--- a/gcc/gcc-rich-location.cc
+++ b/gcc/gcc-rich-location.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gcc-urlifier.cc b/gcc/gcc-urlifier.cc
index be6459e8d7c1..0db5429395eb 100644
--- a/gcc/gcc-urlifier.cc
+++ b/gcc/gcc-urlifier.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -27,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "opts.h"
 #include "options.h"
 #include "selftest.h"
+#include "make-unique.h"
 
 namespace {
 
@@ -213,10 +215,10 @@  gcc_urlifier::make_doc_url (const char *doc_url_suffix)
 
 } // anonymous namespace
 
-urlifier *
+std::unique_ptr<urlifier>
 make_gcc_urlifier (unsigned int lang_mask)
 {
-  return new gcc_urlifier (lang_mask);
+  return ::make_unique<gcc_urlifier> (lang_mask);
 }
 
 #if CHECKING_P
diff --git a/gcc/gcc-urlifier.h b/gcc/gcc-urlifier.h
index 660d4f8828e7..c4cd03cc34ae 100644
--- a/gcc/gcc-urlifier.h
+++ b/gcc/gcc-urlifier.h
@@ -21,6 +21,6 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_GCC_URLIFIER_H
 #define GCC_GCC_URLIFIER_H
 
-extern urlifier *make_gcc_urlifier (unsigned int lang_mask);
+extern std::unique_ptr<urlifier> make_gcc_urlifier (unsigned int lang_mask);
 
 #endif /* GCC_GCC_URLIFIER_H */
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 16fed46fb35f..9998fd33343f 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -27,6 +27,7 @@  CC recognizes how to compile each input file by suffixes in the file names.
 Once it knows which kind of compilation to perform, the procedure for
 compilation is specified by a string called a "spec".  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
@@ -41,6 +42,7 @@  compilation is specified by a string called a "spec".  */
 #include "gcc.h"
 #include "diagnostic.h"
 #include "diagnostic-format.h"
+#include "pretty-print-urlifier.h"
 #include "flags.h"
 #include "opts.h"
 #include "filenames.h"
diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc
index 375058c3c7b7..7f44fa9756b2 100644
--- a/gcc/gcov-dump.cc
+++ b/gcc/gcov-dump.cc
@@ -17,6 +17,7 @@  along with Gcov; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gcov-tool.cc b/gcc/gcov-tool.cc
index 100f7357bcf8..0f3c5c751102 100644
--- a/gcc/gcov-tool.cc
+++ b/gcc/gcov-tool.cc
@@ -23,6 +23,7 @@  a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
index c0ecbe8558b1..4cd0974966d9 100644
--- a/gcc/gengtype.cc
+++ b/gcc/gengtype.cc
@@ -1724,6 +1724,7 @@  open_base_files (void)
     outf_p gtype_desc_c;
 
     gtype_desc_c = create_file ("GCC", "gtype-desc.cc");
+    oprintf (gtype_desc_c, "#define INCLUDE_MEMORY\n");
     for (ifp = ifiles; *ifp; ifp++)
       oprintf (gtype_desc_c, "#include \"%s\"\n", *ifp);
     for (int j = 0; j < (int) num_build_headers; j++)
diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 9a84483f9bff..6f0e8b334ae0 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc
index 4ab086e1ab0b..7bfa75a5bd6d 100644
--- a/gcc/gimple-harden-conditionals.cc
+++ b/gcc/gimple-harden-conditionals.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc
index 70383e6e2658..f5654c3bb9f6 100644
--- a/gcc/gimple-harden-control-flow.cc
+++ b/gcc/gimple-harden-control-flow.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_ALGORITHM /* find */
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
diff --git a/gcc/gimple-if-to-switch.cc b/gcc/gimple-if-to-switch.cc
index 96ce1c380a59..4246e12606f9 100644
--- a/gcc/gimple-if-to-switch.cc
+++ b/gcc/gimple-if-to-switch.cc
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
    d) We move all GIMPLE statements in the removed blocks into the
       first one.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index 58deaf253e93..1d1e300643c7 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index 01688b8581bc..6b9043cc2dd0 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -20,6 +20,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc
index 01d7c9f6eebd..30da3af36bdf 100644
--- a/gcc/gimple-pretty-print.cc
+++ b/gcc/gimple-pretty-print.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 035076be5d87..4210841645c0 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index 0c75ad0519c0..6e082ffc9e8d 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 65d31adde54c..b02b0d329453 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index f2e2b5049aaa..f5103fd0e98f 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-infer.cc b/gcc/gimple-range-infer.cc
index 98642e2438fc..dd748248eaa5 100644
--- a/gcc/gimple-range-infer.cc
+++ b/gcc/gimple-range-infer.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-op.cc b/gcc/gimple-range-op.cc
index 68a7df8d01bc..030030cb1562 100644
--- a/gcc/gimple-range-op.cc
+++ b/gcc/gimple-range-op.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
index f64a7a5e8cae..85c3d15c9039 100644
--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-phi.cc b/gcc/gimple-range-phi.cc
index c679e4ed7f29..aeb6c400ae93 100644
--- a/gcc/gimple-range-phi.cc
+++ b/gcc/gimple-range-phi.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range-trace.cc b/gcc/gimple-range-trace.cc
index e1679a1bfc9f..5302646ed49f 100644
--- a/gcc/gimple-range-trace.cc
+++ b/gcc/gimple-range-trace.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 7ba7d464b5ea..e250b26281e3 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-backprop.cc b/gcc/gimple-ssa-backprop.cc
index e3374b181386..ea3ae0bf0438 100644
--- a/gcc/gimple-ssa-backprop.cc
+++ b/gcc/gimple-ssa-backprop.cc
@@ -84,6 +84,7 @@  along with GCC; see the file COPYING3.  If not see
    Note that this pass does not deal with direct redundancies,
    such as cos(-x)->cos(x).  match.pd handles those cases instead.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-sprintf.cc b/gcc/gimple-ssa-sprintf.cc
index 0900710647c4..2e06b9112f0b 100644
--- a/gcc/gimple-ssa-sprintf.cc
+++ b/gcc/gimple-ssa-sprintf.cc
@@ -45,6 +45,7 @@  along with GCC; see the file COPYING3.  If not see
    character arrays that a character pointer may point to as a bound
    on the longest string.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc
index 7dba4a7a781f..99103076945e 100644
--- a/gcc/gimple-ssa-store-merging.cc
+++ b/gcc/gimple-ssa-store-merging.cc
@@ -138,6 +138,7 @@ 
   [p]      (32-bit) := 0x12345678; // (val & 0xffffffff0000) >> 16;
   [p + 4B] (16-bit) := 0xabcd;     //  val & 0x00000000ffff;  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-strength-reduction.cc b/gcc/gimple-ssa-strength-reduction.cc
index 39cd9339c778..13e05b094de4 100644
--- a/gcc/gimple-ssa-strength-reduction.cc
+++ b/gcc/gimple-ssa-strength-reduction.cc
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  If not see
    If desired, it could be extended to floating-point operations under
    control of something like -funsafe-math-optimizations.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index 950d96bf9d62..904ec2bf3243 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -20,6 +20,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/gimple-ssa-warn-alloca.cc b/gcc/gimple-ssa-warn-alloca.cc
index f12e55bc7957..c85f5c773121 100644
--- a/gcc/gimple-ssa-warn-alloca.cc
+++ b/gcc/gimple-ssa-warn-alloca.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-ssa-warn-restrict.cc b/gcc/gimple-ssa-warn-restrict.cc
index d71f1331c854..4bccca52f0d1 100644
--- a/gcc/gimple-ssa-warn-restrict.cc
+++ b/gcc/gimple-ssa-warn-restrict.cc
@@ -19,6 +19,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-streamer-in.cc b/gcc/gimple-streamer-in.cc
index 61f6d069875f..d7843c5ecaae 100644
--- a/gcc/gimple-streamer-in.cc
+++ b/gcc/gimple-streamer-in.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-streamer-out.cc b/gcc/gimple-streamer-out.cc
index e63d8b4df0cc..f30f06ee720c 100644
--- a/gcc/gimple-streamer-out.cc
+++ b/gcc/gimple-streamer-out.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple.cc b/gcc/gimple.cc
index 6e28cf291e16..13aa3d27844d 100644
--- a/gcc/gimple.cc
+++ b/gcc/gimple.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 3f602469d571..29fde04568cd 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/go/go-backend.cc b/gcc/go/go-backend.cc
index 25e5d35e6f1e..69dbef664151 100644
--- a/gcc/go/go-backend.cc
+++ b/gcc/go/go-backend.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/go/go-lang.cc b/gcc/go/go-lang.cc
index 9316425b2aaf..42a21594f358 100644
--- a/gcc/go/go-lang.cc
+++ b/gcc/go/go-lang.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/graph.cc b/gcc/graph.cc
index 07da0798f51d..677dc50b61bc 100644
--- a/gcc/graph.cc
+++ b/gcc/graph.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/graphviz.cc b/gcc/graphviz.cc
index e41c8bc0ef38..daa970669533 100644
--- a/gcc/graphviz.cc
+++ b/gcc/graphviz.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/input.cc b/gcc/input.cc
index 9f5228d255c0..04462ef6f5a7 100644
--- a/gcc/input.cc
+++ b/gcc/input.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index fa7bd6a15da7..212d9ccbbfe0 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -101,6 +101,7 @@  along with GCC; see the file COPYING3.  If not see
    the second stage.  */
 
 #define INCLUDE_ALGORITHM
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index a7ce434bffb4..b77adcac8fa0 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -105,6 +105,7 @@  along with GCC; see the file COPYING3.  If not see
   pass_ipa_devirt performs simple speculative devirtualization.
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc
index b38247834065..42e3efc53b6d 100644
--- a/gcc/ipa-fnsummary.cc
+++ b/gcc/ipa-fnsummary.cc
@@ -52,6 +52,7 @@  along with GCC; see the file COPYING3.  If not see
    inlined performs analysis via its analyze_function method. */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-free-lang-data.cc b/gcc/ipa-free-lang-data.cc
index 3ad203fec4c2..80e30f587540 100644
--- a/gcc/ipa-free-lang-data.cc
+++ b/gcc/ipa-free-lang-data.cc
@@ -29,6 +29,7 @@ 
    It is intended to be language-independent but can occasionally
    calls language-dependent routines.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-icf-gimple.cc b/gcc/ipa-icf-gimple.cc
index 31f6cdbda060..73fc56557fe7 100644
--- a/gcc/ipa-icf-gimple.cc
+++ b/gcc/ipa-icf-gimple.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc
index 6f9941522c8f..29cff3127a39 100644
--- a/gcc/ipa-icf.cc
+++ b/gcc/ipa-icf.cc
@@ -51,6 +51,7 @@  along with GCC; see the file COPYING3.  If not see
 
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc
index a190cb6501b8..e52199872cf4 100644
--- a/gcc/ipa-inline-analysis.cc
+++ b/gcc/ipa-inline-analysis.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc
index 9fc41b7696d8..adabb7b6ee27 100644
--- a/gcc/ipa-inline.cc
+++ b/gcc/ipa-inline.cc
@@ -89,6 +89,7 @@  along with GCC; see the file COPYING3.  If not see
 	 This should almost always lead to reduction of code size by eliminating
 	 the need for offline copy of the function.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-modref-tree.cc b/gcc/ipa-modref-tree.cc
index 961d46621a0c..4bf7158535c5 100644
--- a/gcc/ipa-modref-tree.cc
+++ b/gcc/ipa-modref-tree.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index 19359662f8ff..c1973aa36c4c 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -53,6 +53,7 @@  along with GCC; see the file COPYING3.  If not see
        That is a vector recording what function parameters
        may escape to a function call (and with what parameter index).  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
index ad36b8389c00..e1f6f3db2999 100644
--- a/gcc/ipa-param-manipulation.cc
+++ b/gcc/ipa-param-manipulation.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #define INCLUDE_ALGORITHM
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-polymorphic-call.cc b/gcc/ipa-polymorphic-call.cc
index 81de6d7fc33a..f676357d5902 100644
--- a/gcc/ipa-polymorphic-call.cc
+++ b/gcc/ipa-polymorphic-call.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-predicate.cc b/gcc/ipa-predicate.cc
index 164aba4a1266..fbe1d6d917d0 100644
--- a/gcc/ipa-predicate.cc
+++ b/gcc/ipa-predicate.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc
index 27f411ce81a0..88e7523c0f24 100644
--- a/gcc/ipa-profile.cc
+++ b/gcc/ipa-profile.cc
@@ -37,6 +37,7 @@  along with GCC; see the file COPYING3.  If not see
      once, executed at startup and executed at exit.  These flags are used to
      control code size/performance threshold and code placement (by producing
      .text.unlikely/.text.hot/.text.startup/.text.exit subsections).  */
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 78d1fb7086d5..e96ade34b34c 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-pure-const.cc b/gcc/ipa-pure-const.cc
index b5a1dcdc154f..79fde2449d2d 100644
--- a/gcc/ipa-pure-const.cc
+++ b/gcc/ipa-pure-const.cc
@@ -31,6 +31,7 @@  along with GCC; see the file COPYING3.  If not see
    should be one of the later passes since it's information is used by
    the rest of the compilation. */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-reference.cc b/gcc/ipa-reference.cc
index 4c8a362b57b7..2930888e356a 100644
--- a/gcc/ipa-reference.cc
+++ b/gcc/ipa-reference.cc
@@ -36,6 +36,7 @@  along with GCC; see the file COPYING3.  If not see
    traumatic, promote some statics to registers, and improve aliasing
    information.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-split.cc b/gcc/ipa-split.cc
index caf6279ab218..eb1f7937a0ba 100644
--- a/gcc/ipa-split.cc
+++ b/gcc/ipa-split.cc
@@ -74,6 +74,7 @@  along with GCC; see the file COPYING3.  If not see
    7) There is nothing preventing us from producing multiple parts of single function
       when needed or splitting also the parts.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 6d6da4089251..9d8dfdb79b13 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -56,6 +56,7 @@  along with GCC; see the file COPYING3.  If not see
    ipa-param-manipulation.h for more details.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 8fa7bdf53002..6dbef204de60 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ipa-utils.cc b/gcc/ipa-utils.cc
index dbfc60ff8acb..1be96f185da2 100644
--- a/gcc/ipa-utils.cc
+++ b/gcc/ipa-utils.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc
index 17f37a3f405a..12167829b277 100644
--- a/gcc/jit/dummy-frontend.cc
+++ b/gcc/jit/dummy-frontend.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc
index 583956fb4635..e732c2287518 100644
--- a/gcc/jit/jit-playback.cc
+++ b/gcc/jit/jit-playback.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_MUTEX
 #include "libgccjit.h"
 #include "system.h"
diff --git a/gcc/jit/jit-recording.cc b/gcc/jit/jit-recording.cc
index cc7f529c9e8a..83a36db653de 100644
--- a/gcc/jit/jit-recording.cc
+++ b/gcc/jit/jit-recording.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_SSTREAM
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc
index 54fc94e4364e..fe32be449560 100644
--- a/gcc/langhooks.cc
+++ b/gcc/langhooks.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/late-combine.cc b/gcc/late-combine.cc
index 1d81b386c3d6..1b6cd0bea2c1 100644
--- a/gcc/late-combine.cc
+++ b/gcc/late-combine.cc
@@ -30,6 +30,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc
index 1d4311a8832b..e1d19f909dd6 100644
--- a/gcc/lto-cgraph.cc
+++ b/gcc/lto-cgraph.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-compress.cc b/gcc/lto-compress.cc
index bebf0277ef67..1895bb433458 100644
--- a/gcc/lto-compress.cc
+++ b/gcc/lto-compress.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-opts.cc b/gcc/lto-opts.cc
index a3a1d110329c..93ac83081f63 100644
--- a/gcc/lto-opts.cc
+++ b/gcc/lto-opts.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-section-in.cc b/gcc/lto-section-in.cc
index fc2ba1906e19..22c203b22625 100644
--- a/gcc/lto-section-in.cc
+++ b/gcc/lto-section-in.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-section-out.cc b/gcc/lto-section-out.cc
index d9c42653713f..c05e97133b74 100644
--- a/gcc/lto-section-out.cc
+++ b/gcc/lto-section-out.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc
index 15181c3f5746..c541a0524c8f 100644
--- a/gcc/lto-streamer-in.cc
+++ b/gcc/lto-streamer-in.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc
index 807b935537be..19cbd549bc63 100644
--- a/gcc/lto-streamer-out.cc
+++ b/gcc/lto-streamer-out.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-streamer.cc b/gcc/lto-streamer.cc
index 40ca6b2da1b8..884861d4dd15 100644
--- a/gcc/lto-streamer.cc
+++ b/gcc/lto-streamer.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 9d7fe18b2296..a8bf847eb8c4 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -37,6 +37,7 @@  along with GCC; see the file COPYING3.  If not see
    ./ccCJuXGv.lto.ltrans.o
 */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
@@ -52,6 +53,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "opts-diagnostic.h"
 #include "opt-suggestions.h"
 #include "opts-jobserver.h"
+#include "make-unique.h"
 
 /* Environment variable, used for passing the names of offload targets from GCC
    driver to lto-wrapper.  */
@@ -2174,7 +2176,8 @@  main (int argc, char *argv[])
   diagnostic_initialize (global_dc, 0);
   diagnostic_color_init (global_dc);
   diagnostic_urls_init (global_dc);
-  global_dc->set_option_manager (new lto_diagnostic_option_manager (), 0);
+  global_dc->set_option_manager
+    (::make_unique<lto_diagnostic_option_manager> (), 0);
 
   if (atexit (lto_wrapper_cleanup) != 0)
     fatal_error (input_location, "%<atexit%> failed");
diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
index 34aa63b179cd..77607751db52 100644
--- a/gcc/lto/lto-common.cc
+++ b/gcc/lto/lto-common.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto/lto-dump.cc b/gcc/lto/lto-dump.cc
index b570bccf8edd..be869c29431a 100644
--- a/gcc/lto/lto-dump.cc
+++ b/gcc/lto/lto-dump.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc
index 2238650fa0eb..2267b4edaf4f 100644
--- a/gcc/lto/lto-partition.cc
+++ b/gcc/lto/lto-partition.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc
index a40218beac55..b12937c6a0ad 100644
--- a/gcc/lto/lto-symtab.cc
+++ b/gcc/lto/lto-symtab.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/lto/lto.cc b/gcc/lto/lto.cc
index 1ee215d8f1d3..e5b24f243704 100644
--- a/gcc/lto/lto.cc
+++ b/gcc/lto/lto.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/m2/gm2-gcc/gcc-consolidation.h b/gcc/m2/gm2-gcc/gcc-consolidation.h
index 637ec0bcc54e..e0a94eeb279d 100644
--- a/gcc/m2/gm2-gcc/gcc-consolidation.h
+++ b/gcc/m2/gm2-gcc/gcc-consolidation.h
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/m2/gm2-gcc/m2configure.cc b/gcc/m2/gm2-gcc/m2configure.cc
index 9e0e82f86c01..d55d6c25e8fd 100644
--- a/gcc/m2/gm2-gcc/m2configure.cc
+++ b/gcc/m2/gm2-gcc/m2configure.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GNU Modula-2; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "libiberty.h"
diff --git a/gcc/multiple_target.cc b/gcc/multiple_target.cc
index 1fdd279da04a..d2c9671fc1bd 100644
--- a/gcc/multiple_target.cc
+++ b/gcc/multiple_target.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc
index cec64c4bfbd4..58d465f6c339 100644
--- a/gcc/objc/objc-act.cc
+++ b/gcc/objc/objc-act.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-encoding.cc b/gcc/objc/objc-encoding.cc
index 7cb0e5add7ba..d0078eb23be3 100644
--- a/gcc/objc/objc-encoding.cc
+++ b/gcc/objc/objc-encoding.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-gnu-runtime-abi-01.cc b/gcc/objc/objc-gnu-runtime-abi-01.cc
index 2eca5f4446bb..1f504f437f52 100644
--- a/gcc/objc/objc-gnu-runtime-abi-01.cc
+++ b/gcc/objc/objc-gnu-runtime-abi-01.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-lang.cc b/gcc/objc/objc-lang.cc
index b0b3e138ba31..430b6b2cb035 100644
--- a/gcc/objc/objc-lang.cc
+++ b/gcc/objc/objc-lang.cc
@@ -18,7 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-next-runtime-abi-01.cc b/gcc/objc/objc-next-runtime-abi-01.cc
index 32a8d694b0ec..60cd7637bf6a 100644
--- a/gcc/objc/objc-next-runtime-abi-01.cc
+++ b/gcc/objc/objc-next-runtime-abi-01.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    of additions made for properties and optional protocol methods as
    ABI=1 (module version 7).  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-next-runtime-abi-02.cc b/gcc/objc/objc-next-runtime-abi-02.cc
index 248ef641281f..a9614e65dd3b 100644
--- a/gcc/objc/objc-next-runtime-abi-02.cc
+++ b/gcc/objc/objc-next-runtime-abi-02.cc
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
    This version is intended to match (logically) the output of Apple's
    4.2.1 compiler.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objc/objc-runtime-shared-support.cc b/gcc/objc/objc-runtime-shared-support.cc
index 21a88224a0a8..bd40195a413c 100644
--- a/gcc/objc/objc-runtime-shared-support.cc
+++ b/gcc/objc/objc-runtime-shared-support.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objcp/objcp-decl.cc b/gcc/objcp/objcp-decl.cc
index 1c8912f6aa0c..9d100c926c37 100644
--- a/gcc/objcp/objcp-decl.cc
+++ b/gcc/objcp/objcp-decl.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/objcp/objcp-lang.cc b/gcc/objcp/objcp-lang.cc
index 83447f8cb589..3b54050f029c 100644
--- a/gcc/objcp/objcp-lang.cc
+++ b/gcc/objcp/objcp-lang.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 9ff9553c3ead..0c3f98627509 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index f4c5f5770474..f74b9bf5e96c 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index da2051b02797..6f7b740788df 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -22,6 +22,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc
index 64a596cf0eca..651284ba35f3 100644
--- a/gcc/omp-oacc-neuter-broadcast.cc
+++ b/gcc/omp-oacc-neuter-broadcast.cc
@@ -18,6 +18,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc
index 934fbd80bdd1..5c9853682411 100644
--- a/gcc/omp-offload.cc
+++ b/gcc/omp-offload.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 864586207ee8..14a37f709482 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 0eccb1951ef7..551cc5cf138e 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -158,6 +158,7 @@  for (i = 0; i < n_opts; i++) {
 
 print "/* This file is auto-generated by optc-gen.awk.  */"
 print ""
+print "#define INCLUDE_MEMORY"
 n_headers = split(header_name, headers, " ")
 for (i = 1; i <= n_headers; i++)
 	print "#include " quote headers[i] quote
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index b1289c281e7b..6fa10c5171ff 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -31,6 +31,7 @@ 
 END {
 print "/* This file is auto-generated by optc-save-gen.awk.  */"
 print ""
+print "#define INCLUDE_MEMORY"
 n_headers = split(header_name, headers, " ")
 for (i = 1; i <= n_headers; i++)
 	print "#include " quote headers[i] quote
diff --git a/gcc/options-urls-cc-gen.awk b/gcc/options-urls-cc-gen.awk
index a2933233abef..33715a6c1d2c 100644
--- a/gcc/options-urls-cc-gen.awk
+++ b/gcc/options-urls-cc-gen.awk
@@ -29,6 +29,7 @@  END {
 
 print "/* This file is auto-generated by options-urls-cc-gen.awk.  */"
 print ""
+print "#define INCLUDE_MEMORY"
 n_headers = split(header_name, headers, " ")
 for (i = 1; i <= n_headers; i++)
 	print "#include " quote headers[i] quote
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 70ac225e3968..ac0e2bdc61de 100644
--- a/gcc/opts-common.cc
+++ b/gcc/opts-common.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/opts-global.cc b/gcc/opts-global.cc
index a9bc0d53b586..893d29936b51 100644
--- a/gcc/opts-global.cc
+++ b/gcc/opts-global.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/opts.cc b/gcc/opts.cc
index acd53befdbfc..1c5092e22feb 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "intl.h"
diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc
index 653055fdcf67..7c18ecde620e 100644
--- a/gcc/pair-fusion.cc
+++ b/gcc/pair-fusion.cc
@@ -20,6 +20,7 @@ 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
 #define INCLUDE_LIST
+#define INCLUDE_MEMORY
 #define INCLUDE_TYPE_TRAITS
 #define INCLUDE_ARRAY
 #include "config.h"
diff --git a/gcc/passes.cc b/gcc/passes.cc
index b5475fce5228..6023c056ea30 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
    in the proper order, and counts the time used by each.
    Error messages and low-level interface to malloc also handled here.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/pointer-query.cc b/gcc/pointer-query.cc
index a85c04128ffb..fea69c8e5915 100644
--- a/gcc/pointer-query.cc
+++ b/gcc/pointer-query.cc
@@ -18,6 +18,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/predict.cc b/gcc/predict.cc
index affa037371ca..3c60fd65e9e7 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -26,7 +26,7 @@  along with GCC; see the file COPYING3.  If not see
    [3] "Corpus-based Static Branch Prediction"
        Calder, Grunwald, Lindsay, Martin, Mozer, and Zorn; PLDI '95.  */
 
-
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index 18c4b2fa3509..ef3fc746bc27 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -2461,10 +2461,10 @@  pretty_printer::~pretty_printer ()
 
 /* Base class implementation of pretty_printer::clone vfunc.  */
 
-pretty_printer *
+std::unique_ptr<pretty_printer>
 pretty_printer::clone () const
 {
-  return new pretty_printer (*this);
+  return ::make_unique<pretty_printer> (*this);
 }
 
 /* Append a string delimited by START and END to the output area of
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index ec64a167327b..96d431876057 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -21,6 +21,14 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_PRETTY_PRINT_H
 #define GCC_PRETTY_PRINT_H
 
+/* This header uses std::unique_ptr, but <memory> can't be directly
+   included due to issues with macros.  Hence it must be included from
+   system.h by defining INCLUDE_MEMORY in any source file using it.  */
+
+#ifndef INCLUDE_MEMORY
+# error "You must define INCLUDE_MEMORY before including system.h to use pretty-print.h"
+#endif
+
 #include "obstack.h"
 #include "rich-location.h"
 #include "diagnostic-url.h"
@@ -269,7 +277,7 @@  public:
 
   virtual ~pretty_printer ();
 
-  virtual pretty_printer *clone () const;
+  virtual std::unique_ptr<pretty_printer> clone () const;
 
   void set_output_stream (FILE *outfile)
   {
diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc
index 69c2e196e041..1688d4ec5c8f 100644
--- a/gcc/print-rtl.cc
+++ b/gcc/print-rtl.cc
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #endif
 
+#define INCLUDE_MEMORY
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 0dda09a99e3f..d313a2adfaf7 100644
--- a/gcc/print-tree.cc
+++ b/gcc/print-tree.cc
@@ -18,6 +18,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc
index b26f38e33e47..0f30fa261538 100644
--- a/gcc/profile-count.cc
+++ b/gcc/profile-count.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 2754dd875682..a42bca0280f7 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc
index 24e206c00cdd..8f87f18e2c48 100644
--- a/gcc/range-op-ptr.cc
+++ b/gcc/range-op-ptr.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 3f5cf0834402..937bee29b1e9 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/range.cc b/gcc/range.cc
index 5ee0edc54f6b..3b56556c87e3 100644
--- a/gcc/range.cc
+++ b/gcc/range.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/read-rtl-function.cc b/gcc/read-rtl-function.cc
index fa1aeb53759c..51dc11928d05 100644
--- a/gcc/read-rtl-function.cc
+++ b/gcc/read-rtl-function.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/rtl-error.cc b/gcc/rtl-error.cc
index 6d05f0b96268..0a92a1ad2c0f 100644
--- a/gcc/rtl-error.cc
+++ b/gcc/rtl-error.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc
index ef99759871aa..9fa7fee621c6 100644
--- a/gcc/rtl-ssa/accesses.cc
+++ b/gcc/rtl-ssa/accesses.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-ssa/blocks.cc b/gcc/rtl-ssa/blocks.cc
index dfc4e7d0610d..780a241cab67 100644
--- a/gcc/rtl-ssa/blocks.cc
+++ b/gcc/rtl-ssa/blocks.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc
index 0476296607bc..f2be1195bc09 100644
--- a/gcc/rtl-ssa/changes.cc
+++ b/gcc/rtl-ssa/changes.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-ssa/functions.cc b/gcc/rtl-ssa/functions.cc
index bffccc57aabc..b14fb076da0c 100644
--- a/gcc/rtl-ssa/functions.cc
+++ b/gcc/rtl-ssa/functions.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-ssa/insns.cc b/gcc/rtl-ssa/insns.cc
index d0c3e56b8bef..bfc6683cc458 100644
--- a/gcc/rtl-ssa/insns.cc
+++ b/gcc/rtl-ssa/insns.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-ssa/movement.cc b/gcc/rtl-ssa/movement.cc
index 38432119f334..c34c70da1944 100644
--- a/gcc/rtl-ssa/movement.cc
+++ b/gcc/rtl-ssa/movement.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_FUNCTIONAL
+#define INCLUDE_MEMORY
 #define INCLUDE_ARRAY
 #include "config.h"
 #include "system.h"
diff --git a/gcc/rtl-tests.cc b/gcc/rtl-tests.cc
index 4569770a238b..ef717cc22f32 100644
--- a/gcc/rtl-tests.cc
+++ b/gcc/rtl-tests.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc
index 5520dc235017..74f11dd215c9 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc
@@ -16,6 +16,7 @@ 
 // along with GCC; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+#define INCLUDE_MEMORY
 #include "rust-ast-resolve-expr.h"
 #include "rust-ast-resolve-stmt.h"
 #include "rust-ast-resolve-struct-expr-field.h"
diff --git a/gcc/rust/rust-attribs.cc b/gcc/rust/rust-attribs.cc
index 86d5b3dfeb9f..ddcef72f07eb 100644
--- a/gcc/rust/rust-attribs.cc
+++ b/gcc/rust/rust-attribs.cc
@@ -15,6 +15,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/rust/rust-system.h b/gcc/rust/rust-system.h
index 2382e5b1fb4e..1833b93542d1 100644
--- a/gcc/rust/rust-system.h
+++ b/gcc/rust/rust-system.h
@@ -21,6 +21,7 @@ 
 #define RUST_SYSTEM_H
 
 #define INCLUDE_ALGORITHM
+#define INCLUDE_MEMORY
 #include "config.h"
 
 /* Define this so that inttypes.h defines the PRI?64 macros even
diff --git a/gcc/sanopt.cc b/gcc/sanopt.cc
index 604db6b3912a..0d79a0271f73 100644
--- a/gcc/sanopt.cc
+++ b/gcc/sanopt.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index 3d8cff76aaf9..4f511b3ca504 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -43,6 +43,7 @@  along with GCC; see the file COPYING3.  If not see
    priorities are computed, and (3) block level: insns in the block
    are actually scheduled.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/selftest-diagnostic-path.cc b/gcc/selftest-diagnostic-path.cc
index 6d21f2e55999..1b0ba2c1a3fb 100644
--- a/gcc/selftest-diagnostic-path.cc
+++ b/gcc/selftest-diagnostic-path.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/selftest-diagnostic.cc b/gcc/selftest-diagnostic.cc
index 4e9ee921b044..a066fe20066b 100644
--- a/gcc/selftest-diagnostic.cc
+++ b/gcc/selftest-diagnostic.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/splay-tree-utils.cc b/gcc/splay-tree-utils.cc
index 6437a5a98fa6..eb99b6b0e4b4 100644
--- a/gcc/splay-tree-utils.cc
+++ b/gcc/splay-tree-utils.cc
@@ -19,6 +19,7 @@ 
 
 #define INCLUDE_ALGORITHM
 #define INCLUDE_ARRAY
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/sreal.cc b/gcc/sreal.cc
index be557e7de803..b9f049748ef3 100644
--- a/gcc/sreal.cc
+++ b/gcc/sreal.cc
@@ -47,6 +47,7 @@  along with GCC; see the file COPYING3.  If not see
 	sig == 0 && exp == -SREAL_MAX_EXP
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include <math.h>
diff --git a/gcc/stmt.cc b/gcc/stmt.cc
index ae1527f0a19a..d272a45c82b0 100644
--- a/gcc/stmt.cc
+++ b/gcc/stmt.cc
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
    The functions whose names start with `expand_' are called by the
    expander to generate RTL instructions for various kinds of constructs.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/substring-locations.cc b/gcc/substring-locations.cc
index 156c12134baf..96224d3c8d00 100644
--- a/gcc/substring-locations.cc
+++ b/gcc/substring-locations.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/symtab-clones.cc b/gcc/symtab-clones.cc
index d50a95ebec60..79c93125af50 100644
--- a/gcc/symtab-clones.cc
+++ b/gcc/symtab-clones.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/symtab-thunks.cc b/gcc/symtab-thunks.cc
index c7ca06ff4798..f754a8a96e20 100644
--- a/gcc/symtab-thunks.cc
+++ b/gcc/symtab-thunks.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index 3b018ab3ea21..5e19062987e2 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/text-art/box-drawing.cc b/gcc/text-art/box-drawing.cc
index 7057a4eac60d..e6092735bbe5 100644
--- a/gcc/text-art/box-drawing.cc
+++ b/gcc/text-art/box-drawing.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/text-art/canvas.cc b/gcc/text-art/canvas.cc
index 8e5d96808d8c..b2315d96d0df 100644
--- a/gcc/text-art/canvas.cc
+++ b/gcc/text-art/canvas.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/text-art/ruler.cc b/gcc/text-art/ruler.cc
index f80d9bb8758c..2abc36fc7c9c 100644
--- a/gcc/text-art/ruler.cc
+++ b/gcc/text-art/ruler.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_ALGORITHM
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/text-art/selftests.cc b/gcc/text-art/selftests.cc
index 2b113b6b0177..3c72c9439296 100644
--- a/gcc/text-art/selftests.cc
+++ b/gcc/text-art/selftests.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/text-art/theme.cc b/gcc/text-art/theme.cc
index e51b8ef7a84c..580c931aef2c 100644
--- a/gcc/text-art/theme.cc
+++ b/gcc/text-art/theme.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MEMORY
 #define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 5df59b79c803..e198be4350be 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -42,6 +42,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "coverage.h"
 #include "diagnostic.h"
+#include "pretty-print-urlifier.h"
 #include "varasm.h"
 #include "tree-inline.h"
 #include "realmpfr.h"	/* For GMP/MPFR/MPC versions, in print_version.  */
@@ -94,6 +95,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "dbgcnt.h"
 #include "gcc-urlifier.h"
 #include "unique-argv.h"
+#include "make-unique.h"
 
 #include "selftest.h"
 
@@ -1094,9 +1096,9 @@  general_init (const char *argv0, bool init_signals, unique_argv original_argv)
   global_dc->m_internal_error = internal_error_function;
   const unsigned lang_mask = lang_hooks.option_lang_mask ();
   global_dc->set_option_manager
-    (new compiler_diagnostic_option_manager (*global_dc,
-					     lang_mask,
-					     &global_options),
+    (::make_unique<compiler_diagnostic_option_manager> (*global_dc,
+							lang_mask,
+							&global_options),
      lang_mask);
   global_dc->set_urlifier (make_gcc_urlifier (lang_mask));
 
diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc
index fb0c95a8793a..3cf0bf34a121 100644
--- a/gcc/trans-mem.cc
+++ b/gcc/trans-mem.cc
@@ -19,6 +19,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-affine.cc b/gcc/tree-affine.cc
index 76117aa4fd6d..1373664dff1c 100644
--- a/gcc/tree-affine.cc
+++ b/gcc/tree-affine.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-call-cdce.cc b/gcc/tree-call-cdce.cc
index befe6acf178a..077d6fda6e8b 100644
--- a/gcc/tree-call-cdce.cc
+++ b/gcc/tree-call-cdce.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index fcb488d87113..a850146987fd 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-chrec.cc b/gcc/tree-chrec.cc
index 9b272074a2ed..0c9776f29997 100644
--- a/gcc/tree-chrec.cc
+++ b/gcc/tree-chrec.cc
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
    variables.
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-dfa.cc b/gcc/tree-dfa.cc
index 77e119a6b1b2..96719463e690 100644
--- a/gcc/tree-dfa.cc
+++ b/gcc/tree-dfa.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-diagnostic-client-data-hooks.cc b/gcc/tree-diagnostic-client-data-hooks.cc
index a2e4a5c97bd5..d966cf50f0d3 100644
--- a/gcc/tree-diagnostic-client-data-hooks.cc
+++ b/gcc/tree-diagnostic-client-data-hooks.cc
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "plugin.h"
 #include "timevar.h"
+#include "make-unique.h"
 
 /* Concrete class for supplying a diagnostic_context with information
    about a specific plugin within the client, when the client is the
@@ -166,8 +167,8 @@  private:
 /* Create a compiler_data_hooks (so that the class can be local
    to this file).  */
 
-diagnostic_client_data_hooks *
+std::unique_ptr<diagnostic_client_data_hooks>
 make_compiler_data_hooks ()
 {
-  return new compiler_data_hooks ();
+  return ::make_unique<compiler_data_hooks> ();
 }
diff --git a/gcc/tree-diagnostic.cc b/gcc/tree-diagnostic.cc
index 39471021d0f4..b7d2c51c984c 100644
--- a/gcc/tree-diagnostic.cc
+++ b/gcc/tree-diagnostic.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-dump.cc b/gcc/tree-dump.cc
index 3b5864eecb67..3aa387fff853 100644
--- a/gcc/tree-dump.cc
+++ b/gcc/tree-dump.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 037fd1e946ae..e869b0722a0a 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc
index fc61d47ca777..78d5b922fa61 100644
--- a/gcc/tree-into-ssa.cc
+++ b/gcc/tree-into-ssa.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-logical-location.cc b/gcc/tree-logical-location.cc
index ca8b34a42d36..5967e13e1ff9 100644
--- a/gcc/tree-logical-location.cc
+++ b/gcc/tree-logical-location.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index fc0495d64431..a54e72c32370 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -17,6 +17,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-nrv.cc b/gcc/tree-nrv.cc
index 0a8f359790a8..aa01b96c953c 100644
--- a/gcc/tree-nrv.cc
+++ b/gcc/tree-nrv.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
index 6544730e1539..64f89bc9012b 100644
--- a/gcc/tree-object-size.cc
+++ b/gcc/tree-object-size.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-outof-ssa.cc b/gcc/tree-outof-ssa.cc
index 6d9c125f4e0d..1d9a4a370fae 100644
--- a/gcc/tree-outof-ssa.cc
+++ b/gcc/tree-outof-ssa.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index b378ffbfb4ca..7e519949e081 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
index 153c9323040a..91a14927cdc4 100644
--- a/gcc/tree-profile.cc
+++ b/gcc/tree-profile.cc
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 /* Generate basic block profile instrumentation and auxiliary files.
    Tree-based version.  See profile.cc for overview.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc
index abb2bad77737..357e21013e11 100644
--- a/gcc/tree-scalar-evolution.cc
+++ b/gcc/tree-scalar-evolution.cc
@@ -253,6 +253,7 @@  along with GCC; see the file COPYING3.  If not see
    at: http://cri.ensmp.fr/~pop/gcc/20040604/gccsummit-lno-spop.pdf
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index 64e2f007d680..a8e86f04fb41 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -71,6 +71,7 @@  along with GCC; see the file COPYING3.  If not see
       Finally, if a parameter got scalarized, the scalar replacements are
       initialized with values from respective parameter aggregates.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-address.cc b/gcc/tree-ssa-address.cc
index c4dfa371bb8c..61f54ec07768 100644
--- a/gcc/tree-ssa-address.cc
+++ b/gcc/tree-ssa-address.cc
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 /* Utility functions for manipulation with TARGET_MEM_REFs -- tree expressions
    that directly map to addressing modes of the target.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index fab048b0b594..2cdb5c92b7a2 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc
index a5f6ef5f5ddd..08d1e359b91c 100644
--- a/gcc/tree-ssa-ccp.cc
+++ b/gcc/tree-ssa-ccp.cc
@@ -118,6 +118,7 @@  along with GCC; see the file COPYING3.  If not see
      Advanced Compiler Design and Implementation,
      Steven Muchnick, Morgan Kaufmann, 1997, Section 12.6  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-coalesce.cc b/gcc/tree-ssa-coalesce.cc
index 8d8727de32f1..8c9aafb98d7e 100644
--- a/gcc/tree-ssa-coalesce.cc
+++ b/gcc/tree-ssa-coalesce.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-copy.cc b/gcc/tree-ssa-copy.cc
index 9c9ec47adcaa..6cbf59412e77 100644
--- a/gcc/tree-ssa-copy.cc
+++ b/gcc/tree-ssa-copy.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
index 3075459e25f4..9234af790223 100644
--- a/gcc/tree-ssa-dce.cc
+++ b/gcc/tree-ssa-dce.cc
@@ -42,6 +42,7 @@  along with GCC; see the file COPYING3.  If not see
       giving values to operands in necessary statements; and
    3. Removing dead statements.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 221fe6db3218..ef4e6c1c64ae 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 766eaf0e4e79..7af4dc1f8dff 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 6a3bc99190d9..f8064094c426 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index 6552ddd1ee2f..ec936d862929 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index ccc56dc42f61..26b4147d07b4 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc
index 213f069c440c..326119383fd5 100644
--- a/gcc/tree-ssa-loop-manip.cc
+++ b/gcc/tree-ssa-loop-manip.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index f87731ef8929..99f4b78b5ef4 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc
index 68435485b791..8427b010b3c9 100644
--- a/gcc/tree-ssa-loop-split.cc
+++ b/gcc/tree-ssa-loop-split.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
index f9ccdf41d67f..e78ef76bd3bf 100644
--- a/gcc/tree-ssa-math-opts.cc
+++ b/gcc/tree-ssa-math-opts.cc
@@ -84,6 +84,7 @@  along with GCC; see the file COPYING3.  If not see
    The data structures would be more complex in order to work on all the
    variables in a single pass.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-operands.cc b/gcc/tree-ssa-operands.cc
index 1dbf6b9c7c49..a01aa51f1cc6 100644
--- a/gcc/tree-ssa-operands.cc
+++ b/gcc/tree-ssa-operands.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-phiprop.cc b/gcc/tree-ssa-phiprop.cc
index 2a1cdae46d27..ded0a4e6fb39 100644
--- a/gcc/tree-ssa-phiprop.cc
+++ b/gcc/tree-ssa-phiprop.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc
index 13f2c8a5420d..7cbad301cebb 100644
--- a/gcc/tree-ssa-pre.cc
+++ b/gcc/tree-ssa-pre.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index d96d0a9fe19b..43b17606a161 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -18,6 +18,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index 347350fc98df..a898658da34d 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index abf7d38d15cb..4fa37cd71721 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-scopedtables.cc b/gcc/tree-ssa-scopedtables.cc
index c367d37fa9b5..3f43b64e8980 100644
--- a/gcc/tree-ssa-scopedtables.cc
+++ b/gcc/tree-ssa-scopedtables.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc
index 8c551e42a4d2..eace914e72bd 100644
--- a/gcc/tree-ssa-sink.cc
+++ b/gcc/tree-ssa-sink.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc
index ee60909aa21a..25c0adabbcd0 100644
--- a/gcc/tree-ssa-strlen.cc
+++ b/gcc/tree-ssa-strlen.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index 73ba5aa6195c..a6adec3b0b64 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -18,6 +18,7 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-ter.cc b/gcc/tree-ssa-ter.cc
index 9b338bd26956..890ad0110841 100644
--- a/gcc/tree-ssa-ter.cc
+++ b/gcc/tree-ssa-ter.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssa-uninit.cc b/gcc/tree-ssa-uninit.cc
index 726684e472aa..9c3c6878ac96 100644
--- a/gcc/tree-ssa-uninit.cc
+++ b/gcc/tree-ssa-uninit.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #define INCLUDE_STRING
 #include "config.h"
 #include "system.h"
diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
index f4fa4e98c5d0..7c6807cdb98c 100644
--- a/gcc/tree-ssa.cc
+++ b/gcc/tree-ssa.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index 4f83fcbb5171..caf667f417c5 100644
--- a/gcc/tree-ssanames.cc
+++ b/gcc/tree-ssanames.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-stdarg.cc b/gcc/tree-stdarg.cc
index 33763cd3d112..79b549ad6fa7 100644
--- a/gcc/tree-stdarg.cc
+++ b/gcc/tree-stdarg.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-streamer-in.cc b/gcc/tree-streamer-in.cc
index 329d218e7d4e..97602d1962d4 100644
--- a/gcc/tree-streamer-in.cc
+++ b/gcc/tree-streamer-in.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-streamer-out.cc b/gcc/tree-streamer-out.cc
index 81f5aeb30a6d..f0814fa37a7e 100644
--- a/gcc/tree-streamer-out.cc
+++ b/gcc/tree-streamer-out.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-streamer.cc b/gcc/tree-streamer.cc
index f4e1290b20f5..a5394145bc63 100644
--- a/gcc/tree-streamer.cc
+++ b/gcc/tree-streamer.cc
@@ -20,6 +20,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index 00426d400006..33023875ef97 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -22,6 +22,7 @@  Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 /* This file handles the lowering of GIMPLE_SWITCH to an indexed
    load, or a series of bit-test-and-branch expressions.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc
index 1901b1a13f99..d188da79aaf2 100644
--- a/gcc/tree-tailcall.cc
+++ b/gcc/tree-tailcall.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index a19f8ec24266..c265672bf99a 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 095c02c54741..a2022ae27cf4 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
    It is intended to be language-independent but can occasionally
    calls language-dependent routines.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/ubsan.cc b/gcc/ubsan.cc
index 76ca7a04265b..ae48dc93475a 100644
--- a/gcc/ubsan.cc
+++ b/gcc/ubsan.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-pointer-equiv.cc b/gcc/value-pointer-equiv.cc
index cfb53ab4eeef..3e415c5efea4 100644
--- a/gcc/value-pointer-equiv.cc
+++ b/gcc/value-pointer-equiv.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc
index ddb4b4e1ee59..61578bedf0a7 100644
--- a/gcc/value-prof.cc
+++ b/gcc/value-prof.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index cac2cb5b2bc0..0ead7806f127 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
index b11d64947741..cbd7bc5d5e16 100644
--- a/gcc/value-range-pretty-print.cc
+++ b/gcc/value-range-pretty-print.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc
index d3d98f98d7b1..b74ae7f0ad7b 100644
--- a/gcc/value-range-storage.cc
+++ b/gcc/value-range-storage.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 3046232bbca2..775e97da11ce 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -19,6 +19,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index d8a2ed920a82..5c7986e23fb0 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
index 08174669c269..5f1358c1ac25 100644
--- a/gcc/var-tracking.cc
+++ b/gcc/var-tracking.cc
@@ -85,6 +85,7 @@ 
 
 */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/varpool.cc b/gcc/varpool.cc
index e40504d1bd80..0b5d448f7c33 100644
--- a/gcc/varpool.cc
+++ b/gcc/varpool.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index cf273a3fc623..6db17042a34a 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -17,6 +17,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/wide-int-print.cc b/gcc/wide-int-print.cc
index 3e02ee123089..c4ee7791bc36 100644
--- a/gcc/wide-int-print.cc
+++ b/gcc/wide-int-print.cc
@@ -18,6 +18,7 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
index f443408c4ab7..e93f5859dc0f 100644
--- a/libgcc/libgcov-util.c
+++ b/libgcc/libgcov-util.c
@@ -27,6 +27,7 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #define IN_GCOV_TOOL 1
 
+#define INCLUDE_MEMORY
 #include "libgcov.h"
 #include "intl.h"
 #include "diagnostic.h"