From ed33b9d764518e2553d7bd9f34b66f0e19043e0e Mon Sep 17 00:00:00 2001
From: davidxl
Date: Thu, 30 Jan 2014 05:39:37 +0000
Subject: [PATCH] Merged revisions
207156,207159,207161-207172,207180-207182,207193-207200,207204-207205,207208-207209,207214-207215,207223-207225,207228,207230-207232,207234-207244,207246-207269,207271-207276,207280-207283,207285,207287-207288
via svnmerge from svn+ssh://gcc.gnu.org/svn/gcc/trunk
Fixed compiler ICE in Wself-assign-non-pod-1.C
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/google@207296 138bc75d-0d04-0410-961f-82ee72b054a4
---
main/contrib/ChangeLog | 4 +
main/contrib/mklog | 52 +-
main/gcc/ChangeLog | 238 +++
main/gcc/DATESTAMP | 2 +-
main/gcc/Makefile.in | 3 +-
main/gcc/ada/ChangeLog | 419 +++++
main/gcc/ada/a-excach.adb | 4 +-
main/gcc/ada/a-except-2005.adb | 12 +-
main/gcc/ada/a-except-2005.ads | 2 +-
main/gcc/ada/a-except.adb | 6 +-
main/gcc/ada/a-except.ads | 4 +-
main/gcc/ada/a-excpol-abort.adb | 4 +-
main/gcc/ada/a-exstat.adb | 4 +-
main/gcc/ada/a-numaux-darwin.ads | 4 +-
main/gcc/ada/a-numaux-libc-x86.ads | 4 +-
main/gcc/ada/a-numaux-vms.ads | 4 +-
main/gcc/ada/a-numaux-vxworks.ads | 4 +-
main/gcc/ada/a-numaux-x86.ads | 2 +-
main/gcc/ada/a-numaux.ads | 4 +-
main/gcc/ada/a-taside.adb | 2 +-
main/gcc/ada/a-teioed.adb | 30 +-
main/gcc/ada/a-textio.adb | 4 +-
main/gcc/ada/a-textio.ads | 4 +-
main/gcc/ada/a-witeio.adb | 22 +-
main/gcc/ada/a-witeio.ads | 4 +-
main/gcc/ada/a-wtedit.adb | 23 +-
main/gcc/ada/a-ztedit.adb | 26 +-
main/gcc/ada/a-ztexio.adb | 6 +-
main/gcc/ada/a-ztexio.ads | 4 +-
main/gcc/ada/ali.adb | 2 +-
main/gcc/ada/aspects.adb | 1 +
main/gcc/ada/aspects.ads | 6 +-
main/gcc/ada/atree.adb | 23 +-
main/gcc/ada/atree.ads | 8 +-
main/gcc/ada/atree.h | 1 +
main/gcc/ada/back_end.ads | 11 +
main/gcc/ada/bcheck.adb | 2 +-
main/gcc/ada/binde.adb | 14 +-
main/gcc/ada/checks.adb | 58 +-
main/gcc/ada/clean.adb | 6 +
main/gcc/ada/comperr.adb | 20 +-
main/gcc/ada/cstand.adb | 6 +-
main/gcc/ada/debug_a.adb | 4 +-
main/gcc/ada/einfo.adb | 69 +-
main/gcc/ada/einfo.ads | 57 +-
main/gcc/ada/errout.adb | 6 +-
main/gcc/ada/erroutc.adb | 4 +-
main/gcc/ada/erroutc.ads | 2 +-
main/gcc/ada/eval_fat.adb | 4 +-
main/gcc/ada/exp_aggr.adb | 6 +-
main/gcc/ada/exp_attr.adb | 12 +-
main/gcc/ada/exp_ch11.adb | 10 +-
main/gcc/ada/exp_ch3.adb | 23 +-
main/gcc/ada/exp_ch4.adb | 20 +-
main/gcc/ada/exp_ch5.adb | 8 +-
main/gcc/ada/exp_ch6.adb | 16 +-
main/gcc/ada/exp_ch9.adb | 242 ++-
main/gcc/ada/exp_dbug.adb | 19 +-
main/gcc/ada/exp_disp.adb | 14 +-
main/gcc/ada/exp_fixd.adb | 8 +-
main/gcc/ada/exp_imgv.adb | 5 +-
main/gcc/ada/exp_intr.adb | 4 +-
main/gcc/ada/exp_util.adb | 16 +-
main/gcc/ada/expander.adb | 10 +-
main/gcc/ada/freeze.adb | 18 +-
main/gcc/ada/frontend.adb | 2 +-
main/gcc/ada/g-comlin.ads | 4 +-
main/gcc/ada/g-mbdira.adb | 4 +-
main/gcc/ada/g-spipat.adb | 4 +-
main/gcc/ada/gnat1drv.adb | 10 +-
main/gcc/ada/gnat_rm.texi | 131 +-
main/gcc/ada/gnat_ugn.texi | 75 +
main/gcc/ada/gnatcmd.adb | 6 +
main/gcc/ada/gnatlink.adb | 2 +-
main/gcc/ada/gprep.adb | 4 +-
main/gcc/ada/i-cpp.ads | 4 +-
main/gcc/ada/i-vxwork-x86.ads | 41 +-
main/gcc/ada/i-vxwork.ads | 59 +-
main/gcc/ada/inline.ads | 5 +
main/gcc/ada/krunch.ads | 4 +-
main/gcc/ada/layout.adb | 10 +-
main/gcc/ada/lib-load.adb | 2 +-
main/gcc/ada/lib-writ.adb | 2 +-
main/gcc/ada/lib-writ.ads | 2 +-
main/gcc/ada/live.adb | 4 +-
main/gcc/ada/make.adb | 7 +
main/gcc/ada/makeutl.adb | 34 +-
main/gcc/ada/makeutl.ads | 6 +-
main/gcc/ada/namet.ads | 2 +-
main/gcc/ada/osint-c.adb | 4 +-
main/gcc/ada/osint.adb | 5 +-
main/gcc/ada/output.ads | 4 +-
main/gcc/ada/par-ch10.adb | 6 +-
main/gcc/ada/par-ch13.adb | 2 +-
main/gcc/ada/par-ch3.adb | 6 +-
main/gcc/ada/par-ch4.adb | 8 +-
main/gcc/ada/par-ch5.adb | 4 +-
main/gcc/ada/par-ch6.adb | 6 +-
main/gcc/ada/par-ch9.adb | 6 +-
main/gcc/ada/par-endh.adb | 4 +-
main/gcc/ada/par-labl.adb | 4 +-
main/gcc/ada/par-prag.adb | 3 +-
main/gcc/ada/par-sync.adb | 6 +-
main/gcc/ada/par-tchk.adb | 22 +-
main/gcc/ada/par-util.adb | 6 +-
main/gcc/ada/par.adb | 6 +-
main/gcc/ada/prj-makr.adb | 8 +
main/gcc/ada/prj-part.adb | 37 +
main/gcc/ada/prj.adb | 2 +-
main/gcc/ada/projects.texi | 27 +-
main/gcc/ada/repinfo.adb | 2 +-
main/gcc/ada/rtsfind.adb | 4 +-
main/gcc/ada/rtsfind.ads | 3 -
main/gcc/ada/s-arit64.adb | 4 +-
main/gcc/ada/s-asthan-vms-alpha.adb | 4 +-
main/gcc/ada/s-asthan-vms-ia64.adb | 4 +-
main/gcc/ada/s-bignum.adb | 4 +-
main/gcc/ada/s-dimmks.ads | 2 +-
main/gcc/ada/s-fatgen.adb | 4 +-
main/gcc/ada/s-fatgen.ads | 4 +-
main/gcc/ada/s-fileio.adb | 6 +-
main/gcc/ada/s-imgcha.adb | 4 +-
main/gcc/ada/s-imgrea.adb | 4 +-
main/gcc/ada/s-os_lib.adb | 9 +-
main/gcc/ada/s-os_lib.ads | 7 +-
main/gcc/ada/s-regexp.adb | 225 ++-
main/gcc/ada/s-regpat.adb | 2 +-
main/gcc/ada/s-secsta.adb | 4 +-
main/gcc/ada/s-stalib.ads | 2 +-
main/gcc/ada/s-stchop.adb | 6 +-
main/gcc/ada/s-stoele.ads | 4 +-
main/gcc/ada/s-taprop-solaris.adb | 4 +-
main/gcc/ada/s-tasdeb-vms.adb | 16 +-
main/gcc/ada/s-tasini.adb | 4 +-
main/gcc/ada/s-tassta.adb | 6 +-
main/gcc/ada/s-tposen.adb | 16 +-
main/gcc/ada/s-tposen.ads | 6 -
main/gcc/ada/s-valdec.adb | 4 +-
main/gcc/ada/s-valuti.adb | 2 +-
main/gcc/ada/s-wchjis.adb | 6 +-
main/gcc/ada/s-wchwts.adb | 6 +-
main/gcc/ada/scans.adb | 4 +-
main/gcc/ada/scng.adb | 4 +-
main/gcc/ada/sem_aggr.adb | 2 +-
main/gcc/ada/sem_attr.adb | 12 +-
main/gcc/ada/sem_aux.adb | 2 +-
main/gcc/ada/sem_cat.adb | 2 +-
main/gcc/ada/sem_ch10.adb | 5 +-
main/gcc/ada/sem_ch12.adb | 42 +-
main/gcc/ada/sem_ch13.adb | 95 +-
main/gcc/ada/sem_ch13.ads | 2 +-
main/gcc/ada/sem_ch3.adb | 215 +--
main/gcc/ada/sem_ch4.adb | 52 +-
main/gcc/ada/sem_ch5.adb | 8 +-
main/gcc/ada/sem_ch6.adb | 125 +-
main/gcc/ada/sem_ch7.adb | 145 +-
main/gcc/ada/sem_ch7.ads | 35 +-
main/gcc/ada/sem_ch8.adb | 10 +-
main/gcc/ada/sem_disp.adb | 12 +-
main/gcc/ada/sem_elab.adb | 4 +-
main/gcc/ada/sem_elim.adb | 4 +-
main/gcc/ada/sem_eval.adb | 10 +-
main/gcc/ada/sem_intr.adb | 4 +-
main/gcc/ada/sem_prag.adb | 1667 +++++++++++++++-----
main/gcc/ada/sem_prag.ads | 5 +
main/gcc/ada/sem_res.adb | 15 +-
main/gcc/ada/sem_type.adb | 2 +-
main/gcc/ada/sem_util.adb | 243 ++-
main/gcc/ada/sem_util.ads | 122 +-
main/gcc/ada/sem_warn.adb | 27 +-
main/gcc/ada/sem_warn.ads | 2 +-
main/gcc/ada/set_targ.adb | 2 +-
main/gcc/ada/sinfo.ads | 12 +-
main/gcc/ada/sinput-c.adb | 4 +-
main/gcc/ada/snames.ads-tmpl | 5 +-
main/gcc/ada/sprint.adb | 4 +-
main/gcc/ada/stand.ads | 2 +-
main/gcc/ada/system-vms-ia64.ads | 2 +-
main/gcc/ada/system-vms_64.ads | 5 +-
main/gcc/ada/system.ads | 4 +-
main/gcc/ada/treepr.adb | 6 +-
main/gcc/ada/treepr.ads | 2 +-
main/gcc/ada/types.ads | 2 +-
main/gcc/ada/uintp.adb | 4 +-
main/gcc/ada/uname.adb | 4 +-
main/gcc/ada/urealp.adb | 4 +-
main/gcc/ada/usage.adb | 3 +-
main/gcc/ada/vms_conv.adb | 4 +-
main/gcc/ada/vxaddr2line.adb | 4 +-
main/gcc/builtins.c | 14 -
main/gcc/builtins.def | 1 -
main/gcc/c-family/c-common.c | 4 +
main/gcc/config/aarch64/aarch64.c | 6 +-
main/gcc/config/arm/arm-arches.def | 1 +
main/gcc/config/arm/arm.c | 41 +-
main/gcc/config/arm/bpabi.h | 2 +
main/gcc/config/arm/driver-arm.c | 6 +-
main/gcc/config/arm/t-aprofile | 72 +-
main/gcc/config/i386/gnu-user64.h | 6 +-
main/gcc/config/i386/i386.c | 6 +
main/gcc/config/i386/i386.h | 2 +
main/gcc/config/i386/i386.opt | 6 +-
main/gcc/config/rs6000/altivec.md | 323 +++-
main/gcc/config/rs6000/rs6000.c | 18 +-
main/gcc/config/rs6000/vsx.md | 58 +-
main/gcc/configure | 7 +-
main/gcc/configure.ac | 7 +-
main/gcc/cp/ChangeLog | 112 ++
main/gcc/cp/call.c | 71 +-
main/gcc/cp/decl.c | 35 +-
main/gcc/cp/friend.c | 8 +-
main/gcc/cp/mangle.c | 3 +
main/gcc/cp/optimize.c | 2 +-
main/gcc/cp/pt.c | 49 +-
main/gcc/cp/semantics.c | 7 +-
main/gcc/cp/typeck.c | 7 +-
main/gcc/doc/invoke.texi | 15 +-
main/gcc/doc/md.texi | 3 +-
main/gcc/dwarf2out.c | 40 +
main/gcc/fortran/ChangeLog | 10 +
main/gcc/fortran/trans-stmt.c | 39 +
main/gcc/gimple-low.c | 51 +-
main/gcc/go/gofrontend/gogo.cc | 11 +-
main/gcc/input.c | 8 +-
main/gcc/internal-fn.c | 5 +
main/gcc/internal-fn.def | 1 +
main/gcc/ipa-inline-analysis.c | 56 +
main/gcc/lto-streamer.h | 4 +-
main/gcc/omp-low.c | 11 +-
main/gcc/omp-low.h | 2 +-
main/gcc/profile.c | 19 +-
main/gcc/read-rtl.c | 3 +
main/gcc/testsuite/ChangeLog | 83 +-
.../c-c++-common/cpp/warning-zero-location-2.c | 10 +
.../c-c++-common/cpp/warning-zero-location.c | 8 +
main/gcc/testsuite/c-c++-common/gomp/pr59917-1.c | 22 +
main/gcc/testsuite/c-c++-common/gomp/pr59917-2.c | 22 +
main/gcc/testsuite/g++.dg/cpp0x/initlist22.C | 10 +-
main/gcc/testsuite/g++.dg/cpp0x/initlist76.C | 5 +
main/gcc/testsuite/g++.dg/cpp0x/initlist77.C | 10 +
main/gcc/testsuite/g++.dg/cpp0x/initlist78.C | 12 +
.../g++.dg/cpp0x/lambda/lambda-decltype1.C | 21 +
main/gcc/testsuite/g++.dg/cpp0x/nsdmi-union5.C | 11 +
main/gcc/testsuite/g++.dg/cpp0x/overload3.C | 17 +
main/gcc/testsuite/g++.dg/cpp0x/pr58674.C | 18 +
main/gcc/testsuite/g++.dg/cpp0x/static_assert9.C | 7 +
main/gcc/testsuite/g++.dg/cpp0x/variadic146.C | 9 +
main/gcc/testsuite/g++.dg/cpp0x/variadic147.C | 10 +
main/gcc/testsuite/g++.dg/cpp0x/variadic148.C | 6 +
main/gcc/testsuite/g++.dg/cpp1y/auto-fn12.C | 2 +-
main/gcc/testsuite/g++.dg/cpp1y/auto-fn22.C | 9 +
main/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C | 9 +
main/gcc/testsuite/g++.dg/debug/dwarf2/auto1.C | 30 +
main/gcc/testsuite/g++.dg/ext/attrib48.C | 6 +
main/gcc/testsuite/g++.dg/ext/stmtexpr15.C | 7 +
main/gcc/testsuite/g++.dg/ext/traits1.C | 4 +
main/gcc/testsuite/g++.dg/ext/vector25.C | 6 +
main/gcc/testsuite/g++.dg/gomp/pr58702.C | 10 +
main/gcc/testsuite/g++.dg/init/dso_handle2.C | 10 +
main/gcc/testsuite/g++.dg/parse/enum5.C | 2 +-
main/gcc/testsuite/g++.dg/template/friend55.C | 18 +
main/gcc/testsuite/g++.dg/template/ptrmem24.C | 20 +
main/gcc/testsuite/g++.dg/template/shadow1.C | 4 +
main/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C | 13 +
main/gcc/testsuite/g++.dg/warn/Wunused-3.C | 2 +-
main/gcc/testsuite/gcc.dg/pr58742-1.c | 13 +
main/gcc/testsuite/gcc.dg/pr58742-2.c | 13 +
main/gcc/testsuite/gcc.dg/pr58742-3.c | 14 +
main/gcc/testsuite/gcc.dg/pr59920-1.c | 20 +
main/gcc/testsuite/gcc.dg/pr59920-2.c | 30 +
main/gcc/testsuite/gcc.dg/pr59920-3.c | 47 +
.../testsuite/gcc.dg/vect/no-vfa-vect-depend-2.c | 55 +
.../testsuite/gcc.dg/vect/no-vfa-vect-depend-3.c | 187 +++
main/gcc/testsuite/gcc.dg/vect/pr59594.c | 31 +
main/gcc/testsuite/gcc.dg/vmx/merge-be-order.c | 96 ++
main/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c | 46 +
main/gcc/testsuite/gcc.dg/vmx/merge-vsx.c | 39 +
main/gcc/testsuite/gcc.dg/vmx/merge.c | 77 +
.../testsuite/gcc.target/arm/ftest-armv7ve-arm.c | 40 +
.../testsuite/gcc.target/arm/ftest-armv7ve-thumb.c | 40 +
.../gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c | 2 +-
.../testsuite/gcc.target/i386/avx512f-gather-2.c | 8 +-
.../testsuite/gcc.target/i386/avx512f-gather-5.c | 4 +-
main/gcc/testsuite/gcc.target/mips/pr52125.c | 2 +-
.../gcc/testsuite/gfortran.dg/allocate_class_3.f90 | 107 ++
main/gcc/testsuite/lib/target-supports.exp | 1 +
main/gcc/tree-cfg.c | 381 +++--
main/gcc/tree-cfg.h | 3 +-
main/gcc/tree-data-ref.h | 26 -
main/gcc/tree-inline.c | 42 +-
main/gcc/tree-ssa-forwprop.c | 216 ++-
main/gcc/tree-vect-data-refs.c | 22 +-
main/gcc/tree.c | 6 -
main/libgcc/ChangeLog | 5 +
main/libgcc/config/aarch64/sfp-machine.h | 2 +-
main/libiberty/ChangeLog | 5 +
main/libiberty/cp-demangle.c | 4 +-
main/libstdc++-v3/ChangeLog | 66 +
main/libstdc++-v3/doc/html/api.html | 2 +-
main/libstdc++-v3/doc/html/faq.html | 28 +-
main/libstdc++-v3/doc/html/index.html | 12 +-
main/libstdc++-v3/doc/html/manual/abi.html | 22 +-
main/libstdc++-v3/doc/html/manual/algorithms.html | 2 +-
main/libstdc++-v3/doc/html/manual/api.html | 4 +-
.../doc/html/manual/appendix_contributing.html | 2 +-
.../doc/html/manual/appendix_free.html | 2 +-
.../libstdc++-v3/doc/html/manual/appendix_gpl.html | 4 +-
.../doc/html/manual/appendix_porting.html | 12 +-
main/libstdc++-v3/doc/html/manual/atomics.html | 2 +-
main/libstdc++-v3/doc/html/manual/backwards.html | 33 +-
.../doc/html/manual/bitmap_allocator_impl.html | 2 +-
main/libstdc++-v3/doc/html/manual/bugs.html | 3 -
main/libstdc++-v3/doc/html/manual/concurrency.html | 2 +-
main/libstdc++-v3/doc/html/manual/configure.html | 11 +-
main/libstdc++-v3/doc/html/manual/containers.html | 4 +-
main/libstdc++-v3/doc/html/manual/debug.html | 51 +-
.../doc/html/manual/debug_mode_using.html | 46 +-
main/libstdc++-v3/doc/html/manual/diagnostics.html | 2 +-
.../doc/html/manual/documentation_hacking.html | 8 +-
.../doc/html/manual/ext_compile_checks.html | 7 +-
main/libstdc++-v3/doc/html/manual/ext_preface.html | 2 +-
main/libstdc++-v3/doc/html/manual/extensions.html | 2 +-
main/libstdc++-v3/doc/html/manual/facets.html | 197 +--
main/libstdc++-v3/doc/html/manual/index.html | 24 +-
main/libstdc++-v3/doc/html/manual/intro.html | 16 +-
main/libstdc++-v3/doc/html/manual/io.html | 2 +-
main/libstdc++-v3/doc/html/manual/iterators.html | 2 +-
.../libstdc++-v3/doc/html/manual/localization.html | 18 +-
main/libstdc++-v3/doc/html/manual/memory.html | 40 +-
main/libstdc++-v3/doc/html/manual/numerics.html | 2 +-
.../doc/html/manual/parallel_mode.html | 4 +-
.../doc/html/manual/parallel_mode_using.html | 130 +-
.../doc/html/manual/policy_data_structures.html | 12 +-
.../html/manual/policy_data_structures_design.html | 66 +-
.../html/manual/policy_data_structures_using.html | 2 +-
.../libstdc++-v3/doc/html/manual/profile_mode.html | 2 +-
.../doc/html/manual/profile_mode_design.html | 2 +-
.../doc/html/manual/profile_mode_diagnostics.html | 2 +-
main/libstdc++-v3/doc/html/manual/status.html | 167 +-
.../libstdc++-v3/doc/html/manual/std_contents.html | 6 +-
main/libstdc++-v3/doc/html/manual/strings.html | 2 +-
main/libstdc++-v3/doc/html/manual/support.html | 12 +-
main/libstdc++-v3/doc/html/manual/test.html | 2 +-
.../doc/html/manual/unordered_associative.html | 65 +-
main/libstdc++-v3/doc/html/manual/using.html | 2 +-
.../doc/html/manual/using_exceptions.html | 16 +-
.../doc/html/manual/using_headers.html | 204 +--
main/libstdc++-v3/doc/html/manual/utilities.html | 4 +-
main/libstdc++-v3/doc/xml/manual/debug.xml | 51 +-
.../libstdc++-v3/doc/xml/manual/status_cxx2011.xml | 11 +-
main/libstdc++-v3/include/bits/alloc_traits.h | 157 +-
main/libstdc++-v3/include/bits/ptr_traits.h | 17 +-
main/libstdc++-v3/include/bits/shared_ptr.h | 24 +-
main/libstdc++-v3/include/bits/shared_ptr_base.h | 105 +-
main/libstdc++-v3/include/bits/stl_tree.h | 5 +-
main/libstdc++-v3/include/bits/stl_vector.h | 33 +-
main/libstdc++-v3/include/ext/alloc_traits.h | 51 +-
main/libstdc++-v3/include/ext/array_allocator.h | 8 +-
.../members/allocate_hint_nonpod.cc | 69 +
.../allocator_traits/requirements/typedefs2.cc | 93 ++
.../testsuite/20_util/shared_ptr/cons/43820_neg.cc | 2 +-
.../testsuite/20_util/shared_ptr/cons/void_neg.cc | 2 +-
.../testsuite/23_containers/vector/59829.cc | 67 +
.../vector/requirements/dr438/assign_neg.cc | 2 +-
.../vector/requirements/dr438/constructor_1_neg.cc | 2 +-
.../vector/requirements/dr438/constructor_2_neg.cc | 2 +-
.../vector/requirements/dr438/insert_neg.cc | 2 +-
.../testsuite/util/testsuite_allocator.h | 100 ++
368 files changed, 7841 insertions(+), 3027 deletions(-)
create mode 100644 main/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
create mode 100644 main/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
create mode 100644 main/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
create mode 100644 main/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/initlist76.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/initlist77.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/initlist78.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/nsdmi-union5.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/overload3.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/pr58674.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/static_assert9.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/variadic146.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/variadic147.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp0x/variadic148.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp1y/auto-fn22.C
create mode 100644 main/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C
create mode 100644 main/gcc/testsuite/g++.dg/debug/dwarf2/auto1.C
create mode 100644 main/gcc/testsuite/g++.dg/ext/attrib48.C
create mode 100644 main/gcc/testsuite/g++.dg/ext/stmtexpr15.C
create mode 100644 main/gcc/testsuite/g++.dg/ext/traits1.C
create mode 100644 main/gcc/testsuite/g++.dg/ext/vector25.C
create mode 100644 main/gcc/testsuite/g++.dg/gomp/pr58702.C
create mode 100644 main/gcc/testsuite/g++.dg/init/dso_handle2.C
create mode 100644 main/gcc/testsuite/g++.dg/template/friend55.C
create mode 100644 main/gcc/testsuite/g++.dg/template/ptrmem24.C
create mode 100644 main/gcc/testsuite/g++.dg/template/shadow1.C
create mode 100644 main/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
create mode 100644 main/gcc/testsuite/gcc.dg/pr58742-1.c
create mode 100644 main/gcc/testsuite/gcc.dg/pr58742-2.c
create mode 100644 main/gcc/testsuite/gcc.dg/pr58742-3.c
create mode 100644 main/gcc/testsuite/gcc.dg/pr59920-1.c
create mode 100644 main/gcc/testsuite/gcc.dg/pr59920-2.c
create mode 100644 main/gcc/testsuite/gcc.dg/pr59920-3.c
create mode 100644 main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-2.c
create mode 100644 main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-3.c
create mode 100644 main/gcc/testsuite/gcc.dg/vect/pr59594.c
create mode 100644 main/gcc/testsuite/gcc.dg/vmx/merge-be-order.c
create mode 100644 main/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c
create mode 100644 main/gcc/testsuite/gcc.dg/vmx/merge-vsx.c
create mode 100644 main/gcc/testsuite/gcc.dg/vmx/merge.c
create mode 100644 main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-arm.c
create mode 100644 main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-thumb.c
create mode 100644 main/gcc/testsuite/gfortran.dg/allocate_class_3.f90
rewrite main/libstdc++-v3/doc/html/manual/debug_mode_using.html (66%)
rewrite main/libstdc++-v3/doc/html/manual/intro.html (75%)
rewrite main/libstdc++-v3/doc/html/manual/parallel_mode_using.html (60%)
rewrite main/libstdc++-v3/doc/html/manual/using_headers.html (66%)
create mode 100644 main/libstdc++-v3/testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc
create mode 100644 main/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs2.cc
create mode 100644 main/libstdc++-v3/testsuite/23_containers/vector/59829.cc
diff --git a/main/contrib/ChangeLog b/main/contrib/ChangeLog
index 8ab57a3f28d..30163056dcd 100644
--- a/main/contrib/ChangeLog
+++ b/main/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-29 Yury Gribov
+
+ * mklog: Improve support of context diffs.
+
2014-01-21 Tatiana Udalova
* mklog: Avoid adding falsely changed functions to ChangeLog.
diff --git a/main/contrib/mklog b/main/contrib/mklog
index 8392642678b..fb489b03a3b 100755
--- a/main/contrib/mklog
+++ b/main/contrib/mklog
@@ -80,18 +80,16 @@ sub remove_suffixes ($) {
return $filename;
}
-# Check if line can be a function declaration:
-# First pattern cut extra symbols added by diff
-# second pattern checks that line is not a comment or brace
-sub is_function {
+# Check if line is a top-level declaration.
+# TODO: ignore preprocessor directives except maybe #define ?
+sub is_top_level {
my ($function, $is_context_diff) = (@_);
if ($is_context_diff) {
$function =~ s/^..//;
} else {
$function =~ s/^.//;
}
- return $function
- && ($function !~ /^[\s{}]/);
+ return $function && $function !~ /^[\s{}]/;
}
# For every file in the .diff print all the function names in ChangeLog
@@ -105,13 +103,14 @@ chomp (my @diff_lines = );
close (DFILE);
$line_idx = 0;
foreach (@diff_lines) {
- # Stop processing functions if we found a new file
+ # Stop processing functions if we found a new file.
# Remember both left and right names because one may be /dev/null.
- if (/^[+*][+*][+*] +(\S+)/) {
+ # Don't be fooled by line markers in case of context diff.
+ if (!/\*\*\*$/ && /^[+*][+*][+*] +(\S+)/) {
$left = remove_suffixes ($1);
$look_for_funs = 0;
}
- if (/^--- +(\S+)?/) {
+ if (!/---$/ && /^--- +(\S+)?/) {
$right = remove_suffixes ($1);
$look_for_funs = 0;
}
@@ -120,7 +119,7 @@ foreach (@diff_lines) {
# We should now have both left and right name,
# so we can decide filename.
- if ($left && (/^\*{15}$/ || /^@@ /)) {
+ if ($left && (/^\*{15}/ || /^@@ /)) {
# If we have not seen any function names in the previous file (ie,
# $change_msg is empty), we just write out a ':' before starting the next
# file.
@@ -145,9 +144,15 @@ foreach (@diff_lines) {
$look_for_funs = $filename =~ '\.(c|cpp|C|cc|h|inc|def)$';
}
- # Remember the last line in a unified diff block that might start
+ # Context diffs have extra whitespace after first char;
+ # remove it to make matching easier.
+ if ($is_context_diff) {
+ s/^([-+! ]) /\1/;
+ }
+
+ # Remember the last line in a diff block that might start
# a new function.
- if (/^[-+ ]([a-zA-Z0-9_].*)/) {
+ if (/^[-+! ]([a-zA-Z0-9_].*)/) {
$save_fn = $1;
}
@@ -169,9 +174,9 @@ foreach (@diff_lines) {
# Mark if we met doubtfully changed function.
$doubtfunc = 0;
- $is_context_diff = 0;
if ($diff_lines[$line_idx] =~ /^@@ .* @@ ([a-zA-Z0-9_].*)/) {
$doubtfunc = 1;
+ $is_context_diff = 0;
}
elsif ($diff_lines[$line_idx] =~ /^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/) {
$doubtfunc = 1;
@@ -184,17 +189,16 @@ foreach (@diff_lines) {
# Note that we don't try too hard to find good matches. This should
# return a superset of the actual set of functions in the .diff file.
#
- # The first two patterns work with context diff files (diff -c). The
- # third pattern works with unified diff files (diff -u).
+ # The first pattern works with context diff files (diff -c). The
+ # second pattern works with unified diff files (diff -u).
#
- # The fourth pattern looks for the starts of functions or classes
- # within a unified diff block.
+ # The third pattern looks for the starts of functions or classes
+ # within a diff block both for context and unified diff files.
if ($look_for_funs
&& (/^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/
- || /^[\-\+\!] ([a-zA-Z0-9_]+)[ \t]*\(.*/
|| /^@@ .* @@ ([a-zA-Z0-9_].*)/
- || /^[-+ ](\{)/))
+ || /^[-+! ](\{)/))
{
$_ = $1;
my $fn;
@@ -219,12 +223,16 @@ foreach (@diff_lines) {
$no_real_change = 0;
if ($doubtfunc) {
$idx = $line_idx;
+ # Skip line info in context diffs.
+ while ($is_context_diff && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
+ ++$idx;
+ }
# Check all lines till the first change
# for the presence of really changed function
do {
++$idx;
- $no_real_change = is_function ($diff_lines[$idx], $is_context_diff);
- } while (!$no_real_change && ($diff_lines[$idx] !~ /^[\+\-\!]/))
+ $no_real_change = is_top_level ($diff_lines[$idx], $is_context_diff);
+ } while (!$no_real_change && ($diff_lines[$idx] !~ /^[-+!]/))
}
if ($fn && !$seen_names{$fn} && !$no_real_change) {
# If this is the first function in the file, we display it next
@@ -246,7 +254,7 @@ foreach (@diff_lines) {
# If we have not seen any function names (ie, $change_msg is empty), we just
# write out a ':'. This happens when there is only one file with no
# functions.
-$cl_entries{$clname} .= $change_msg ? ": $change_msg\n" : ":\n";
+$cl_entries{$clname} .= $change_msg ? "$change_msg\n" : ":\n";
$temp = `mktemp /tmp/$basename.XXXXXX` || exit 1; chop ($temp);
open (CLFILE, ">$temp") or die "Could not open file $temp for writing";
diff --git a/main/gcc/ChangeLog b/main/gcc/ChangeLog
index a27272464c6..5dba715e4b7 100644
--- a/main/gcc/ChangeLog
+++ b/main/gcc/ChangeLog
@@ -1,3 +1,241 @@
+2014-01-29 Jan Hubicka
+
+ * ipa-inline-analysis.c (clobber_only_eh_bb_p): New function.
+ (estimate_function_body_sizes): Use it.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58561
+ * dwarf2out.c (is_cxx_auto): New.
+ (is_base_type): Use it.
+ (gen_type_die_with_usage): Likewise.
+
+2014-01-29 Bill Schmidt
+
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Use
+ CODE_FOR_altivec_vmrg*_direct rather than CODE_FOR_altivec_vmrg*.
+ * config/rs6000/vsx.md (vsx_mergel_): Adjust for
+ -maltivec=be with LE targets.
+ (vsx_mergeh_): Likewise.
+ * config/rs6000/altivec.md (UNSPEC_VMRG[HL]_DIRECT): New
+ unspecs.
+ (mulv8hi3): Use gen_altivec_vmrg[hl]w_direct.
+ (altivec_vmrghb): Replace with define_expand and new
+ *altivec_vmrghb_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrghb_direct): New define_insn.
+ (altivec_vmrghh): Replace with define_expand and new
+ *altivec_vmrghh_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrghh_direct): New define_insn.
+ (altivec_vmrghw): Replace with define_expand and new
+ *altivec_vmrghw_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrghw_direct): New define_insn.
+ (*altivec_vmrghsf): Adjust for endianness.
+ (altivec_vmrglb): Replace with define_expand and new
+ *altivec_vmrglb_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrglb_direct): New define_insn.
+ (altivec_vmrglh): Replace with define_expand and new
+ *altivec_vmrglh_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrglh_direct): New define_insn.
+ (altivec_vmrglw): Replace with define_expand and new
+ *altivec_vmrglw_internal insn; adjust for -maltivec=be with LE
+ targets.
+ (altivec_vmrglw_direct): New define_insn.
+ (*altivec_vmrglsf): Adjust for endianness.
+ (vec_widen_umult_hi_v16qi): Use gen_altivec_vmrghh_direct.
+ (vec_widen_umult_lo_v16qi): Use gen_altivec_vmrglh_direct.
+ (vec_widen_smult_hi_v16qi): Use gen_altivec_vmrghh_direct.
+ (vec_widen_smult_lo_v16qi): Use gen_altivec_vmrglh_direct.
+ (vec_widen_umult_hi_v8hi): Use gen_altivec_vmrghw_direct.
+ (vec_widen_umult_lo_v8hi): Use gen_altivec_vmrglw_direct.
+ (vec_widen_smult_hi_v8hi): Use gen_altivec_vmrghw_direct.
+ (vec_widen_smult_lo_v8hi): Use gen_altivec_vmrglw_direct.
+
+2014-01-29 Marcus Shawcroft
+
+ * config/aarch64/aarch64.c (aarch64_expand_mov_immediate)
+ (aarch64_legitimate_address_p, aarch64_class_max_nregs): Adjust
+ whitespace.
+
+2014-01-29 Richard Biener
+
+ PR tree-optimization/58742
+ * tree-ssa-forwprop.c (associate_pointerplus): Rename to
+ associate_pointerplus_align.
+ (associate_pointerplus_diff): New function.
+ (associate_pointerplus): Likewise. Call associate_pointerplus_align
+ and associate_pointerplus_diff.
+
+2014-01-29 Richard Biener
+
+ * lto-streamer.h (LTO_major_version): Bump to 3.
+ (LTO_minor_version): Reset to 0.
+
+2014-01-29 Renlin Li
+
+ * config/arm/arm-arches.def (ARM_ARCH): Add armv7ve arch.
+ * config/arm/arm.c (FL_FOR_ARCH7VE): New.
+ (arm_file_start): Generate correct asm header for armv7ve.
+ * config/arm/bpabi.h: Add multilib support for armv7ve.
+ * config/arm/driver-arm.c: Change the architectures of cortex-a7
+ and cortex-a15 to armv7ve.
+ * config/arm/t-aprofile: Add multilib support for armv7ve.
+ * doc/invoke.texi: Document -march=armv7ve.
+
+2014-01-29 Richard Biener
+
+ PR tree-optimization/58742
+ * tree-ssa-forwprop.c (associate_plusminus): Return true
+ if we changed sth, defer EH cleanup to ...
+ (ssa_forward_propagate_and_combine): ... here. Call simplify_mult.
+ (simplify_mult): New function.
+
+2014-01-29 Jakub Jelinek
+
+ PR middle-end/59917
+ PR tree-optimization/59920
+ * tree.c (build_common_builtin_nodes): Remove
+ __builtin_setjmp_dispatcher initialization.
+ * omp-low.h (make_gimple_omp_edges): Add a new int * argument.
+ * profile.c (branch_prob): Use gsi_start_nondebug_after_labels_bb
+ instead of gsi_after_labels + manually skipping debug stmts.
+ Don't ignore bbs with BUILT_IN_SETJMP_DISPATCHER, instead
+ ignore bbs with IFN_ABNORMAL_DISPATCHER.
+ * tree-inline.c (copy_edges_for_bb): Remove
+ can_make_abnormal_goto argument, instead add abnormal_goto_dest
+ argument. Ignore computed_goto_p stmts. Don't call
+ make_abnormal_goto_edges. If a call might need abnormal edges
+ for non-local gotos, see if it already has an edge to
+ IFN_ABNORMAL_DISPATCHER or if it is IFN_ABNORMAL_DISPATCHER
+ with true argument, don't do anything then, otherwise add
+ EDGE_ABNORMAL from the call's bb to abnormal_goto_dest.
+ (copy_cfg_body): Compute abnormal_goto_dest, adjust copy_edges_for_bb
+ caller.
+ * gimple-low.c (struct lower_data): Remove calls_builtin_setjmp.
+ (lower_function_body): Don't emit __builtin_setjmp_dispatcher.
+ (lower_stmt): Don't set data->calls_builtin_setjmp.
+ (lower_builtin_setjmp): Adjust comment.
+ * builtins.def (BUILT_IN_SETJMP_DISPATCHER): Remove.
+ * tree-cfg.c (found_computed_goto): Remove.
+ (factor_computed_gotos): Remove.
+ (make_goto_expr_edges): Return bool, true for computed gotos.
+ Don't call make_abnormal_goto_edges.
+ (build_gimple_cfg): Don't set found_computed_goto, don't call
+ factor_computed_gotos.
+ (computed_goto_p): No longer static.
+ (make_blocks): Don't set found_computed_goto.
+ (get_abnormal_succ_dispatcher, handle_abnormal_edges): New functions.
+ (make_edges): If make_goto_expr_edges returns true, push bb
+ into ab_edge_goto vector, for stmt_can_make_abnormal_goto calls
+ instead of calling make_abnormal_goto_edges push bb into ab_edge_call
+ vector. Record mapping between bbs and OpenMP regions if there
+ are any, adjust make_gimple_omp_edges caller. Call
+ handle_abnormal_edges.
+ (make_abnormal_goto_edges): Remove.
+ * tree-cfg.h (make_abnormal_goto_edges): Remove.
+ (computed_goto_p, get_abnormal_succ_dispatcher): New prototypes.
+ * internal-fn.c (expand_ABNORMAL_DISPATCHER): New function.
+ * builtins.c (expand_builtin): Don't handle
+ BUILT_IN_SETJMP_DISPATCHER.
+ * internal-fn.def (ABNORMAL_DISPATCHER): New.
+ * omp-low.c (make_gimple_omp_edges): Add region_idx argument, when
+ filling *region also set *region_idx to (*region)->entry->index.
+
+ PR other/58712
+ * read-rtl.c (read_rtx_code): Clear all of RTX_CODE_SIZE (code).
+ For REGs set ORIGINAL_REGNO.
+
+2014-01-29 Bingfeng Mei
+
+ * doc/md.texi: Mention that a target shouldn't implement
+ vec_widen_(s|u)mul_even/odd pair if it is less efficient
+ than hi/lo pair.
+
+2014-01-29 Jakub Jelinek
+
+ PR tree-optimization/59594
+ * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Sort
+ a copy of the datarefs vector rather than the vector itself.
+
+2014-01-28 Jason Merrill
+
+ PR c++/53756
+ * dwarf2out.c (auto_die): New static.
+ (gen_type_die_with_usage): Handle C++1y 'auto'.
+ (gen_subprogram_die): If in-class DIE had 'auto', emit type again
+ on definition.
+
+2014-01-28 H.J. Lu
+
+ PR target/59672
+ * config/i386/gnu-user64.h (SPEC_32): Add "m16|" to "m32".
+ (SPEC_X32): Likewise.
+ (SPEC_64): Likewise.
+ * config/i386/i386.c (ix86_option_override_internal): Turn off
+ OPTION_MASK_ISA_64BIT, OPTION_MASK_ABI_X32 and OPTION_MASK_ABI_64
+ for TARGET_16BIT.
+ (x86_file_start): Output .code16gcc for TARGET_16BIT.
+ * config/i386/i386.h (TARGET_16BIT): New macro.
+ (TARGET_16BIT_P): Likewise.
+ * config/i386/i386.opt: Add m16.
+ * doc/invoke.texi: Document -m16.
+
+2014-01-28 Jakub Jelinek
+
+ PR preprocessor/59935
+ * input.c (location_get_source_line): Bail out on when line number
+ is zero, and test the return value of
+ lookup_or_add_file_to_cache_tab.
+
+2014-01-28 Richard Biener
+
+ PR tree-optimization/58742
+ * tree-ssa-forwprop.c (associate_plusminus): Handle
+ pointer subtraction of the form (T)(P + A) - (T)P.
+
+2014-01-28 Kyrylo Tkachov
+
+ * config/arm/arm.c (arm_new_rtx_costs): Remove useless statement
+ at const_int_cost.
+
+2014-01-28 Richard Biener
+
+ Revert
+ 2014-01-28 Richard Biener
+
+ PR rtl-optimization/45364
+ PR rtl-optimization/59890
+ * var-tracking.c (local_get_addr_clear_given_value): Handle
+ already cleared slot.
+ (val_reset): Handle not allocated local_get_addr_cache.
+ (vt_find_locations): Use post-order on the inverted CFG.
+
+2014-01-28 Richard Biener
+
+ * tree-data-ref.h (ddr_is_anti_dependent, ddrs_have_anti_deps):
+ Remove.
+
+2014-01-28 Richard Biener
+
+ PR rtl-optimization/45364
+ PR rtl-optimization/59890
+ * var-tracking.c (local_get_addr_clear_given_value): Handle
+ already cleared slot.
+ (val_reset): Handle not allocated local_get_addr_cache.
+ (vt_find_locations): Use post-order on the inverted CFG.
+
+2014-01-28 Alan Modra
+
+ * Makefile.in (BUILD_CPPFLAGS): Do not use ALL_CPPFLAGS.
+ * configure.ac : Define
+ GENERATOR_FILE. Comment. Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD
+ and LD_FOR_BUILD too.
+ * configure: Regenerate.
+
2014-01-27 Allan Sandfeld Jensen
* config/i386/i386.c (get_builtin_code_for_version): Separate
diff --git a/main/gcc/DATESTAMP b/main/gcc/DATESTAMP
index e2e8baaca4b..37aceb436d3 100644
--- a/main/gcc/DATESTAMP
+++ b/main/gcc/DATESTAMP
@@ -1 +1 @@
-20140127
+20140129
diff --git a/main/gcc/Makefile.in b/main/gcc/Makefile.in
index 3a803ef13c6..27fa3d30f8c 100644
--- a/main/gcc/Makefile.in
+++ b/main/gcc/Makefile.in
@@ -761,7 +761,8 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
# Native linker and preprocessor flags. For x-fragment overrides.
BUILD_LDFLAGS=@BUILD_LDFLAGS@
-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
+BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+ -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
# Actual name to use when installing a native compiler.
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
diff --git a/main/gcc/ada/ChangeLog b/main/gcc/ada/ChangeLog
index 237c3e0aa0a..84f071b4c6c 100644
--- a/main/gcc/ada/ChangeLog
+++ b/main/gcc/ada/ChangeLog
@@ -1,3 +1,422 @@
+2014-01-29 Hristian Kirtchev
+
+ * einfo.adb (Get_Pragma): Handle the retrieval of pragma Refined_Post.
+ * einfo.ads (Get_Pragma): Update the comment on special pragmas
+ handled by this routine.
+ * sem_prag.adb (Analyze_Pragma): Add a legal pragma Refined_Post
+ to the contract of the related subprogram body.
+ * sem_util.adb (Add_Contract_Item): Handle the insertion of
+ pragma Refined_Post into the contract of a subprogram body.
+ * sinfo.ads Update the documentation of node N_Contract.
+ * sem_res.adb (Resolve_Entity_Name): Add a guard
+ to detect abstract states and variables only when checking the
+ SPARK 2014 rules concerning volatile object placement.
+
+2014-01-29 Ed Schonberg
+
+ * sem_ch4.adb (Find_Equality_Types, Try_One_Interp): within an instance,
+ null is compatible with any access type.
+
+2014-01-29 Hristian Kirtchev
+
+ * sem_util.adb (Find_Placement_In_State_Space): Assume that the default
+ placement is not in a package.
+
+2014-01-29 Hristian Kirtchev
+
+ * sem_util.adb (Has_Enabled_Property): Compare the character field of
+ the sole property.
+
+2014-01-29 Robert Dewar
+
+ * sem_intr.adb, a-ztexio.ads, sinfo.ads, sem_res.adb, gnatlink.adb,
+ vms_conv.adb, a-except.ads, a-except-2005.ads, a-teioed.adb,
+ sem_warn.ads, treepr.ads, erroutc.ads, a-excach.adb: Minor reformatting.
+
+2014-01-29 Robert Dewar
+
+ * sem_util.ads, sem_util.adb (In_Pragma_Expression): New function.
+ * sem_warn.adb (Check_References): Suppress warnings if inside
+ Initial_Condition pragma.
+
+2014-01-29 Hristian Kirtchev
+
+ * sem_prag.adb (Check_Missing_Part_Of): List all values of
+ State_Space_Kind for readability reasons. Do not emit an error on
+ a private item when the enclosing package lacks aspect/pragma
+ Abstract_State. Do not emit an error on a private package
+ instantiation when the corresponding generic template lacks
+ visible state.
+ (Has_Visible_State): New routine.
+ * sem_util.adb (Find_Placement_In_State_Space): The visible
+ declarations of any kind of child units in general act as proper
+ placement location.
+
+2014-01-29 Robert Dewar
+
+ * a-except-2005.adb, a-except.adb, a-excpol-abort.adb, a-exstat.adb,
+ ali.adb, a-numaux.ads, a-numaux-darwin.ads, a-numaux-libc-x86.ads,
+ a-numaux-vms.ads, a-numaux-vxworks.ads, a-numaux-x86.ads, aspects.ads,
+ a-taside.adb, a-teioed.adb, a-textio.adb, a-textio.ads, atree.adb,
+ atree.ads, a-witeio.adb, a-witeio.ads, a-wtedit.adb, a-ztedit.adb,
+ a-ztexio.adb, bcheck.adb, binde.adb, checks.adb, comperr.adb,
+ cstand.adb, debug_a.adb, einfo.ads, errout.adb, erroutc.adb,
+ eval_fat.adb, exp_aggr.adb, exp_attr.adb, exp_ch11.adb, exp_ch3.adb,
+ exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch9.adb, exp_dbug.adb,
+ exp_disp.adb, exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_util.adb,
+ freeze.adb, frontend.adb, g-comlin.ads, g-mbdira.adb, gnat1drv.adb,
+ gprep.adb, g-spipat.adb, i-cpp.ads, i-vxwork.ads, i-vxwork-x86.ads,
+ krunch.ads, layout.adb, lib-load.adb, lib-writ.adb, lib-writ.ads,
+ live.adb, namet.ads, osint.adb, osint-c.adb, output.ads, par.adb,
+ par-ch10.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb,
+ par-ch6.adb, par-ch9.adb, par-endh.adb, par-labl.adb, par-prag.adb,
+ par-sync.adb, par-tchk.adb, par-util.adb, prj.adb, repinfo.adb,
+ rtsfind.adb, s-arit64.adb, s-asthan-vms-alpha.adb,
+ s-asthan-vms-ia64.adb, s-bignum.adb, scans.adb, scng.adb, s-dimmks.ads,
+ sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_cat.adb, sem_ch10.adb,
+ sem_ch12.adb, sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb,
+ sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_disp.adb, sem_elab.adb,
+ sem_elim.adb, sem_eval.adb, sem_intr.adb, sem_prag.adb, sem_res.adb,
+ sem_type.adb, sem_util.adb, sem_warn.adb, set_targ.adb, s-fatgen.adb,
+ s-fatgen.ads, s-fileio.adb, s-imgcha.adb, s-imgrea.adb, sinfo.ads,
+ sinput-c.adb, snames.ads-tmpl, s-os_lib.adb, sprint.adb,
+ s-regpat.adb, s-secsta.adb, s-stalib.ads,
+ s-stchop.adb, s-stoele.ads, stand.ads, s-taprop-solaris.adb,
+ s-tasdeb-vms.adb, s-tasini.adb, s-tassta.adb, s-valdec.adb,
+ s-valuti.adb, s-wchjis.adb, s-wchwts.adb, system.ads, system-vms_64.ads,
+ system-vms-ia64.ads, treepr.adb, types.ads, uintp.adb, uname.adb,
+ urealp.adb, usage.adb, vxaddr2line.adb: Minor reformatting.
+
+2014-01-29 Robert Dewar
+
+ * expander.adb: Minor reformatting.
+
+2014-01-29 Javier Miranda
+
+ * exp_ch3.adb (Predefined_Primitive_Bodies): Adding documentation to
+ previous patch.
+
+2014-01-29 Javier Miranda
+
+ * exp_ch3.adb (Predefined_Primitive_Bodies): Complete the code
+ that checks if an interface types defines the predefined "="
+ function because the compiler was erroneously not generating the
+ predefined "=" primitive as soon as the name of some interface
+ primitive is "=" (formals were not checked).
+
+2014-01-29 Ed Schonberg
+
+ * expander.adb (Expander): In GNATprove mode, do not process
+ transient scopes: they are in general not created in this mode,
+ and an attempt to examine them will lead to constraint errors when
+ processing configuration pragmas that have analyzable expressions.
+
+2014-01-29 Vincent Celier
+
+ * clean.adb (Gnatclean): Fail if main project is an aggregate
+ project or if there is an aggregate library project in the
+ project tree.
+ * gnatcmd.adb: Fail if the main project is an aggregate project
+ or if there is an aggegate library project in the project tree.
+ * make.adb (Initialize): : Fail if main project is an aggregate
+ project or if there is an aggregate library project in the
+ project tree.
+ * makeutl.ads (Aggregate_Libraries_In): New Boolean function.
+ * prj-makr.adb (Initialize): Fail if the main project is an
+ aggregate project or an aggregate library project.
+
+2014-01-29 Vincent Celier
+
+ * prj-part.adb (Check_Import_Aggregate): New procedure
+ to check if an imported project is an aggregate project.
+ (Parse_Single_Project): Call Check_Import_Aggregate
+ * projects.texi: Document that aggregate projects cannot be
+ extended or imported.
+
+2014-01-29 Robert Dewar
+
+ * exp_ch9.adb, sem_ch7.ads, s-regexp.adb, sem_ch13.adb: Minor
+ reformatting and code clean up.
+ * gnat_ugn.texi: Add documentation section on Atomic Variables
+ and Optimization.
+
+2014-01-29 Hristian Kirtchev
+
+ * einfo.adb Flag264 is now unused.
+ (Has_Body_References): Removed.
+ (Set_Has_Body_References): Removed.
+ (Write_Entity_Flags): Remove the output for flag Has_Body_References.
+ * einfo.ads Update the comment on usage of attribute
+ Body_References. Remove attribute Has_Body_References and its
+ usage in nodes.
+ (Has_Body_References): Removed along with pragma Inline.
+ (Set_Has_Body_References): Removed along with pragma Inline.
+ * sem_prag.adb (Analyze_Global_Item): Move the call to
+ Record_Possible_Body_Reference in the state related checks
+ section. Add a comment intended function.
+ (Analyze_Input_Output): Move the call to Record_Possible_Body_Reference
+ in the state related checks section. Add a comment intended function.
+ (Analyze_Refinement_Clause): Cleanup the illegal body reference
+ reporting. Add a comment on timing of error reporting.
+ (Record_Possible_Body_Reference): Reimplement the routine.
+
+2014-01-29 Vincent Celier
+
+ * makeutl.adb (Mains.Find_File_Add_Extension): Only look for specs for
+ unit-based languages.
+ (Mains.Complete_Mains.Do_Complete): Use the source file project
+ tree when calling Find_File_Add_Extension. Use the correct
+ project name when reporting an error.
+
+2014-01-29 Hristian Kirtchev
+
+ * aspects.adb Add an entry for aspect Part_Of in table
+ Canonical_Aspect.
+ * aspects.ads Add an entry for aspect Part_Of in tables Aspect_Id,
+ Aspect_Argument, Aspect_Names and Aspect_Delay.
+ * atree.h Define Elist9.
+ * atree.adb (Elist9): New routine.
+ (Set_Elist9): New routine.
+ * atree.ads (Elist9): New routine.
+ (Set_Elist9): New routine.
+ * einfo.adb Add Part_Of_Constituents and Encapsulating_State to
+ the list of node usage. Remove Refined_State from the list of
+ node usage.
+ (Encapsulating_State): New routine.
+ (Get_Pragma):
+ Handle pragma Part_Of; (Part_Of_Constituents): New routine.
+ (Refined_State): Removed.
+ (Set_Encapsulating_State): New routine.
+ (Set_Part_Of_Constituents): New routine.
+ (Set_Refined_State): Removed.
+ (Write_Field9_Name): Add an entry
+ for Part_Of_Constituents (Write_Field10_Name): Add an entry for
+ Encapsulating_State. Remove the entry for Refined_State.
+ * einfo.ads Add new attributes Encapsulating_State
+ and Part_Of_Constituents alond with their usage in
+ entities. Remove attribute Refined_State along with its
+ usage in entities.
+ (Encapsulating_State): New routine and
+ pragma Inline. (Get_Pragma): Update the comment on usage.
+ (Part_Of_Constituents): New routine and pragma Inline.
+ (Refined_State): Removed along with pragma Inline.
+ (Set_Encapsulating_State): New routine and pragma Inline.
+ (Set_Part_Of_Constituents): New routine and pragma Inline.
+ (Set_Refined_State): Removed along with pragma Inline.
+ * par-prag.adb Pragma Part_Of does not need any special processing
+ by the parser.
+ * sem_ch3.adb (Analyze_Declarations): Remove local variables
+ Body_Id and Prag. Call separate routines to analyze the
+ contract of a package [body].
+ (Analyze_Object_Contract):
+ Update the comment on usage. Remove local variables
+ Items and Nam. Use Get_Pragma rather than traversing the
+ classification list. Verify whether the lack of indicator
+ Part_Of agrees with the placement of the variable in state space.
+ (Analyze_Object_Declaration): Initialize the encapsulating state
+ of a variable. (Requires_State_Refinement): Moved to sem_util.
+ * sem_ch7.adb (Analyze_Package_Body_Contract): New routine.
+ (Analyze_Package_Contract): New routine.
+ * sem_ch7.ads (Analyze_Package_Body_Contract): New routine.
+ (Analyze_Package_Contract): New routine.
+ * sem_ch10.adb (Decorate_State): Initialize the encapsulating
+ state and Part_Of constituents.
+ * sem_ch13.adb (Analyze_Aspect_Specifications):
+ Add processing for aspect Part_Of. Update all
+ calls to Decorate_Delayed_Aspect_And_Pragma.
+ (Check_Aspect_At_Freeze_Point): Aspect Part_Of does
+ not need any special processing at freeze time.
+ (Decorate_Delayed_Aspect_And_Pragma): Renamed to
+ Decorate_Aspect_And_Pragma. Add formal parameter Delayed and
+ update the associated comment.
+ * sem_prag.adb Add an entry for pragma Part_Of in table Sig_Flags.
+ (Analyze_Abstract_State): Add new global variable State_Id. Remove
+ local constants Errors and Loc. Remove local variables Is_Null
+ and State_Nam. Create the entity of the abstract state on the
+ spot, before all remaining checks are performed. Verify that a
+ missing Part_Of option agrees with the placement of the abstract
+ state within the state space.
+ (Analyze_Depends_In_Decl_Part):
+ Add new global variables Constits_Seen and States_Seen. Check
+ that a state and a corresponding constituent do not appear
+ in pragma [Refined_]Depends.
+ (Analyze_Global_In_Decl_Part):
+ Add new global variables Constits_Seen and States_Seen. Check
+ that a state and a corresponding constituent do not appear
+ in pragma [Refined_]Global.
+ (Analyze_Global_Item):
+ Remove the now obsolete code that deals with Part_Of.
+ Add the entity of the global item to the list of processed
+ items. (Analyze_Initializes_In_Decl_Part): Add new global
+ variables Constits_Seen and States_Seen. Check that a state
+ and a corresponding constituent do not appear in pragma
+ Initializes.
+ (Analyze_Initialization_Item): Add the entity
+ of the initialization item to the list of processed items.
+ (Analyze_Input_Item): Add the entity of the initialization
+ item to the list of processed items.
+ (Analyze_Input_Output):
+ Remove the now obsolete code that deals with Part_Of. Add the
+ entity of the input/output to the list of processed items.
+ (Analyze_Part_Of): New routine.
+ (Analyze_Part_Of_Option): Remove
+ local constant Par_State. Add local constant Encaps and local
+ variables Encaps_Id and Legal. Use Analyze_Part of to analyze
+ the option. Turn the related state into a Part_Of constituent
+ if the option is legal.
+ (Analyze_Pragma): Add processing
+ for pragma Part_Of.
+ (Analyze_Refined_State_In_Decl_Part):
+ Remove global constants Pack_Body and Spec_Id. Remove
+ global variables Abstr_States and Hidden_States. Add new
+ global variables Available_States, Body_Id, Body_States and
+ Spec_Id. Add new local constant Body_Decl. Reimplement the
+ logic that extracts the states available for refinement from
+ the related package and the body hidden states of the said
+ package.
+ (Analyze_Refinement_Clause): Add local variable Part_Of_Constits.
+ (Check_Applicable_Policy): Alphabetize body.
+ (Check_Dependency_Clause): Replace Refined_State
+ with Encapsulating_State.
+ (Check_Matching_Constituent):
+ Reimplement the logic that determines whether an item is a valid
+ / invalid constituent of the current refined state. Return when
+ a construct does not denote a valid abstract state. Extract the
+ list of Part_Of constituents for further analysis. Check that all
+ Part_Of constituents of a state have been used in its refinement.
+ (Check_Matching_State): Update the comment on usage. Operate
+ on the list of available states.
+ (Check_Missing_Part_Of): New routine.
+ (Check_Refined_Global_Item): Replace Refined_State
+ with Encapsulating_State.
+ (Check_State_And_Constituent_Use): New routine.
+ (Create_Abstract_State): New routine.
+ (Is_Matching_Input): Replace Refined_State with Encapsulating_State.
+ (Is_Part_Of): Removed.
+ (Collect_Body_States): New routine.
+ (Collect_Constituent): Replace Refined_State with Encapsulating_State.
+ (Collect_Hidden_States): Removed.
+ (Report_Unrefined_States): Change the profile of the procedure along
+ with the comment on usage.
+ (Report_Unused_Constituents): New routine.
+ (Report_Unused_Hidden_States): Removed.
+ (Report_Unused_States): New routine.
+ * sem_prag.ads (Check_Missing_Part_Of): New routine.
+ * sem_util.adb (Add_Contract_Item): Pragma Part_Of can now
+ appear in the classification pragmas of a package instantiation
+ or a variable.
+ (Find_Placement_In_State_Space): New routine.
+ (Is_Child): Removed.
+ (Is_Child_Or_Sibling): Remove formal
+ parameter Private_Child. Remove the private child checks.
+ (Requires_State_Refinement): Moved from sem_ch3.
+ * sem_util.ads Add new type State_Space_Kind along with
+ comment on its usage and values.
+ (Add_Contract_Item): Update the comment on usage.
+ (Find_Body_Discriminal): Alphabetize spec.
+ (Find_Placement_In_State_Space): New routine.
+ (Is_Child_Or_Sibling): Remove formal parameter Private_Child
+ and update the comment on usage.
+ (Requires_State_Refinement): Moved from sem_ch3.
+ * sinfo.ads: Update the documentation of N_Contract.
+ * snames.ads-tmpl The predefined name for Part_Of is now used
+ to denote a pragma. Add Pragma_Id for Part_Of.
+
+2014-01-29 Emmanuel Briot
+
+ * s-regexp.adb (Create_Secondary_Table): Automatically grow the state
+ machine as needed.
+ (Dump): New subprogram.
+
+2014-01-29 Tristan Gingold
+
+ * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Add
+ Expand_Entry_Declaration to factorize code.
+
+2014-01-29 Ed Schonberg
+
+ * checks.adb: minor clarification.
+ * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Limit
+ search for primitive operations to the entities that immediately
+ follow the type declaration.
+
+2014-01-29 Tristan Gingold
+
+ * exp_ch9.adb (Build_Protected_Entry): Do not call
+ Complete_Entry_Body anymore.
+ * rtsfind.ads (RE_Complete_Single_Entry_Body): Remove.
+ * s-tposen.ads, s-tposen.adb (Complete_Single_Entry_Body): Remove.
+
+2014-01-29 Pierre-Marie Derodat
+
+ * s-os_lib.adb, s-os_lib.ads (Normalize_Pathname): Return an empty
+ string when the Name input bigger than allowed. Adapt the function
+ specification.
+
+2014-01-29 Ed Schonberg
+
+ * checks.adb (Install_Null_Excluding_Check): Do not emit warning
+ if expression is within a case_expression of if_expression.
+
+2014-01-29 Robert Dewar
+
+ * exp_ch9.adb, inline.ads: Minor reformatting.
+
+2014-01-29 Tristan Gingold
+
+ * exp_ch9.adb (Is_Exception_Safe): Return true if no exceptions.
+
+2014-01-29 Yannick Moy
+
+ * inline.ads (Pending_Body_Info): Add SPARK_Mode and
+ SPARK_Mode_Pragma components to be able to analyze generic
+ instance.
+ * sem_ch12.adb (Analyze_Package_Instantiation,
+ Inline_Instance_Body, Need_Subprogram_Instance_Body,
+ Load_Parent_Of_Generic): Pass in SPARK_Mode from instantiation
+ for future analysis of the instance.
+ (Instantiate_Package_Body,
+ Instantiate_Subprogram_Body, Set_Instance_Inv): Set SPARK_Mode
+ from instantiation to analyze the instance.
+
+2014-01-29 Robert Dewar
+
+ * sem_ch7.adb, sem_prag.adb, sem_ch4.adb, sem_ch6.adb: Minor code
+ reorganization.
+
+2014-01-29 Yannick Moy
+
+ * gnat_rm.texi: Update description of SPARK_Mode pragma.
+
+2014-01-29 Tristan Gingold
+
+ * exp_ch9.adb (Expand_N_Protected_Body): Remove Num_Entries.
+
+2014-01-29 Thomas Quinot
+
+ * sem_ch4.adb (Find_Component_In_Instance): Update comment.
+
+2014-01-29 Ed Schonberg
+
+ * exp_util.adb (Build_Task_Image_Prefix): Indicate that the
+ resulting string is an internal entity. and thus requires no
+ initialization. This is relevant when Initialize_ Scalars is
+ enabled, because the resultant spurious initialization may lead to
+ secondary stack anomalies that produce a mangled name for a task.
+
+2014-01-29 Yannick Moy
+
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): SPARK_Mode
+ not inherited from spec anymore. Check consistency
+ rules after processing of declarations.
+ * sem_ch7.adb (Analyze_Package_Body_Helper): SPARK_Mode not inherited
+ from spec anymore. Check consistency rules after processing of
+ declarations.
+ (Analyze_Package_Declaration): Set SPARK_Mode only for non-generic
+ packages.
+ * sem_prag.adb (Analyze_Pragma/Pragma_SPARK_Mode): Implement new
+ consistency rules.
+
2014-01-27 Robert Dewar
* sem_res.adb (Resolve_Comparison_Op): Add type name/location
diff --git a/main/gcc/ada/a-excach.adb b/main/gcc/ada/a-excach.adb
index 6a33601fb45..ab82920519d 100644
--- a/main/gcc/ada/a-excach.adb
+++ b/main/gcc/ada/a-excach.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,7 +32,7 @@
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
-- package will be categorized as Preelaborate. See AI-362 for details.
--- It is safe in the context of the run-time to violate the rules!
+-- It is safe in the context of the run-time to violate the rules.
with System.Traceback;
diff --git a/main/gcc/ada/a-except-2005.adb b/main/gcc/ada/a-except-2005.adb
index 9d6354cadf7..7ed9e0302bd 100644
--- a/main/gcc/ada/a-except-2005.adb
+++ b/main/gcc/ada/a-except-2005.adb
@@ -160,9 +160,9 @@ package body Ada.Exceptions is
-- The Exception_Name and Message lines are omitted in the abort
-- signal case, since this is not really an exception.
- -- !! If the format of the generated string is changed, please note
- -- !! that an equivalent modification to the routine String_To_EO must
- -- !! be made to preserve proper functioning of the stream attributes.
+ -- Note: If the format of the generated string is changed, please note
+ -- that an equivalent modification to the routine String_To_EO must be
+ -- made to preserve proper functioning of the stream attributes.
---------------------------------------
-- Exception backtracing subprograms --
@@ -573,7 +573,7 @@ package body Ada.Exceptions is
pragma Export (C, Rcheck_CE_Range_Check_Ext,
"__gnat_rcheck_CE_Range_Check_ext");
- -- None of these procedures ever returns (they raise an exception!). By
+ -- None of these procedures ever returns (they raise an exception). By
-- using pragma No_Return, we ensure that any junk code after the call,
-- such as normal return epilog stuff, can be eliminated).
@@ -690,7 +690,7 @@ package body Ada.Exceptions is
-- This function gives us the start of the PC range for addresses
-- within the exception unit itself. We hope that gigi/gcc keep all the
- -- procedures in their original order!
+ -- procedures in their original order.
function Code_Address_For_AAA return System.Address is
begin
@@ -1746,7 +1746,7 @@ package body Ada.Exceptions is
-- This function gives us the end of the PC range for addresses
-- within the exception unit itself. We hope that gigi/gcc keeps all the
- -- procedures in their original order!
+ -- procedures in their original order.
function Code_Address_For_ZZZ return System.Address is
begin
diff --git a/main/gcc/ada/a-except-2005.ads b/main/gcc/ada/a-except-2005.ads
index ca4ff9f9e17..71a3f198c14 100644
--- a/main/gcc/ada/a-except-2005.ads
+++ b/main/gcc/ada/a-except-2005.ads
@@ -276,7 +276,7 @@ private
-- Note: this used to be in a separate unit called System.Poll, but that
-- caused horrible circular elaboration problems between System.Poll and
- -- Ada.Exceptions. One way of solving such circularities is unification!
+ -- Ada.Exceptions.
procedure Poll;
-- Check for asynchronous abort. Note that we do not inline the body.
diff --git a/main/gcc/ada/a-except.adb b/main/gcc/ada/a-except.adb
index 65687d72266..a90cfc70785 100644
--- a/main/gcc/ada/a-except.adb
+++ b/main/gcc/ada/a-except.adb
@@ -511,7 +511,7 @@ package body Ada.Exceptions is
pragma Export (C, Rcheck_SE_Object_Too_Large,
"__gnat_rcheck_SE_Object_Too_Large");
- -- None of these procedures ever returns (they raise an exception!). By
+ -- None of these procedures ever returns (they raise an exception). By
-- using pragma No_Return, we ensure that any junk code after the call,
-- such as normal return epilog stuff, can be eliminated).
@@ -629,7 +629,7 @@ package body Ada.Exceptions is
pragma Export (C, Rcheck_34, "__gnat_rcheck_34");
pragma Export (C, Rcheck_35, "__gnat_rcheck_35");
- -- None of these procedures ever returns (they raise an exception!). By
+ -- None of these procedures ever returns (they raise an exception). By
-- using pragma No_Return, we ensure that any junk code after the call,
-- such as normal return epilog stuff, can be eliminated).
@@ -962,7 +962,7 @@ package body Ada.Exceptions is
-- the parameter value in a local variable, and add a pragma Volatile to
-- make sure it is spilled. The pragma Warnings (Off) is needed because
-- the compiler knows that Id is not referenced and that this use of
- -- pragma Volatile is peculiar!
+ -- pragma Volatile is peculiar.
begin
Debug_Raise_Exception (E => SSL.Exception_Data_Ptr (E));
diff --git a/main/gcc/ada/a-except.ads b/main/gcc/ada/a-except.ads
index e395cf4f3b0..512466714a2 100644
--- a/main/gcc/ada/a-except.ads
+++ b/main/gcc/ada/a-except.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -250,7 +250,7 @@ private
-- Note: this used to be in a separate unit called System.Poll, but that
-- caused horrible circular elaboration problems between System.Poll and
- -- Ada.Exceptions. One way of solving such circularities is unification!
+ -- Ada.Exceptions.
procedure Poll;
-- Check for asynchronous abort. Note that we do not inline the body.
diff --git a/main/gcc/ada/a-excpol-abort.adb b/main/gcc/ada/a-excpol-abort.adb
index 94acae6a10b..ebfc1a0b4d4 100644
--- a/main/gcc/ada/a-excpol-abort.adb
+++ b/main/gcc/ada/a-excpol-abort.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,7 +40,7 @@
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
-- package will be categorized as Preelaborate. See AI-362 for details.
--- It is safe in the context of the run-time to violate the rules!
+-- It is safe in the context of the run-time to violate the rules.
with System.Soft_Links;
diff --git a/main/gcc/ada/a-exstat.adb b/main/gcc/ada/a-exstat.adb
index f5674e5e867..f8f75b2cd13 100644
--- a/main/gcc/ada/a-exstat.adb
+++ b/main/gcc/ada/a-exstat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,7 +32,7 @@
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
-- package will be categorized as Preelaborate. See AI-362 for details.
--- It is safe in the context of the run-time to violate the rules!
+-- It is safe in the context of the run-time to violate the rules.
with System.Exception_Table; use System.Exception_Table;
with System.Storage_Elements; use System.Storage_Elements;
diff --git a/main/gcc/ada/a-numaux-darwin.ads b/main/gcc/ada/a-numaux-darwin.ads
index 1f0eea9077c..4164f512d12 100644
--- a/main/gcc/ada/a-numaux-darwin.ads
+++ b/main/gcc/ada/a-numaux-darwin.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Apple OS X Version) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -58,7 +58,7 @@ package Ada.Numerics.Aux is
pragma Inline (Cos);
-- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure!
+ -- all as pure functions, because indeed all of them are in fact pure.
function Tan (X : Double) return Double;
pragma Import (C, Tan, "tan");
diff --git a/main/gcc/ada/a-numaux-libc-x86.ads b/main/gcc/ada/a-numaux-libc-x86.ads
index 2a48d8a811e..3261c111c43 100644
--- a/main/gcc/ada/a-numaux-libc-x86.ads
+++ b/main/gcc/ada/a-numaux-libc-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version for x86) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,7 +49,7 @@ package Ada.Numerics.Aux is
type Double is digits 18;
-- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure!
+ -- all as pure functions, because indeed all of them are in fact pure.
function Sin (X : Double) return Double;
pragma Import (C, Sin, "sinl");
diff --git a/main/gcc/ada/a-numaux-vms.ads b/main/gcc/ada/a-numaux-vms.ads
index d64f6b7ca07..f6d1dfa9081 100644
--- a/main/gcc/ada/a-numaux-vms.ads
+++ b/main/gcc/ada/a-numaux-vms.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (VMS Version) --
-- --
--- Copyright (C) 2003-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,7 +47,7 @@ package Ada.Numerics.Aux is
-- since we use the IEEE version of the C library with VMS.
-- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure!
+ -- all as pure functions, because indeed all of them are in fact pure.
function Sin (X : Double) return Double;
pragma Import (C, Sin, "MATH$SIN_T");
diff --git a/main/gcc/ada/a-numaux-vxworks.ads b/main/gcc/ada/a-numaux-vxworks.ads
index 1b6d68e0774..ce567ad6586 100644
--- a/main/gcc/ada/a-numaux-vxworks.ads
+++ b/main/gcc/ada/a-numaux-vxworks.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version, VxWorks) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -51,7 +51,7 @@ package Ada.Numerics.Aux is
-- Type Double is the type used to call the C routines
-- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure!
+ -- all as pure functions, because indeed all of them are in fact pure.
function Sin (X : Double) return Double;
pragma Import (C, Sin, "sin");
diff --git a/main/gcc/ada/a-numaux-x86.ads b/main/gcc/ada/a-numaux-x86.ads
index c0f8b40c3bb..7211fbb64ce 100644
--- a/main/gcc/ada/a-numaux-x86.ads
+++ b/main/gcc/ada/a-numaux-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Machine Version for x86) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/main/gcc/ada/a-numaux.ads b/main/gcc/ada/a-numaux.ads
index 31281218bd3..cef530183f5 100644
--- a/main/gcc/ada/a-numaux.ads
+++ b/main/gcc/ada/a-numaux.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version, non-x86) --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -52,7 +52,7 @@ package Ada.Numerics.Aux is
-- Type Double is the type used to call the C routines
-- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure!
+ -- all as pure functions, because indeed all of them are in fact pure.
function Sin (X : Double) return Double;
pragma Import (C, Sin, "sin");
diff --git a/main/gcc/ada/a-taside.adb b/main/gcc/ada/a-taside.adb
index 520a7dfc1c9..ac4473e4c1a 100644
--- a/main/gcc/ada/a-taside.adb
+++ b/main/gcc/ada/a-taside.adb
@@ -39,7 +39,7 @@ with Ada.Unchecked_Conversion;
pragma Warnings (Off);
-- Allow withing of non-Preelaborated units in Ada 2005 mode where this
-- package will be categorized as Preelaborate. See AI-362 for details.
--- It is safe in the context of the run-time to violate the rules!
+-- It is safe in the context of the run-time to violate the rules.
with System.Tasking.Utilities;
diff --git a/main/gcc/ada/a-teioed.adb b/main/gcc/ada/a-teioed.adb
index 2bb1435a881..03e635e9418 100644
--- a/main/gcc/ada/a-teioed.adb
+++ b/main/gcc/ada/a-teioed.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -751,13 +751,13 @@ package body Ada.Text_IO.Editing is
return String'(1 .. Last => '*');
end if;
- -- This was once a simple return statement, now there are nine
- -- different return cases. Not to mention the five above to deal
- -- with zeros. Why not split things out?
+ -- This was once a simple return statement, now there are nine different
+ -- return cases. Not to mention the five above to deal with zeros. Why
+ -- not split things out?
- -- Processing the radix and sign expansion separately
- -- would require lots of copying--the string and some of its
- -- indicies--without really simplifying the logic. The cases are:
+ -- Processing the radix and sign expansion separately would require
+ -- lots of copying--the string and some of its indexes--without
+ -- really simplifying the logic. The cases are:
-- 1) Expand $, replace '.' with Radix_Point
-- 2) No currency expansion, replace '.' with Radix_Point
@@ -875,7 +875,7 @@ package body Ada.Text_IO.Editing is
when '0' =>
-- Only count a zero before the decimal point if it follows a
- -- non-zero digit. After the decimal point, zeros will be
+ -- non-zero digit. After the decimal point, zeros will be
-- counted if followed by a non-zero digit.
if not Answer.Has_Fraction then
@@ -910,7 +910,7 @@ package body Ada.Text_IO.Editing is
Answer.End_Of_Int := J - 1;
when others =>
- raise Picture_Error; -- can this happen? probably not!
+ raise Picture_Error; -- can this happen? probably not
end case;
end loop;
@@ -1321,9 +1321,8 @@ package body Ada.Text_IO.Editing is
-- Leading_Dollar --
--------------------
- -- Note that Leading_Dollar can be called in either State.
- -- It will set state to Okay only if a 9 or (second) $
- -- is encountered.
+ -- Note that Leading_Dollar can be called in either State. It will set
+ -- state to Okay only if a 9 or (second) $ is encountered.
-- Also notice the tricky bit with State and Zero_Suppression.
-- Zero_Suppression is Picture_Error if a '$' or a '9' has been
@@ -1446,13 +1445,12 @@ package body Ada.Text_IO.Editing is
-- Leading_Pound --
-------------------
- -- This one is complex! A Leading_Pound can be fixed or floating,
+ -- This one is complex. A Leading_Pound can be fixed or floating,
-- but in some cases the decision has to be deferred until we leave
- -- this procedure. Also note that Leading_Pound can be called in
+ -- this procedure. Also note that Leading_Pound can be called in
-- either State.
- -- It will set state to Okay only if a 9 or (second) # is
- -- encountered.
+ -- It will set state to Okay only if a 9 or (second) # is encountered
-- One Last note: In ambiguous cases, the currency is treated as
-- floating unless there is only one '#'.
diff --git a/main/gcc/ada/a-textio.adb b/main/gcc/ada/a-textio.adb
index 2f2fe27c680..f28711e57f2 100644
--- a/main/gcc/ada/a-textio.adb
+++ b/main/gcc/ada/a-textio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -71,7 +71,7 @@ package body Ada.Text_IO is
-- correct filename length.
--
-- Note: the names for these files are bogus, and probably it would be
- -- better for these files to have no names, but the ACVC tests insist!
+ -- better for these files to have no names, but the ACVC tests insist.
-- We use names that are bound to fail in open etc.
Null_Str : aliased constant String := "";
diff --git a/main/gcc/ada/a-textio.ads b/main/gcc/ada/a-textio.ads
index 675dc63184b..5ae8334695d 100644
--- a/main/gcc/ada/a-textio.ads
+++ b/main/gcc/ada/a-textio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -389,7 +389,7 @@ private
-- there is no convenient way of backing up more than one character,
-- what we do is to leave ourselves positioned past the LM, but set
-- this flag, so that we know that from an Ada point of view we are
- -- in front of the LM, not after it. A bit of a kludge, but it works!
+ -- in front of the LM, not after it. A bit of a kludge, but it works.
Before_LM_PM : Boolean := False;
-- This flag similarly handles the case of being physically positioned
diff --git a/main/gcc/ada/a-witeio.adb b/main/gcc/ada/a-witeio.adb
index efd5021849d..045705448b8 100644
--- a/main/gcc/ada/a-witeio.adb
+++ b/main/gcc/ada/a-witeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -71,7 +71,7 @@ package body Ada.Wide_Text_IO is
-- correct filename length.
--
-- Note: the names for these files are bogus, and probably it would be
- -- better for these files to have no names, but the ACVC tests insist!
+ -- better for these files to have no names, but the ACVC tests insist.
-- We use names that are bound to fail in open etc.
Null_Str : aliased constant String := "";
@@ -663,15 +663,15 @@ package body Ada.Wide_Text_IO is
-- Otherwise store the character, note that we know that ch is
-- something other than LM or EOF. It could possibly be a page
- -- mark if there is a stray page mark in the middle of a line,
- -- but this is not an official page mark in any case, since
- -- official page marks can only follow a line mark. The whole
- -- page business is pretty much nonsense anyway, so we do not
- -- want to waste time trying to make sense out of non-standard
- -- page marks in the file! This means that the behavior of
- -- Get_Line is different from repeated Get of a character, but
- -- that's too bad. We only promise that page numbers etc make
- -- sense if the file is formatted in a standard manner.
+ -- mark if there is a stray page mark in the middle of a line, but
+ -- this is not an official page mark in any case, since official
+ -- page marks can only follow a line mark. The whole page business
+ -- is pretty much nonsense anyway, so we do not want to waste
+ -- time trying to make sense out of non-standard page marks in
+ -- the file. This means that the behavior of Get_Line is different
+ -- from repeated Get of a character, but that's too bad. We
+ -- only promise that page numbers etc make sense if the file
+ -- is formatted in a standard manner.
-- Note: we do not adjust the column number because it is quicker
-- to adjust it once at the end of the operation than incrementing
diff --git a/main/gcc/ada/a-witeio.ads b/main/gcc/ada/a-witeio.ads
index f5cab06fa97..9151bf9b520 100644
--- a/main/gcc/ada/a-witeio.ads
+++ b/main/gcc/ada/a-witeio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -389,7 +389,7 @@ private
-- there is no convenient way of backing up more than one character,
-- what we do is to leave ourselves positioned past the LM, but set
-- this flag, so that we know that from an Ada point of view we are
- -- in front of the LM, not after it. A bit of a kludge, but it works!
+ -- in front of the LM, not after it. A bit of a kludge, but it works.
Before_LM_PM : Boolean := False;
-- This flag similarly handles the case of being physically positioned
diff --git a/main/gcc/ada/a-wtedit.adb b/main/gcc/ada/a-wtedit.adb
index 921c0afc1fa..e616488585b 100644
--- a/main/gcc/ada/a-wtedit.adb
+++ b/main/gcc/ada/a-wtedit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -909,12 +909,12 @@ package body Ada.Wide_Text_IO.Editing is
end if;
-- This was once a simple return statement, now there are nine
- -- different return cases. Not to mention the five above to deal
- -- with zeros. Why not split things out?
+ -- different return cases. Not to mention the five above to deal
+ -- with zeros. Why not split things out?
- -- Processing the radix and sign expansion separately
- -- would require lots of copying--the string and some of its
- -- indicies--without really simplifying the logic. The cases are:
+ -- Processing the radix and sign expansion separately would require
+ -- lots of copying--the string and some of its indexes--without
+ -- really simplifying the logic. The cases are:
-- 1) Expand $, replace '.' with Radix_Point
-- 2) No currency expansion, replace '.' with Radix_Point
@@ -1033,7 +1033,7 @@ package body Ada.Wide_Text_IO.Editing is
when '0' =>
-- Only count a zero before the decimal point if it follows a
- -- non-zero digit. After the decimal point, zeros will be
+ -- non-zero digit. After the decimal point, zeros will be
-- counted if followed by a non-zero digit.
if not Answer.Has_Fraction then
@@ -1068,7 +1068,7 @@ package body Ada.Wide_Text_IO.Editing is
Answer.End_Of_Int := J - 1;
when others =>
- raise Picture_Error; -- can this happen? probably not!
+ raise Picture_Error; -- can this happen? probably not
end case;
end loop;
@@ -1412,8 +1412,7 @@ package body Ada.Wide_Text_IO.Editing is
--------------------
-- Note that Leading_Dollar can be called in either State.
- -- It will set state to Okay only if a 9 or (second) $
- -- is encountered.
+ -- It will set state to Okay only if a 9 or (second) $ is encountered.
-- Also notice the tricky bit with State and Zero_Suppression.
-- Zero_Suppression is Picture_Error if a '$' or a '9' has been
@@ -1521,9 +1520,9 @@ package body Ada.Wide_Text_IO.Editing is
-- Leading_Pound --
-------------------
- -- This one is complex! A Leading_Pound can be fixed or floating,
+ -- This one is complex. A Leading_Pound can be fixed or floating,
-- but in some cases the decision has to be deferred until we leave
- -- this procedure. Also note that Leading_Pound can be called in
+ -- this procedure. Also note that Leading_Pound can be called in
-- either State.
-- It will set state to Okay only if a 9 or (second) # is
diff --git a/main/gcc/ada/a-ztedit.adb b/main/gcc/ada/a-ztedit.adb
index 6d97f61ff45..f28a81f4f46 100644
--- a/main/gcc/ada/a-ztedit.adb
+++ b/main/gcc/ada/a-ztedit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -910,13 +910,13 @@ package body Ada.Wide_Wide_Text_IO.Editing is
return Wide_Wide_String'(1 .. Last => '*');
end if;
- -- This was once a simple return statement, now there are nine
- -- different return cases. Not to mention the five above to deal
- -- with zeros. Why not split things out?
+ -- This was once a simple return statement, now there are nine different
+ -- return cases. Not to mention the five above to deal with zeros. Why
+ -- not split things out?
- -- Processing the radix and sign expansion separately
- -- would require lots of copying--the string and some of its
- -- indicies--without really simplifying the logic. The cases are:
+ -- Processing the radix and sign expansion separately would require
+ -- lots of copying--the string and some of its indexes--without
+ -- really simplifying the logic. The cases are:
-- 1) Expand $, replace '.' with Radix_Point
-- 2) No currency expansion, replace '.' with Radix_Point
@@ -1034,7 +1034,7 @@ package body Ada.Wide_Wide_Text_IO.Editing is
when '0' =>
-- Only count a zero before the decimal point if it follows a
- -- non-zero digit. After the decimal point, zeros will be
+ -- non-zero digit. After the decimal point, zeros will be
-- counted if followed by a non-zero digit.
if not Answer.Has_Fraction then
@@ -1069,7 +1069,7 @@ package body Ada.Wide_Wide_Text_IO.Editing is
Answer.End_Of_Int := J - 1;
when others =>
- raise Picture_Error; -- can this happen? probably not!
+ raise Picture_Error; -- can this happen? probably not
end case;
end loop;
@@ -1521,10 +1521,10 @@ package body Ada.Wide_Wide_Text_IO.Editing is
-- Leading_Pound --
-------------------
- -- This one is complex! A Leading_Pound can be fixed or floating,
- -- but in some cases the decision has to be deferred until we leave
- -- this procedure. Also note that Leading_Pound can be called in
- -- either State.
+ -- This one is complex. A Leading_Pound can be fixed or floating, but
+ -- in some cases the decision has to be deferred until we leave this
+ -- procedure. Also note that Leading_Pound can be called in either
+ -- State.
-- It will set state to Okay only if a 9 or (second) # is encountered
diff --git a/main/gcc/ada/a-ztexio.adb b/main/gcc/ada/a-ztexio.adb
index 8be8a91d9e2..803f62b6ac0 100644
--- a/main/gcc/ada/a-ztexio.adb
+++ b/main/gcc/ada/a-ztexio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -71,7 +71,7 @@ package body Ada.Wide_Wide_Text_IO is
-- correct filename length.
--
-- Note: the names for these files are bogus, and probably it would be
- -- better for these files to have no names, but the ACVC tests insist!
+ -- better for these files to have no names, but the ACVC tests insist.
-- We use names that are bound to fail in open etc.
Null_Str : aliased constant String := "";
@@ -668,7 +668,7 @@ package body Ada.Wide_Wide_Text_IO is
-- official page marks can only follow a line mark. The whole
-- page business is pretty much nonsense anyway, so we do not
-- want to waste time trying to make sense out of non-standard
- -- page marks in the file! This means that the behavior of
+ -- page marks in the file. This means that the behavior of
-- Get_Line is different from repeated Get of a character, but
-- that's too bad. We only promise that page numbers etc make
-- sense if the file is formatted in a standard manner.
diff --git a/main/gcc/ada/a-ztexio.ads b/main/gcc/ada/a-ztexio.ads
index 97ead43be10..b081906b415 100644
--- a/main/gcc/ada/a-ztexio.ads
+++ b/main/gcc/ada/a-ztexio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -389,7 +389,7 @@ private
-- there is no convenient way of backing up more than one character,
-- what we do is to leave ourselves positioned past the LM, but set
-- this flag, so that we know that from an Ada point of view we are
- -- in front of the LM, not after it. A bit of a kludge, but it works!
+ -- in front of the LM, not after it. A bit of a kludge, but it works.
Before_LM_PM : Boolean := False;
-- This flag similarly handles the case of being physically positioned
diff --git a/main/gcc/ada/ali.adb b/main/gcc/ada/ali.adb
index 87cb61d4f54..3bf12f32584 100644
--- a/main/gcc/ada/ali.adb
+++ b/main/gcc/ada/ali.adb
@@ -2216,7 +2216,7 @@ package body ALI is
else
-- Deal with body only and spec only cases, note that the reason we
-- do our own checking of the name (rather than using Is_Body_Name)
- -- is that Uname drags in far too much compiler junk!
+ -- is that Uname drags in far too much compiler junk.
Get_Name_String (Units.Table (Units.Last).Uname);
diff --git a/main/gcc/ada/aspects.adb b/main/gcc/ada/aspects.adb
index e3ff78d0bc0..cff2b811c62 100644
--- a/main/gcc/ada/aspects.adb
+++ b/main/gcc/ada/aspects.adb
@@ -523,6 +523,7 @@ package body Aspects is
Aspect_Object_Size => Aspect_Object_Size,
Aspect_Output => Aspect_Output,
Aspect_Pack => Aspect_Pack,
+ Aspect_Part_Of => Aspect_Part_Of,
Aspect_Persistent_BSS => Aspect_Persistent_BSS,
Aspect_Post => Aspect_Post,
Aspect_Postcondition => Aspect_Post,
diff --git a/main/gcc/ada/aspects.ads b/main/gcc/ada/aspects.ads
index 5b76f6a6562..e8d3a1dc73d 100644
--- a/main/gcc/ada/aspects.ads
+++ b/main/gcc/ada/aspects.ads
@@ -107,6 +107,7 @@ package Aspects is
Aspect_Machine_Radix,
Aspect_Object_Size, -- GNAT
Aspect_Output,
+ Aspect_Part_Of, -- GNAT
Aspect_Post,
Aspect_Postcondition,
Aspect_Pre,
@@ -330,6 +331,7 @@ package Aspects is
Aspect_Machine_Radix => Expression,
Aspect_Object_Size => Expression,
Aspect_Output => Name,
+ Aspect_Part_Of => Expression,
Aspect_Post => Expression,
Aspect_Postcondition => Expression,
Aspect_Pre => Expression,
@@ -429,6 +431,7 @@ package Aspects is
Aspect_Object_Size => Name_Object_Size,
Aspect_Output => Name_Output,
Aspect_Pack => Name_Pack,
+ Aspect_Part_Of => Name_Part_Of,
Aspect_Persistent_BSS => Name_Persistent_BSS,
Aspect_Post => Name_Post,
Aspect_Postcondition => Name_Postcondition,
@@ -556,7 +559,7 @@ package Aspects is
-- identifier, and there is no issue of evaluating it and thus no
-- issue of delaying the evaluation. The second case is implementation
-- defined aspects where we have decided that we don't want to allow
- -- delays (and for our own aspects we can do what we like!).
+ -- delays (and for our own aspects we can do what we like).
Rep_Aspect);
-- These are the cases of representation aspects that are in general
@@ -679,6 +682,7 @@ package Aspects is
Aspect_Convention => Never_Delay,
Aspect_Dimension => Never_Delay,
Aspect_Dimension_System => Never_Delay,
+ Aspect_Part_Of => Never_Delay,
Aspect_Refined_Post => Never_Delay,
Aspect_SPARK_Mode => Never_Delay,
Aspect_Synchronization => Never_Delay,
diff --git a/main/gcc/ada/atree.adb b/main/gcc/ada/atree.adb
index 86820b45e45..35e8a7a09ff 100644
--- a/main/gcc/ada/atree.adb
+++ b/main/gcc/ada/atree.adb
@@ -122,10 +122,10 @@ package body Atree is
-- Count allocated nodes for Num_Nodes function
use Unchecked_Access;
- -- We are allowed to see these from within our own body!
+ -- We are allowed to see these from within our own body
use Atree_Private_Part;
- -- We are also allowed to see our private data structures!
+ -- We are also allowed to see our private data structures
-- Functions used to store Entity_Kind value in Nkind field
@@ -1326,7 +1326,7 @@ package body Atree is
Set_Name1 (Empty, No_Name);
-- Allocate Error node, and set Error_Posted, since we certainly
- -- only generate an Error node if we do post some kind of error!
+ -- only generate an Error node if we do post some kind of error.
Dummy := New_Node (N_Error, No_Location);
Set_Name1 (Error, Error_Name);
@@ -2758,6 +2758,17 @@ package body Atree is
end if;
end Elist8;
+ function Elist9 (N : Node_Id) return Elist_Id is
+ pragma Assert (Nkind (N) in N_Entity);
+ Value : constant Union_Id := Nodes.Table (N + 1).Field9;
+ begin
+ if Value = 0 then
+ return No_Elist;
+ else
+ return Elist_Id (Value);
+ end if;
+ end Elist9;
+
function Elist10 (N : Node_Id) return Elist_Id is
pragma Assert (Nkind (N) in N_Entity);
Value : constant Union_Id := Nodes.Table (N + 1).Field10;
@@ -5476,6 +5487,12 @@ package body Atree is
Nodes.Table (N + 1).Field8 := Union_Id (Val);
end Set_Elist8;
+ procedure Set_Elist9 (N : Node_Id; Val : Elist_Id) is
+ begin
+ pragma Assert (Nkind (N) in N_Entity);
+ Nodes.Table (N + 1).Field9 := Union_Id (Val);
+ end Set_Elist9;
+
procedure Set_Elist10 (N : Node_Id; Val : Elist_Id) is
begin
pragma Assert (Nkind (N) in N_Entity);
diff --git a/main/gcc/ada/atree.ads b/main/gcc/ada/atree.ads
index d5b3bca3f0c..b167d8f438e 100644
--- a/main/gcc/ada/atree.ads
+++ b/main/gcc/ada/atree.ads
@@ -1279,6 +1279,9 @@ package Atree is
function Elist8 (N : Node_Id) return Elist_Id;
pragma Inline (Elist8);
+ function Elist9 (N : Node_Id) return Elist_Id;
+ pragma Inline (Elist9);
+
function Elist10 (N : Node_Id) return Elist_Id;
pragma Inline (Elist10);
@@ -2585,6 +2588,9 @@ package Atree is
procedure Set_Elist8 (N : Node_Id; Val : Elist_Id);
pragma Inline (Set_Elist8);
+ procedure Set_Elist9 (N : Node_Id; Val : Elist_Id);
+ pragma Inline (Set_Elist9);
+
procedure Set_Elist10 (N : Node_Id; Val : Elist_Id);
pragma Inline (Set_Elist10);
@@ -3787,7 +3793,7 @@ package Atree is
-- Fifth entry: holds 8 additional flags (Flag247-254)
-- Sixth entry: holds 8 additional flags (Flag310-317)
- -- Now finally (on an 32-bit boundary!) comes the variant part
+ -- Now finally (on an 32-bit boundary) comes the variant part
case Is_Extension is
diff --git a/main/gcc/ada/atree.h b/main/gcc/ada/atree.h
index f3913852e12..7d603ba425d 100644
--- a/main/gcc/ada/atree.h
+++ b/main/gcc/ada/atree.h
@@ -501,6 +501,7 @@ extern Node_Id Current_Error_Node;
#define Elist4(N) Field4 (N)
#define Elist5(N) Field5 (N)
#define Elist8(N) Field8 (N)
+#define Elist9(N) Field9 (N)
#define Elist10(N) Field10 (N)
#define Elist13(N) Field13 (N)
#define Elist15(N) Field15 (N)
diff --git a/main/gcc/ada/back_end.ads b/main/gcc/ada/back_end.ads
index ba25a83fb7e..9e28a6ed6f3 100644
--- a/main/gcc/ada/back_end.ads
+++ b/main/gcc/ada/back_end.ads
@@ -59,6 +59,17 @@ package Back_End is
--
-- Any processed switches that influence the result of a compilation must
-- be added to the Compilation_Arguments table.
+ --
+ -- This routine is expected to set the following to True if necessary (the
+ -- default for all of these in Opt is False).
+ --
+ -- Opt.Suppress_All_Inlining
+ -- Opt.Suppress_Control_Float_Optimizations
+ -- Opt.Generate_SCO
+ -- Opt.Generate_SCO_Instance_Table
+ -- Opt.Stack_Checking_Enabled
+ -- Opt.No_Stdinc
+ -- Opt.No_Stdlib
procedure Gen_Or_Update_Object_File;
-- Is used to generate the object file (if generated directly by gnat1), or
diff --git a/main/gcc/ada/bcheck.adb b/main/gcc/ada/bcheck.adb
index fc2b9b62035..fec69598cc7 100644
--- a/main/gcc/ada/bcheck.adb
+++ b/main/gcc/ada/bcheck.adb
@@ -889,7 +889,7 @@ package body Bcheck is
declare
M1 : constant String := "{ has restriction ";
S : constant String := Restriction_Id'Image (R);
- M2 : String (1 .. 2000); -- big enough!
+ M2 : String (1 .. 2000); -- big enough
P : Integer;
begin
diff --git a/main/gcc/ada/binde.adb b/main/gcc/ada/binde.adb
index ed51554b6fd..1e79756de4e 100644
--- a/main/gcc/ada/binde.adb
+++ b/main/gcc/ada/binde.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -124,7 +124,7 @@ package body Binde is
-- than the spec link) to the spec. Then when then the spec gets chosen,
-- we choose the body right afterwards. We mark the links that get moved
-- from the body to the spec by setting their Elab_Body flag True, so
- -- that we can understand what is going on!
+ -- that we can understand what is going on.
Succ_First : constant := 1;
@@ -580,7 +580,7 @@ package body Binde is
Elab_Order.Table (Elab_Order.Last) := Chosen;
-- Remove from No_Pred list. This is a little inefficient and may
- -- be we should doubly link the list, but it will do for now!
+ -- be we should doubly link the list, but it will do for now.
if No_Pred = Chosen then
No_Pred := UNR.Table (Chosen).Nextnp;
@@ -849,7 +849,7 @@ package body Binde is
-- Try to find cycles starting with any of the remaining nodes that have
-- not yet been chosen. There must be at least one (there is some reason
- -- we are being called!)
+ -- we are being called).
for U in Units.First .. Units.Last loop
if UNR.Table (U).Elab_Position = 0 then
@@ -1314,7 +1314,7 @@ package body Binde is
end if;
-- A limited_with does not establish an elaboration
- -- dependence (that's the whole point!).
+ -- dependence (that's the whole point)..
elsif Withs.Table (W).Limited_With then
null;
@@ -1470,7 +1470,7 @@ package body Binde is
return False;
-- Prefer anything else to a waiting body. We want to make bodies wait
- -- as long as possible, till we are forced to choose them!
+ -- as long as possible, till we are forced to choose them.
elsif Is_Waiting_Body (U1) and then not Is_Waiting_Body (U2) then
if Debug_Flag_B then
@@ -1486,7 +1486,7 @@ package body Binde is
return True;
- -- Prefer a spec to a body (!)
+ -- Prefer a spec to a body (this is mandatory)
elsif Is_Body_Unit (U1) and then not Is_Body_Unit (U2) then
if Debug_Flag_B then
diff --git a/main/gcc/ada/checks.adb b/main/gcc/ada/checks.adb
index 51acd293a91..7fd8bc576d7 100644
--- a/main/gcc/ada/checks.adb
+++ b/main/gcc/ada/checks.adb
@@ -2780,7 +2780,7 @@ package body Checks is
end if;
-- Do not set range checks for any values from System.Scalar_Values
- -- since the whole idea of such values is to avoid checking them!
+ -- since the whole idea of such values is to avoid checking them.
if Is_Entity_Name (Expr)
and then Is_RTU (Scope (Entity (Expr)), System_Scalar_Values)
@@ -3267,7 +3267,7 @@ package body Checks is
-- An unconstrained derived type may have inherited discriminant.
-- Build an actual discriminant constraint list using the stored
-- constraint, to verify that the expression of the parent type
- -- satisfies the constraints imposed by the (unconstrained!)
+ -- satisfies the constraints imposed by the (unconstrained)
-- derived type. This applies to value conversions, not to view
-- conversions of tagged types.
@@ -3618,7 +3618,7 @@ package body Checks is
-- such as itype declarations in this context, to keep the loop going
-- since we may well have generated such stuff in complex situations.
-- Also done if no parent (probably an error condition, but no point
- -- in behaving nasty if we find it!)
+ -- in behaving nasty if we find it).
if No (P)
or else (K not in N_Subexpr and then Comes_From_Source (P))
@@ -3758,7 +3758,7 @@ package body Checks is
-- Only do this check for expressions that come from source. We assume
-- that expander generated assignments explicitly include any necessary
-- checks. Note that this is not just an optimization, it avoids
- -- infinite recursions!
+ -- infinite recursions.
elsif not Comes_From_Source (Expr) then
return;
@@ -4022,7 +4022,7 @@ package body Checks is
Cache_Size : constant := 2 ** 10;
type Cache_Index is range 0 .. Cache_Size - 1;
- -- Determine size of below cache (power of 2 is more efficient!)
+ -- Determine size of below cache (power of 2 is more efficient)
Determine_Range_Cache_N : array (Cache_Index) of Node_Id;
Determine_Range_Cache_V : array (Cache_Index) of Boolean;
@@ -4144,7 +4144,7 @@ package body Checks is
OK := True;
-- If value is compile time known, then the possible range is the one
- -- value that we know this expression definitely has!
+ -- value that we know this expression definitely has.
if Compile_Time_Known_Value (N) then
Lo := Expr_Value (N);
@@ -4705,7 +4705,7 @@ package body Checks is
-- is not worth the effort to eliminate checks for other than discrete
-- types. In addition, we take this same path if we have stored the
-- maximum number of checks possible already (a very unlikely situation,
- -- but we do not want to blow up!)
+ -- but we do not want to blow up).
if Optimization_Level = 0
or else not Is_Discrete_Type (Etype (N))
@@ -4810,7 +4810,7 @@ package body Checks is
begin
-- Return if unchecked type conversion with range check killed. In this
- -- case we never set the flag (that's what Kill_Range_Check is about!)
+ -- case we never set the flag (that's what Kill_Range_Check is about).
if Nkind (N) = N_Unchecked_Type_Conversion
and then Kill_Range_Check (N)
@@ -4874,7 +4874,7 @@ package body Checks is
-- is not worth the effort to eliminate checks for other than discrete
-- types. In addition, we take this same path if we have stored the
-- maximum number of checks possible already (a very unlikely situation,
- -- but we do not want to blow up!)
+ -- but we do not want to blow up).
if Optimization_Level = 0
or else No (Etype (N))
@@ -5061,7 +5061,7 @@ package body Checks is
-- No check required if expression is from the expander, we assume the
-- expander will generate whatever checks are needed. Note that this is
- -- not just an optimization, it avoids infinite recursions!
+ -- not just an optimization, it avoids infinite recursions.
-- Unchecked conversions must be checked, unless they are initialized
-- scalar values, as in a component assignment in an init proc.
@@ -5843,7 +5843,7 @@ package body Checks is
-- First special case, if the source type is already within the range
-- of the target type, then no check is needed (probably we should have
-- stopped Do_Range_Check from being set in the first place, but better
- -- late than never in preventing junk code!
+ -- late than never in preventing junk code.
if In_Subrange_Of (Source_Type, Target_Type)
@@ -6019,7 +6019,7 @@ package body Checks is
-- With these two checks out of the way, we can do the check
-- using the source type safely
- -- This is definitely the most annoying case!
+ -- This is definitely the most annoying case.
-- [constraint_error
-- when (Target_Type'First >= 0
@@ -6454,7 +6454,7 @@ package body Checks is
-- Insert the validity check. Note that we do this with validity
-- checks turned off, to avoid recursion, we do not want validity
- -- checks on the validity checking code itself!
+ -- checks on the validity checking code itself.
Insert_Action (Expr, CE, Suppress => Validity_Check);
@@ -6488,7 +6488,7 @@ package body Checks is
-- when a range check is present, but that's not the case, because
-- the back end is allowed to assume for the range check that the
-- operand is within its declared range (an assumption that validity
- -- checking is all about NOT assuming!)
+ -- checking is all about NOT assuming).
-- Note: no need to worry about Possible_Local_Raise here, it will
-- already have been called if original node has Do_Range_Check set.
@@ -6645,7 +6645,7 @@ package body Checks is
if Is_Entity_Name (N) then
-- For sure, we want to clear an indication that this is known to
- -- be null, since if we get past this check, it definitely is not!
+ -- be null, since if we get past this check, it definitely is not.
Set_Is_Known_Null (Entity (N), False);
@@ -6672,7 +6672,7 @@ package body Checks is
begin
pragma Assert (Is_Access_Type (Typ));
- -- No check inside a generic (why not???)
+ -- No check inside a generic, check will be emitted in instance
if Inside_A_Generic then
return;
@@ -6690,11 +6690,21 @@ package body Checks is
-- Avoid generating warning message inside init procs. In SPARK mode
-- we can go ahead and call Apply_Compile_Time_Constraint_Error
- -- since it will be truned into an error in any case.
+ -- since it will be turned into an error in any case.
- if not Inside_Init_Proc or else SPARK_Mode = On then
+ if (not Inside_Init_Proc or else SPARK_Mode = On)
+
+ -- Do not emit the warning within a conditional expression,
+ -- where the expression might not be evaluated, and the warning
+ -- appear as extraneous noise.
+
+ and then not Within_Case_Or_If_Expression (N)
+ then
Apply_Compile_Time_Constraint_Error
(N, "null value not allowed here??", CE_Access_Check_Failed);
+
+ -- Remaining cases, where we silently insert the raise
+
else
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
@@ -7013,7 +7023,7 @@ package body Checks is
-- This is called when we have modified the node and we therefore need
-- to reanalyze it. It is important that we reset the mode to STRICT for
-- this reanalysis, since if we leave it in MINIMIZED or ELIMINATED mode
- -- we would reenter this routine recursively which would not be good!
+ -- we would reenter this routine recursively which would not be good.
-- The argument Suppress is set True if we also want to suppress
-- overflow checking for the reexpansion (this is set when we know
-- overflow is not possible). Typ is the type for the reanalysis.
@@ -7144,7 +7154,7 @@ package body Checks is
-- Use the normal Determine_Range routine to get the range. We
-- don't require operands to be valid, invalid values may result in
-- rubbish results where the result has not been properly checked for
- -- overflow, that's fine!
+ -- overflow, that's fine.
Determine_Range (N, OK, Lo, Hi, Assume_Valid => False);
@@ -7194,7 +7204,7 @@ package body Checks is
-- If at least one of our operands is now Bignum, we must rebuild
-- the if expression to use Bignum operands. We will analyze the
-- rebuilt if expression with overflow checks off, since once we
- -- are in bignum mode, we are all done with overflow checks!
+ -- are in bignum mode, we are all done with overflow checks.
if Bignum_Operands then
Rewrite (N,
@@ -7671,7 +7681,7 @@ package body Checks is
-- here because it will cause recursion into the whole MINIMIZED/
-- ELIMINATED overflow processing which is not what we want. Here
-- we are at the top level, and we need a check against the result
- -- mode (i.e. we want to use STRICT mode). So do exactly that!
+ -- mode (i.e. we want to use STRICT mode). So do exactly that.
-- Also, we have not modified the node, so this is a case where
-- we need to reexpand, but not reanalyze.
@@ -7811,7 +7821,7 @@ package body Checks is
-- Here we will do the operation in Long_Long_Integer. We do this even
-- if we know an overflow check is required, better to do this in long
- -- long integer mode, since we are less likely to overflow!
+ -- long integer mode, since we are less likely to overflow.
-- Convert right or only operand to Long_Long_Integer, except that
-- we do not touch the exponentiation right operand.
@@ -7839,7 +7849,7 @@ package body Checks is
-- setting of the Do_Division_Check flag).
-- We do this reanalysis in STRICT mode to avoid recursion into the
- -- MINIMIZED/ELIMINATED handling, since we are now done with that!
+ -- MINIMIZED/ELIMINATED handling, since we are now done with that.
declare
SG : constant Overflow_Mode_Type :=
diff --git a/main/gcc/ada/clean.adb b/main/gcc/ada/clean.adb
index cbaaa61c7d0..83e81cbe840 100644
--- a/main/gcc/ada/clean.adb
+++ b/main/gcc/ada/clean.adb
@@ -1416,6 +1416,12 @@ package body Clean is
if Main_Project = No_Project then
Fail ("""" & Project_File_Name.all & """ processing failed");
+
+ elsif Main_Project.Qualifier = Aggregate then
+ Fail ("aggregate projects are not supported");
+
+ elsif Aggregate_Libraries_In (Project_Tree) then
+ Fail ("aggregate library projects are not supported");
end if;
if Opt.Verbose_Mode then
diff --git a/main/gcc/ada/comperr.adb b/main/gcc/ada/comperr.adb
index ac620e6227c..13646a5c155 100644
--- a/main/gcc/ada/comperr.adb
+++ b/main/gcc/ada/comperr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -115,15 +115,15 @@ package body Comperr is
Abort_In_Progress := True;
- -- Generate a "standard" error message instead of a bug box in case of
- -- .NET compiler, since we do not support all constructs of the
- -- language. Of course ideally, we should detect this before bombing
- -- on e.g. an assertion error, but in practice most of these bombs
- -- are due to a legitimate case of a construct not being supported (in
- -- a sense they all are, since for sure we are not supporting something
- -- if we bomb!) By giving this message, we provide a more reasonable
- -- practical interface, since giving scary bug boxes on unsupported
- -- features is definitely not helpful.
+ -- Generate a "standard" error message instead of a bug box in case
+ -- of .NET compiler, since we do not support all constructs of the
+ -- language. Of course ideally, we should detect this before bombing on
+ -- e.g. an assertion error, but in practice most of these bombs are due
+ -- to a legitimate case of a construct not being supported (in a sense
+ -- they all are, since for sure we are not supporting something if we
+ -- bomb). By giving this message, we provide a more reasonable practical
+ -- interface, since giving scary bug boxes on unsupported features is
+ -- definitely not helpful.
-- Similarly if we are generating SCIL, an error message is sufficient
-- instead of generating a bug box.
diff --git a/main/gcc/ada/cstand.adb b/main/gcc/ada/cstand.adb
index ed022388049..062a2dab8a2 100644
--- a/main/gcc/ada/cstand.adb
+++ b/main/gcc/ada/cstand.adb
@@ -1126,7 +1126,7 @@ package body CStand is
-- special insertion character } for types results in special handling
-- of these type names in any case. The blanks in these names would
-- trouble in Gigi, but that's OK here, since none of these types
- -- should ever get through to Gigi! Attributes of these types are
+ -- should ever get through to Gigi. Attributes of these types are
-- filled out to minimize problems with cascaded errors (for example,
-- Any_Integer is given reasonable and consistent type and size values)
@@ -1812,7 +1812,7 @@ package body CStand is
Set_Needs_Debug_Info (E);
-- All standard entities are built with fully qualified names, so
- -- set the flag to prevent an abortive attempt at requalification!
+ -- set the flag to prevent an abortive attempt at requalification.
Set_Has_Qualified_Name (E);
@@ -1828,7 +1828,7 @@ package body CStand is
procedure Print_Standard is
procedure P (Item : String) renames Output.Write_Line;
- -- Short-hand, since we do a lot of line writes here!
+ -- Short-hand, since we do a lot of line writes here
procedure P_Int_Range (Size : Pos);
-- Prints the range of an integer based on its Size
diff --git a/main/gcc/ada/debug_a.adb b/main/gcc/ada/debug_a.adb
index 43455b910d9..30d584e09db 100644
--- a/main/gcc/ada/debug_a.adb
+++ b/main/gcc/ada/debug_a.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -44,7 +44,7 @@ package body Debug_A is
-- A stack used to keep track of Node_Id values for setting the value of
-- Current_Error_Node correctly. Note that if we have more than 200
-- recursion levels, we just don't reset the right value on exit, which
- -- is not crucial, since this is only for debugging!
+ -- is not crucial, since this is only for debugging.
-----------------------
-- Local Subprograms --
diff --git a/main/gcc/ada/einfo.adb b/main/gcc/ada/einfo.adb
index 8d81ce8ff26..660a37a79a9 100644
--- a/main/gcc/ada/einfo.adb
+++ b/main/gcc/ada/einfo.adb
@@ -86,14 +86,15 @@ package body Einfo is
-- Class_Wide_Type Node9
-- Current_Value Node9
+ -- Part_Of_Constituents Elist9
-- Renaming_Map Uint9
+ -- Encapsulating_State Node10
-- Direct_Primitive_Operations Elist10
-- Discriminal_Link Node10
-- Float_Rep Uint10 (but returns Float_Rep_Kind)
-- Handler_Records List10
-- Normalized_Position_Max Uint10
- -- Refined_State Node10
-- Component_Bit_Offset Uint11
-- Full_View Node11
@@ -551,7 +552,6 @@ package body Einfo is
-- Has_Delayed_Rep_Aspects Flag261
-- May_Inherit_Delayed_Rep_Aspects Flag262
-- Has_Visible_Refinement Flag263
- -- Has_Body_References Flag264
-- SPARK_Pragma_Inherited Flag265
-- SPARK_Aux_Pragma_Inherited Flag266
@@ -559,6 +559,7 @@ package body Einfo is
-- (unused) Flag2
-- (unused) Flag3
+ -- (unused) Flag264
-- (unused) Flag267
-- (unused) Flag268
-- (unused) Flag269
@@ -1059,6 +1060,12 @@ package body Einfo is
return Flag174 (Id);
end Elaboration_Entity_Required;
+ function Encapsulating_State (Id : E) return N is
+ begin
+ pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable));
+ return Node10 (Id);
+ end Encapsulating_State;
+
function Enclosing_Scope (Id : E) return E is
begin
return Node18 (Id);
@@ -1327,12 +1334,6 @@ package body Einfo is
return Flag139 (Id);
end Has_Biased_Representation;
- function Has_Body_References (Id : E) return B is
- begin
- pragma Assert (Ekind (Id) = E_Abstract_State);
- return Flag264 (Id);
- end Has_Body_References;
-
function Has_Completion (Id : E) return B is
begin
return Flag26 (Id);
@@ -2630,6 +2631,12 @@ package body Einfo is
return Node19 (Base_Type (Id));
end Parent_Subtype;
+ function Part_Of_Constituents (Id : E) return L is
+ begin
+ pragma Assert (Ekind (Id) = E_Abstract_State);
+ return Elist9 (Id);
+ end Part_Of_Constituents;
+
function Postcondition_Proc (Id : E) return E is
begin
pragma Assert (Ekind (Id) = E_Procedure);
@@ -2705,12 +2712,6 @@ package body Einfo is
return Flag227 (Id);
end Referenced_As_Out_Parameter;
- function Refined_State (Id : E) return N is
- begin
- pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable));
- return Node10 (Id);
- end Refined_State;
-
function Refinement_Constituents (Id : E) return L is
begin
pragma Assert (Ekind (Id) = E_Abstract_State);
@@ -3714,6 +3715,12 @@ package body Einfo is
Set_Flag174 (Id, V);
end Set_Elaboration_Entity_Required;
+ procedure Set_Encapsulating_State (Id : E; V : E) is
+ begin
+ pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable));
+ Set_Node10 (Id, V);
+ end Set_Encapsulating_State;
+
procedure Set_Enclosing_Scope (Id : E; V : E) is
begin
Set_Node18 (Id, V);
@@ -3994,12 +4001,6 @@ package body Einfo is
Set_Flag139 (Id, V);
end Set_Has_Biased_Representation;
- procedure Set_Has_Body_References (Id : E; V : B := True) is
- begin
- pragma Assert (Ekind (Id) = E_Abstract_State);
- Set_Flag264 (Id, V);
- end Set_Has_Body_References;
-
procedure Set_Has_Completion (Id : E; V : B := True) is
begin
Set_Flag26 (Id, V);
@@ -5352,6 +5353,12 @@ package body Einfo is
Set_Node19 (Id, V);
end Set_Parent_Subtype;
+ procedure Set_Part_Of_Constituents (Id : E; V : L) is
+ begin
+ pragma Assert (Ekind (Id) = E_Abstract_State);
+ Set_Elist9 (Id, V);
+ end Set_Part_Of_Constituents;
+
procedure Set_Postcondition_Proc (Id : E; V : E) is
begin
pragma Assert (Ekind (Id) = E_Procedure);
@@ -5435,12 +5442,6 @@ package body Einfo is
Set_Flag227 (Id, V);
end Set_Referenced_As_Out_Parameter;
- procedure Set_Refined_State (Id : E; V : E) is
- begin
- pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable));
- Set_Node10 (Id, V);
- end Set_Refined_State;
-
procedure Set_Refinement_Constituents (Id : E; V : L) is
begin
pragma Assert (Ekind (Id) = E_Abstract_State);
@@ -6445,6 +6446,7 @@ package body Einfo is
Id = Pragma_Global or else
Id = Pragma_Initial_Condition or else
Id = Pragma_Initializes or else
+ Id = Pragma_Part_Of or else
Id = Pragma_Refined_Depends or else
Id = Pragma_Refined_Global or else
Id = Pragma_Refined_State;
@@ -6453,7 +6455,8 @@ package body Einfo is
Id = Pragma_Test_Case;
Is_PPC : constant Boolean :=
Id = Pragma_Precondition or else
- Id = Pragma_Postcondition;
+ Id = Pragma_Postcondition or else
+ Id = Pragma_Refined_Post;
In_Contract : constant Boolean := Is_CDG or Is_CTC or Is_PPC;
@@ -8095,7 +8098,6 @@ package body Einfo is
W ("Has_Anonymous_Master", Flag253 (Id));
W ("Has_Atomic_Components", Flag86 (Id));
W ("Has_Biased_Representation", Flag139 (Id));
- W ("Has_Body_References", Flag264 (Id));
W ("Has_Completion", Flag26 (Id));
W ("Has_Completion_In_Body", Flag71 (Id));
W ("Has_Complex_Representation", Flag140 (Id));
@@ -8535,6 +8537,9 @@ package body Einfo is
when Object_Kind =>
Write_Str ("Current_Value");
+ when E_Abstract_State =>
+ Write_Str ("Part_Of_Constituents");
+
when E_Function |
E_Generic_Function |
E_Generic_Package |
@@ -8555,6 +8560,10 @@ package body Einfo is
procedure Write_Field10_Name (Id : Entity_Id) is
begin
case Ekind (Id) is
+ when E_Abstract_State |
+ E_Variable =>
+ Write_Str ("Encapsulating_State");
+
when Class_Wide_Kind |
Incomplete_Kind |
E_Record_Type |
@@ -8580,10 +8589,6 @@ package body Einfo is
E_Discriminant =>
Write_Str ("Normalized_Position_Max");
- when E_Abstract_State |
- E_Variable =>
- Write_Str ("Refined_State");
-
when others =>
Write_Str ("Field10??");
end case;
diff --git a/main/gcc/ada/einfo.ads b/main/gcc/ada/einfo.ads
index 352574311c0..e006455dbc2 100644
--- a/main/gcc/ada/einfo.ads
+++ b/main/gcc/ada/einfo.ads
@@ -127,7 +127,7 @@ package Einfo is
-- Handling of Type'Size Values --
----------------------------------
--- The Ada 95 RM contains some rather peculiar (to us!) rules on the value
+-- The Ada 95 RM contains some rather peculiar (to us) rules on the value
-- of type'Size (see RM 13.3(55)). We have found that attempting to use
-- these RM Size values generally, and in particular for determining the
-- default size of objects, creates chaos, and major incompatibilities in
@@ -494,10 +494,10 @@ package Einfo is
-- when the unit is part of a standalone library.
-- Body_References (Elist16)
--- Defined in abstract state entities. Only set if Has_Body_References
--- flag is set True, in which case it contains an element list of global
--- references (identifiers) in the current package body to this abstract
--- state that are illegal if the abstract state has a visible refinement.
+-- Defined in abstract state entities. Contains an element list of
+-- references (identifiers) that appear in a package body whose spec
+-- defines the related state. If the body refines the said state, all
+-- references on this list are illegal due to the visible refinement.
-- C_Pass_By_Copy (Flag125) [implementation base type only]
-- Defined in record types. Set if a pragma Convention for the record
@@ -976,6 +976,10 @@ package Einfo is
-- then if there is no other elaboration code, obviously there is no
-- need to set the flag.
+-- Encapsulating_State (Node10)
+-- Defined in abstract states and variables. Contains the entity of an
+-- ancestor state whose refinement utilizes this item as a constituent.
+
-- Enclosing_Scope (Node18)
-- Defined in labels. Denotes the innermost enclosing construct that
-- contains the label. Identical to the scope of the label, except for
@@ -1403,10 +1407,6 @@ package Einfo is
-- size of the type, forcing biased representation for the object, but
-- the subtype is still an unbiased type.
--- Has_Body_References (Flag264)
--- Defined in entities for abstract states. Set if Body_References has
--- at least one entry.
-
-- Has_Completion (Flag26)
-- Defined in all entities that require a completion (functions,
-- procedures, private types, limited private types, incomplete types,
@@ -3435,6 +3435,10 @@ package Einfo is
-- case it points to the subtype of the parent type. This is the type
-- that is used as the Etype of the _parent field.
+-- Part_Of_Constituents (Elist9)
+-- Present in abstract state entities. Contains all constituents that are
+-- subject to indicator Part_Of (both aspect and option variants).
+
-- Postcondition_Proc (Node8)
-- Defined only in procedure entities, saves the entity of the generated
-- postcondition proc if one is present, otherwise is set to Empty. Used
@@ -3549,10 +3553,6 @@ package Einfo is
-- we have a separate warning for variables that are only assigned and
-- never read, and out parameters are a special case.
--- Refined_State (Node10)
--- Defined in abstract states and variables. Contains the entity of an
--- ancestor state whose refinement mentions this item.
-
-- Refinement_Constituents (Elist8)
-- Present in abstract state entities. Contains all the constituents that
-- refine the state, in other words, all the hidden states that appear in
@@ -3738,7 +3738,7 @@ package Einfo is
-- Scope_Depth_Set (synthesized)
-- Applies to a special predicate function that returns a Boolean value
-- indicating whether or not the Scope_Depth field has been set. It is
--- needed, since returns an invalid value in this case!
+-- needed, since returns an invalid value in this case.
-- Sec_Stack_Needed_For_Return (Flag167)
-- Defined in scope entities (blocks, functions, procedures, tasks,
@@ -4570,7 +4570,7 @@ package Einfo is
);
for Entity_Kind'Size use 8;
- -- The data structures in Atree assume this!
+ -- The data structures in Atree assume this
--------------------------
-- Subtype Declarations --
@@ -5146,11 +5146,11 @@ package Einfo is
-- E_Abstract_State
-- Refinement_Constituents (Elist8)
- -- Refined_State (Node10)
+ -- Part_Of_Constituents (Elist9)
+ -- Encapsulating_State (Node10)
-- Body_References (Elist16)
-- Non_Limited_View (Node17)
-- From_Limited_With (Flag159)
- -- Has_Body_References (Flag264)
-- Has_Visible_Refinement (Flag263)
-- Has_Non_Null_Refinement (synth)
-- Has_Null_Refinement (synth)
@@ -5982,7 +5982,7 @@ package Einfo is
-- E_Variable
-- Hiding_Loop_Variable (Node8)
-- Current_Value (Node9)
- -- Refined_State (Node10)
+ -- Encapsulating_State (Node10)
-- Esize (Uint12)
-- Extra_Accessibility (Node13)
-- Alignment (Uint14)
@@ -6076,7 +6076,7 @@ package Einfo is
-- computation. Of course, from the point of view of a user of this
-- package, the distinction is not visible (even the field information
-- provided below should be disregarded, as it is subject to change
- -- without notice!). A number of attributes appear as lists: lists of
+ -- without notice). A number of attributes appear as lists: lists of
-- formals, lists of actuals, of discriminants, etc. For these, pairs
-- of functions are defined, which take the form:
@@ -6328,6 +6328,7 @@ package Einfo is
function Elaborate_Body_Desirable (Id : E) return B;
function Elaboration_Entity (Id : E) return E;
function Elaboration_Entity_Required (Id : E) return B;
+ function Encapsulating_State (Id : E) return E;
function Enclosing_Scope (Id : E) return E;
function Entry_Accepted (Id : E) return B;
function Entry_Bodies_Array (Id : E) return E;
@@ -6372,7 +6373,6 @@ package Einfo is
function Has_Anonymous_Master (Id : E) return B;
function Has_Atomic_Components (Id : E) return B;
function Has_Biased_Representation (Id : E) return B;
- function Has_Body_References (Id : E) return B;
function Has_Completion (Id : E) return B;
function Has_Completion_In_Body (Id : E) return B;
function Has_Complex_Representation (Id : E) return B;
@@ -6604,6 +6604,7 @@ package Einfo is
function Package_Instantiation (Id : E) return N;
function Packed_Array_Type (Id : E) return E;
function Parent_Subtype (Id : E) return E;
+ function Part_Of_Constituents (Id : E) return L;
function Postcondition_Proc (Id : E) return E;
function Prival (Id : E) return E;
function Prival_Link (Id : E) return E;
@@ -6617,7 +6618,6 @@ package Einfo is
function Referenced (Id : E) return B;
function Referenced_As_LHS (Id : E) return B;
function Referenced_As_Out_Parameter (Id : E) return B;
- function Refined_State (Id : E) return E;
function Refinement_Constituents (Id : E) return L;
function Register_Exception_Call (Id : E) return N;
function Related_Array_Object (Id : E) return E;
@@ -6949,6 +6949,7 @@ package Einfo is
procedure Set_Elaborate_Body_Desirable (Id : E; V : B := True);
procedure Set_Elaboration_Entity (Id : E; V : E);
procedure Set_Elaboration_Entity_Required (Id : E; V : B := True);
+ procedure Set_Encapsulating_State (Id : E; V : E);
procedure Set_Enclosing_Scope (Id : E; V : E);
procedure Set_Entry_Accepted (Id : E; V : B := True);
procedure Set_Entry_Bodies_Array (Id : E; V : E);
@@ -6992,7 +6993,6 @@ package Einfo is
procedure Set_Has_Anonymous_Master (Id : E; V : B := True);
procedure Set_Has_Atomic_Components (Id : E; V : B := True);
procedure Set_Has_Biased_Representation (Id : E; V : B := True);
- procedure Set_Has_Body_References (Id : E; V : B := True);
procedure Set_Has_Completion (Id : E; V : B := True);
procedure Set_Has_Completion_In_Body (Id : E; V : B := True);
procedure Set_Has_Complex_Representation (Id : E; V : B := True);
@@ -7228,6 +7228,7 @@ package Einfo is
procedure Set_Package_Instantiation (Id : E; V : N);
procedure Set_Packed_Array_Type (Id : E; V : E);
procedure Set_Parent_Subtype (Id : E; V : E);
+ procedure Set_Part_Of_Constituents (Id : E; V : L);
procedure Set_Postcondition_Proc (Id : E; V : E);
procedure Set_Prival (Id : E; V : E);
procedure Set_Prival_Link (Id : E; V : E);
@@ -7241,7 +7242,6 @@ package Einfo is
procedure Set_Referenced (Id : E; V : B := True);
procedure Set_Referenced_As_LHS (Id : E; V : B := True);
procedure Set_Referenced_As_Out_Parameter (Id : E; V : B := True);
- procedure Set_Refined_State (Id : E; V : E);
procedure Set_Refinement_Constituents (Id : E; V : L);
procedure Set_Register_Exception_Call (Id : E; V : N);
procedure Set_Related_Array_Object (Id : E; V : E);
@@ -7504,11 +7504,14 @@ package Einfo is
-- Global
-- Initial_Condition
-- Initializes
+ -- Part_Of
-- Precondition
-- Postcondition
-- Refined_Depends
-- Refined_Global
+ -- Refined_Post
-- Refined_State
+ -- Test_Case
function Get_Record_Representation_Clause (E : Entity_Id) return Node_Id;
-- Searches the Rep_Item chain for a given entity E, for a record
@@ -7680,6 +7683,7 @@ package Einfo is
pragma Inline (Elaborate_Body_Desirable);
pragma Inline (Elaboration_Entity);
pragma Inline (Elaboration_Entity_Required);
+ pragma Inline (Encapsulating_State);
pragma Inline (Enclosing_Scope);
pragma Inline (Entry_Accepted);
pragma Inline (Entry_Bodies_Array);
@@ -7722,7 +7726,6 @@ package Einfo is
pragma Inline (Has_Anonymous_Master);
pragma Inline (Has_Atomic_Components);
pragma Inline (Has_Biased_Representation);
- pragma Inline (Has_Body_References);
pragma Inline (Has_Completion);
pragma Inline (Has_Completion_In_Body);
pragma Inline (Has_Complex_Representation);
@@ -8000,6 +8003,7 @@ package Einfo is
pragma Inline (Packed_Array_Type);
pragma Inline (Parameter_Mode);
pragma Inline (Parent_Subtype);
+ pragma Inline (Part_Of_Constituents);
pragma Inline (Postcondition_Proc);
pragma Inline (Prival);
pragma Inline (Prival_Link);
@@ -8013,7 +8017,6 @@ package Einfo is
pragma Inline (Referenced);
pragma Inline (Referenced_As_LHS);
pragma Inline (Referenced_As_Out_Parameter);
- pragma Inline (Refined_State);
pragma Inline (Refinement_Constituents);
pragma Inline (Register_Exception_Call);
pragma Inline (Related_Array_Object);
@@ -8149,6 +8152,7 @@ package Einfo is
pragma Inline (Set_Elaborate_Body_Desirable);
pragma Inline (Set_Elaboration_Entity);
pragma Inline (Set_Elaboration_Entity_Required);
+ pragma Inline (Set_Encapsulating_State);
pragma Inline (Set_Enclosing_Scope);
pragma Inline (Set_Entry_Accepted);
pragma Inline (Set_Entry_Bodies_Array);
@@ -8189,7 +8193,6 @@ package Einfo is
pragma Inline (Set_Has_Anonymous_Master);
pragma Inline (Set_Has_Atomic_Components);
pragma Inline (Set_Has_Biased_Representation);
- pragma Inline (Set_Has_Body_References);
pragma Inline (Set_Has_Completion);
pragma Inline (Set_Has_Completion_In_Body);
pragma Inline (Set_Has_Complex_Representation);
@@ -8424,6 +8427,7 @@ package Einfo is
pragma Inline (Set_Package_Instantiation);
pragma Inline (Set_Packed_Array_Type);
pragma Inline (Set_Parent_Subtype);
+ pragma Inline (Set_Part_Of_Constituents);
pragma Inline (Set_Postcondition_Proc);
pragma Inline (Set_Prival);
pragma Inline (Set_Prival_Link);
@@ -8437,7 +8441,6 @@ package Einfo is
pragma Inline (Set_Referenced);
pragma Inline (Set_Referenced_As_LHS);
pragma Inline (Set_Referenced_As_Out_Parameter);
- pragma Inline (Set_Refined_State);
pragma Inline (Set_Refinement_Constituents);
pragma Inline (Set_Register_Exception_Call);
pragma Inline (Set_Related_Array_Object);
diff --git a/main/gcc/ada/errout.adb b/main/gcc/ada/errout.adb
index f3469364c82..390583794b5 100644
--- a/main/gcc/ada/errout.adb
+++ b/main/gcc/ada/errout.adb
@@ -23,7 +23,7 @@
-- --
------------------------------------------------------------------------------
--- Warning! Error messages can be generated during Gigi processing by direct
+-- Warning: Error messages can be generated during Gigi processing by direct
-- calls to error message routines, so it is essential that the processing
-- in this body be consistent with the requirements for the Gigi processing
-- environment, and that in particular, no disallowed table expansion is
@@ -3113,7 +3113,7 @@ package body Errout is
-- but it makes too much noise to be accurate and add 'Base in all
-- cases. Note that we only do this is the first named subtype is not
-- itself an internal name. This avoids the obvious loop (subtype ->
- -- basetype -> subtype) which would otherwise occur!)
+ -- basetype -> subtype) which would otherwise occur).
else
declare
@@ -3152,7 +3152,7 @@ package body Errout is
-- If we are stuck in a loop, get out and settle for the internal
-- name after all. In this case we set to kill the message if it is
-- not the first error message (we really try hard not to show the
- -- dirty laundry of the implementation to the poor user!)
+ -- dirty laundry of the implementation to the poor user).
if Ent = Old_Ent then
Kill_Message := True;
diff --git a/main/gcc/ada/erroutc.adb b/main/gcc/ada/erroutc.adb
index 63aea28e86a..6924ce26449 100644
--- a/main/gcc/ada/erroutc.adb
+++ b/main/gcc/ada/erroutc.adb
@@ -23,7 +23,7 @@
-- --
------------------------------------------------------------------------------
--- Warning! Error messages can be generated during Gigi processing by direct
+-- Warning: Error messages can be generated during Gigi processing by direct
-- calls to error message routines, so it is essential that the processing
-- in this body be consistent with the requirements for the Gigi processing
-- environment, and that in particular, no disallowed table expansion is
@@ -185,7 +185,7 @@ package body Erroutc is
return;
-- Otherwise see if continuations are the same, if not, keep both
- -- sequences, a curious case, but better to keep everything!
+ -- sequences, a curious case, but better to keep everything.
elsif not Same_Error (N1, N2) then
return;
diff --git a/main/gcc/ada/erroutc.ads b/main/gcc/ada/erroutc.ads
index 647e58bafdd..5469944e920 100644
--- a/main/gcc/ada/erroutc.ads
+++ b/main/gcc/ada/erroutc.ads
@@ -98,7 +98,7 @@ package Erroutc is
-- ensures that two insertion tokens of maximum length can be accommodated.
-- The value of 1024 is an arbitrary value that should be more than long
-- enough to accommodate any reasonable message (and for that matter, some
- -- pretty unreasonable messages!)
+ -- pretty unreasonable messages).
Msg_Buffer : String (1 .. Max_Msg_Length);
-- Buffer used to prepare error messages
diff --git a/main/gcc/ada/eval_fat.adb b/main/gcc/ada/eval_fat.adb
index d1c9d74859a..bb729f9e0b9 100644
--- a/main/gcc/ada/eval_fat.adb
+++ b/main/gcc/ada/eval_fat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -178,7 +178,7 @@ package body Eval_Fat is
Uintp_Mark : Uintp.Save_Mark;
-- The code is divided into blocks that systematically release
- -- intermediate values (this routine generates lots of junk!)
+ -- intermediate values (this routine generates lots of junk).
begin
if N = Uint_0 then
diff --git a/main/gcc/ada/exp_aggr.adb b/main/gcc/ada/exp_aggr.adb
index 6518e5bb950..5c0f4de7511 100644
--- a/main/gcc/ada/exp_aggr.adb
+++ b/main/gcc/ada/exp_aggr.adb
@@ -4933,7 +4933,7 @@ package body Exp_Aggr is
-- Here we test for is packed array aggregate that we can handle at
-- compile time. If so, return with transformation done. Note that we do
-- this even if the aggregate is nested, because once we have done this
- -- processing, there is no more nested aggregate!
+ -- processing, there is no more nested aggregate.
if Packed_Array_Aggregate_Handled (N) then
return;
@@ -5279,7 +5279,7 @@ package body Exp_Aggr is
-- form (others => 'x'), with a single choice and no expressions,
-- and N is less than 80 (an arbitrary limit for now), then replace
-- the aggregate by the equivalent string literal (but do not mark
- -- it as static since it is not!)
+ -- it as static since it is not).
-- Note: this entire circuit is redundant with respect to code in
-- Expand_Array_Aggregate that collapses others choices to positional
@@ -5303,7 +5303,7 @@ package body Exp_Aggr is
-- But it succeeds (DH looks static to pragma Export)
- -- To be sorted out! ???
+ -- To be sorted out ???
if Present (Component_Associations (N)) then
declare
diff --git a/main/gcc/ada/exp_attr.adb b/main/gcc/ada/exp_attr.adb
index 93a2390168a..a52342cf409 100644
--- a/main/gcc/ada/exp_attr.adb
+++ b/main/gcc/ada/exp_attr.adb
@@ -567,7 +567,7 @@ package body Exp_Attr is
-- of the entities in the Fat packages, but first they have identical
-- names (so we would have to have lots of renaming declarations to
-- meet the normal RE rule of separate names for all runtime entities),
- -- and second there would be an awful lot of them!
+ -- and second there would be an awful lot of them.
Fnm :=
Make_Selected_Component (Loc,
@@ -2602,7 +2602,7 @@ package body Exp_Attr is
-- This is simply a direct conversion from the enumeration type to
-- the target integer type, which is treated by the back end as a
-- normal integer conversion, treating the enumeration type as an
- -- integer, which is exactly what we want! We set Conversion_OK to
+ -- integer, which is exactly what we want. We set Conversion_OK to
-- make sure that the analyzer does not complain about what otherwise
-- might be an illegal conversion.
@@ -2798,7 +2798,7 @@ package body Exp_Attr is
-- Note: it might appear that a properly analyzed unchecked conversion
-- would be just fine here, but that's not the case, since the full
- -- range checks performed by the following call are critical!
+ -- range checks performed by the following call are critical.
Apply_Type_Conversion_Checks (N);
end Fixed_Value;
@@ -3274,7 +3274,7 @@ package body Exp_Attr is
-- Note: it might appear that a properly analyzed unchecked conversion
-- would be just fine here, but that's not the case, since the full
- -- range checks performed by the following call are critical!
+ -- range checks performed by the following call are critical.
Apply_Type_Conversion_Checks (N);
end Integer_Value;
@@ -5775,7 +5775,7 @@ package body Exp_Attr is
begin
-- The value whose validity is being checked has been captured in
-- an object declaration. We certainly don't want this object to
- -- appear valid because the declaration initializes it!
+ -- appear valid because the declaration initializes it.
if Is_Entity_Name (Temp) then
Set_Is_Known_Valid (Entity (Temp), False);
@@ -5991,7 +5991,7 @@ package body Exp_Attr is
-- But that's precisely what won't work because of possible
-- unwanted optimization (and indeed the basic motivation for
- -- the Valid attribute is exactly that this test does not work!)
+ -- the Valid attribute is exactly that this test does not work).
-- What will work is:
-- Btyp!(X) >= Btyp!(type(X)'First)
diff --git a/main/gcc/ada/exp_ch11.adb b/main/gcc/ada/exp_ch11.adb
index db729a62291..8951ffbac74 100644
--- a/main/gcc/ada/exp_ch11.adb
+++ b/main/gcc/ada/exp_ch11.adb
@@ -1118,7 +1118,7 @@ package body Exp_Ch11 is
-- handling of exceptions. When control is passed to the
-- handler, then in the normal case we undefer aborts. In
-- any case this entire handling is relevant only if aborts
- -- are allowed!
+ -- are allowed.
elsif Abort_Allowed
and then Exception_Mechanism /= Back_End_Exceptions
@@ -1431,7 +1431,7 @@ package body Exp_Ch11 is
-- We adjust the condition to deal with the C/Fortran boolean case. This
-- may well not be necessary, as all such conditions are generated by
-- the expander and probably are all standard boolean, but who knows
- -- what strange optimization in future may require this adjustment!
+ -- what strange optimization in future may require this adjustment.
Adjust_Condition (Condition (N));
@@ -1505,7 +1505,7 @@ package body Exp_Ch11 is
-- We adjust the condition to deal with the C/Fortran boolean case. This
-- may well not be necessary, as all such conditions are generated by
-- the expander and probably are all standard boolean, but who knows
- -- what strange optimization in future may require this adjustment!
+ -- what strange optimization in future may require this adjustment.
Adjust_Condition (Condition (N));
@@ -1822,7 +1822,7 @@ package body Exp_Ch11 is
-- We adjust the condition to deal with the C/Fortran boolean case. This
-- may well not be necessary, as all such conditions are generated by
-- the expander and probably are all standard boolean, but who knows
- -- what strange optimization in future may require this adjustment!
+ -- what strange optimization in future may require this adjustment.
Adjust_Condition (Condition (N));
@@ -2171,7 +2171,7 @@ package body Exp_Ch11 is
-- Note: it is a little irregular for the body of exp_ch11 to know
-- the details of the encoding scheme for names, but on the other
- -- hand, gigi knows them, and this is for gigi's benefit anyway!
+ -- hand, gigi knows them, and this is for gigi's benefit anyway.
if Name_Buffer (1 .. 30) /= "system__aux_dec__non_ada_error" then
return False;
diff --git a/main/gcc/ada/exp_ch3.adb b/main/gcc/ada/exp_ch3.adb
index d055831e34b..f3055872099 100644
--- a/main/gcc/ada/exp_ch3.adb
+++ b/main/gcc/ada/exp_ch3.adb
@@ -3406,7 +3406,7 @@ package body Exp_Ch3 is
-- the client will think an initialization procedure is present
-- and call it, when in fact no such procedure is required, but
-- since the call is generated, there had better be a routine
- -- at the other end of the call, even if it does nothing!)
+ -- at the other end of the call, even if it does nothing).
-- Note: the reason we exclude the CPP_Class case is because in this
-- case the initialization is performed by the C++ constructors, and
@@ -5298,7 +5298,7 @@ package body Exp_Ch3 is
elsif Is_Interface (Typ)
-- Avoid never-ending recursion because if Equivalent_Type is set
- -- then we've done it already and must not do it again!
+ -- then we've done it already and must not do it again.
and then not
(Nkind (Object_Definition (N)) = N_Identifier
@@ -5746,7 +5746,7 @@ package body Exp_Ch3 is
-- We do not analyze this renaming declaration, because all its
-- components have already been analyzed, and if we were to go
-- ahead and analyze it, we would in effect be trying to generate
- -- another declaration of X, which won't do!
+ -- another declaration of X, which won't do.
Set_Renamed_Object (Defining_Identifier (N), Expr_Q);
Set_Analyzed (N);
@@ -6295,7 +6295,7 @@ package body Exp_Ch3 is
-- Note: if exceptions are not supported, then we suppress the raise
-- and return -1 unconditionally (this is an erroneous program in any
- -- case and there is no obligation to raise Constraint_Error here!) We
+ -- case and there is no obligation to raise Constraint_Error here). We
-- also do this if pragma Restrictions (No_Exceptions) is active.
-- Is this right??? What about No_Exception_Propagation???
@@ -9632,7 +9632,8 @@ package body Exp_Ch3 is
-- If the parent is an interface type then it has defined all the
-- predefined primitives abstract and we need to check if the type
- -- has some user defined "=" function to avoid generating it.
+ -- has some user defined "=" function which matches the profile of
+ -- the Ada predefined equality operator to avoid generating it.
elsif Is_Interface (Etype (Tag_Typ)) then
Eq_Needed := True;
@@ -9642,6 +9643,16 @@ package body Exp_Ch3 is
while Present (Prim) loop
if Chars (Node (Prim)) = Name_Op_Eq
and then not Is_Internal (Node (Prim))
+ and then Present (First_Entity (Node (Prim)))
+
+ -- The predefined equality primitive must have exactly two
+ -- formals whose type is this tagged type
+
+ and then Present (Last_Entity (Node (Prim)))
+ and then Next_Entity (First_Entity (Node (Prim)))
+ = Last_Entity (Node (Prim))
+ and then Etype (First_Entity (Node (Prim))) = Tag_Typ
+ and then Etype (Last_Entity (Node (Prim))) = Tag_Typ
then
Eq_Needed := False;
Eq_Name := No_Name;
@@ -9784,7 +9795,7 @@ package body Exp_Ch3 is
Append_To (Res, Decl);
end if;
- -- Body for inequality (if required!)
+ -- Body for inequality (if required)
Decl := Make_Neq_Body (Tag_Typ);
diff --git a/main/gcc/ada/exp_ch4.adb b/main/gcc/ada/exp_ch4.adb
index 6952665ce21..06c69b1fc36 100644
--- a/main/gcc/ada/exp_ch4.adb
+++ b/main/gcc/ada/exp_ch4.adb
@@ -1790,7 +1790,7 @@ package body Exp_Ch4 is
-- components of the arrays.
--
-- The actual way the code works is to return the comparison of
- -- corresponding components for the N+1 call. That's neater!
+ -- corresponding components for the N+1 call. That's neater.
function Test_Empty_Arrays return Node_Id;
-- This function constructs the test for both arrays being empty
@@ -4419,7 +4419,7 @@ package body Exp_Ch4 is
Analyze_And_Resolve (N, PtrT);
-- We set the variable as statically allocated, since we don't want
- -- it going on the stack of the current procedure!
+ -- it going on the stack of the current procedure.
Set_Is_Statically_Allocated (Temp);
return;
@@ -5727,7 +5727,7 @@ package body Exp_Ch4 is
-- way we get all the processing above for an explicit range.
-- Don't do this for predicated types, since in this case we
- -- want to check the predicate!
+ -- want to check the predicate.
elsif Is_Scalar_Type (Typ) then
if No (Predicate_Function (Typ)) then
@@ -6004,7 +6004,7 @@ package body Exp_Ch4 is
-- If a predicate is present, then we do the predicate test, but we
-- most certainly want to omit this if we are within the predicate
- -- function itself, since otherwise we have an infinite recursion!
+ -- function itself, since otherwise we have an infinite recursion.
-- The check should also not be emitted when testing against a range
-- (the check is only done when the right operand is a subtype; see
-- RM12-4.5.2 (28.1/3-30/3)).
@@ -7151,7 +7151,7 @@ package body Exp_Ch4 is
then
-- Search for equality operation, checking that the operands
-- have the same type. Note that we must find a matching entry,
- -- or something is very wrong!
+ -- or something is very wrong.
Prim := First_Elmt (Collect_Primitive_Operations (A_Typ));
@@ -9127,7 +9127,7 @@ package body Exp_Ch4 is
and then Is_Constrained (Ptyp)
then
-- Do this optimization for discrete types only, and not for
- -- access types (access discriminants get us into trouble!)
+ -- access types (access discriminants get us into trouble).
if not Is_Discrete_Type (Etype (N)) then
null;
@@ -9135,7 +9135,7 @@ package body Exp_Ch4 is
-- Don't do this on the left hand of an assignment statement.
-- Normally one would think that references like this would not
-- occur, but they do in generated code, and mean that we really
- -- do want to assign the discriminant!
+ -- do want to assign the discriminant.
elsif Nkind (Par) = N_Assignment_Statement
and then Name (Par) = N
@@ -9154,7 +9154,7 @@ package body Exp_Ch4 is
-- Don't do this optimization if we are within the code for a
-- discriminant check, since the whole point of such a check may
- -- be to verify the condition on which the code below depends!
+ -- be to verify the condition on which the code below depends.
elsif Is_In_Discriminant_Check (N) then
null;
@@ -9248,7 +9248,7 @@ package body Exp_Ch4 is
return;
-- Otherwise we can just copy the constraint, but the
- -- result is certainly not static! In some cases the
+ -- result is certainly not static. In some cases the
-- discriminant constraint has been analyzed in the
-- context of the original subtype indication, but for
-- itypes the constraint might not have been analyzed
@@ -9961,7 +9961,7 @@ package body Exp_Ch4 is
-- in Checks.Apply_Arithmetic_Overflow_Check, but we catch more cases in
-- the processing here. Also we still need the Checks circuit, since we
-- have to be sure not to generate junk overflow checks in the first
- -- place, since it would be trick to remove them here!
+ -- place, since it would be trick to remove them here.
if Integer_Promotion_Possible (N) then
diff --git a/main/gcc/ada/exp_ch5.adb b/main/gcc/ada/exp_ch5.adb
index 32108620519..e563ccf8edc 100644
--- a/main/gcc/ada/exp_ch5.adb
+++ b/main/gcc/ada/exp_ch5.adb
@@ -631,7 +631,7 @@ package body Exp_Ch5 is
-- Otherwise, we assume the worst, which is that the two arrays
-- are the same array. There is no need to check if we know that
-- is the case, because if we don't know it, we still have to
- -- assume it!
+ -- assume it.
-- Generally if the same array is involved, then we have an
-- overlapping case. We will have to really assume the worst (i.e.
@@ -697,7 +697,7 @@ package body Exp_Ch5 is
-- Note: the above code MUST be analyzed with checks off, because
-- otherwise the Succ could overflow. But in any case this is more
- -- efficient!
+ -- efficient.
-- Forwards_OK = False, Backwards_OK = True
@@ -709,7 +709,7 @@ package body Exp_Ch5 is
-- Note: the above code MUST be analyzed with checks off, because
-- otherwise the Pred could overflow. But in any case this is more
- -- efficient!
+ -- efficient.
-- Forwards_OK = Backwards_OK = False
@@ -1775,7 +1775,7 @@ package body Exp_Ch5 is
-- We do not need to reanalyze that assignment, and we do not need
-- to worry about references to the temporary, but we do need to
-- make sure that the temporary is not marked as a true constant
- -- since we now have a generated assignment to it!
+ -- since we now have a generated assignment to it.
Set_Is_True_Constant (Tnn, False);
end;
diff --git a/main/gcc/ada/exp_ch6.adb b/main/gcc/ada/exp_ch6.adb
index 8e1e9547072..494f11efdee 100644
--- a/main/gcc/ada/exp_ch6.adb
+++ b/main/gcc/ada/exp_ch6.adb
@@ -825,7 +825,7 @@ package body Exp_Ch6 is
-- We must have a call, since Has_Recursive_Call was set. If not just
-- ignore (this is only an error check, so if we have a funny situation,
- -- due to bugs or errors, we do not want to bomb!)
+ -- due to bugs or errors, we do not want to bomb).
elsif Is_Empty_Elmt_List (Call_List) then
return;
@@ -2043,7 +2043,7 @@ package body Exp_Ch6 is
procedure Do_Backend_Inline is
begin
-- No extra test needed for init subprograms since we know they
- -- are available to the backend!
+ -- are available to the backend.
if Is_Init_Proc (Subp) then
Add_Inlined_Body (Subp);
@@ -3108,7 +3108,7 @@ package body Exp_Ch6 is
-- For an OUT or IN OUT parameter, if the actual is an entity, then
-- clear current values, since they can be clobbered. We are probably
-- doing this in more places than we need to, but better safe than
- -- sorry when it comes to retaining bad current values!
+ -- sorry when it comes to retaining bad current values.
if Ekind (Formal) /= E_In_Parameter
and then Is_Entity_Name (Actual)
@@ -3122,7 +3122,7 @@ package body Exp_Ch6 is
-- For an OUT or IN OUT parameter that is an assignable entity,
-- we do not want to clobber the Last_Assignment field, since
-- if it is set, it was precisely because it is indeed an OUT
- -- or IN OUT parameter! We do reset the Is_Known_Valid flag
+ -- or IN OUT parameter. We do reset the Is_Known_Valid flag
-- since the subprogram could have returned in invalid value.
if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter)
@@ -3746,7 +3746,7 @@ package body Exp_Ch6 is
-- If this is a call to an intrinsic subprogram, then perform the
-- appropriate expansion to the corresponding tree node and we
- -- are all done (since after that the call is gone!)
+ -- are all done (since after that the call is gone).
-- In the case where the intrinsic is to be processed by the back end,
-- the call to Expand_Intrinsic_Call will do nothing, which is fine,
@@ -4056,7 +4056,7 @@ package body Exp_Ch6 is
begin
-- First step, remove all the named parameters from the
-- list (they are still chained using First_Named_Actual
- -- and Next_Named_Actual, so we have not lost them!)
+ -- and Next_Named_Actual, so we have not lost them).
Temp := First (Parameter_Associations (Call_Node));
@@ -5665,7 +5665,7 @@ package body Exp_Ch6 is
if Is_Unc_Decl then
- -- No action needed since return statement has been already removed!
+ -- No action needed since return statement has been already removed
null;
@@ -7634,7 +7634,7 @@ package body Exp_Ch6 is
-----------------------------------
-- The "simple" comes from the syntax rule simple_return_statement. The
- -- semantics are not at all simple!
+ -- semantics are not at all simple.
procedure Expand_Simple_Function_Return (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
diff --git a/main/gcc/ada/exp_ch9.adb b/main/gcc/ada/exp_ch9.adb
index b85dd015f45..0557995c563 100644
--- a/main/gcc/ada/exp_ch9.adb
+++ b/main/gcc/ada/exp_ch9.adb
@@ -3847,9 +3847,10 @@ package body Exp_Ch9 is
Build_Protected_Entry_Specification (Loc, Edef, Empty);
-- Add the following declarations:
+
-- type poVP is access poV;
-- _object : poVP := poVP (_O);
- --
+
-- where _O is the formal parameter associated with the concurrent
-- object. These declarations are needed for Complete_Entry_Body.
@@ -3861,35 +3862,42 @@ package body Exp_Ch9 is
Add_Formal_Renamings (Espec, Op_Decls, Ent, Loc);
Debug_Private_Data_Declarations (Decls);
+ -- Put the declarations and the statements from the entry
+
+ Op_Stats :=
+ New_List (
+ Make_Block_Statement (Loc,
+ Declarations => Decls,
+ Handled_Statement_Sequence =>
+ Handled_Statement_Sequence (N)));
+
case Corresponding_Runtime_Package (Pid) is
when System_Tasking_Protected_Objects_Entries =>
- Complete :=
- New_Reference_To (RTE (RE_Complete_Entry_Body), Loc);
+ Append_To (Op_Stats,
+ Make_Procedure_Call_Statement (End_Loc,
+ Name =>
+ New_Reference_To (RTE (RE_Complete_Entry_Body), Loc),
+ Parameter_Associations => New_List (
+ Make_Attribute_Reference (End_Loc,
+ Prefix =>
+ Make_Selected_Component (End_Loc,
+ Prefix =>
+ Make_Identifier (End_Loc, Name_uObject),
+ Selector_Name =>
+ Make_Identifier (End_Loc, Name_uObject)),
+ Attribute_Name => Name_Unchecked_Access))));
when System_Tasking_Protected_Objects_Single_Entry =>
- Complete :=
- New_Reference_To (RTE (RE_Complete_Single_Entry_Body), Loc);
+
+ -- Historically, a call to Complete_Single_Entry_Body was
+ -- inserted, but it was a null procedure.
+
+ null;
when others =>
raise Program_Error;
end case;
- Op_Stats := New_List (
- Make_Block_Statement (Loc,
- Declarations => Decls,
- Handled_Statement_Sequence =>
- Handled_Statement_Sequence (N)),
-
- Make_Procedure_Call_Statement (End_Loc,
- Name => Complete,
- Parameter_Associations => New_List (
- Make_Attribute_Reference (End_Loc,
- Prefix =>
- Make_Selected_Component (End_Loc,
- Prefix => Make_Identifier (End_Loc, Name_uObject),
- Selector_Name => Make_Identifier (End_Loc, Name_uObject)),
- Attribute_Name => Name_Unchecked_Access))));
-
-- When exceptions can not be propagated, we never need to call
-- Exception_Complete_Entry_Body
@@ -5693,7 +5701,7 @@ package body Exp_Ch9 is
-- Mark NULL statement as coming from source so that it is not
-- eliminated by GIGI.
- -- Another covert channel! If this is a requirement, it must be
+ -- Another covert channel. If this is a requirement, it must be
-- documented in sinfo/einfo ???
Set_Comes_From_Source (Stmt, True);
@@ -8436,7 +8444,6 @@ package body Exp_Ch9 is
Current_Node : Node_Id;
Disp_Op_Body : Node_Id;
New_Op_Body : Node_Id;
- Num_Entries : Natural := 0;
Op_Body : Node_Id;
Op_Id : Entity_Id;
@@ -8625,8 +8632,6 @@ package body Exp_Ch9 is
when N_Entry_Body =>
Op_Id := Defining_Identifier (Op_Body);
- Num_Entries := Num_Entries + 1;
-
New_Op_Body := Build_Protected_Entry (Op_Body, Op_Id, Pid);
Insert_After (Current_Node, New_Op_Body);
@@ -8790,8 +8795,6 @@ package body Exp_Ch9 is
Comp_Id : Entity_Id;
Sub : Node_Id;
Current_Node : Node_Id := N;
- Bdef : Entity_Id := Empty; -- avoid uninit warning
- Edef : Entity_Id := Empty; -- avoid uninit warning
Entries_Aggr : Node_Id;
Body_Id : Entity_Id;
Body_Arr : Node_Id;
@@ -8803,6 +8806,10 @@ package body Exp_Ch9 is
-- to the internal body, for possible inlining later on. The source
-- operation is invisible to the back-end and is never actually called.
+ procedure Expand_Entry_Declaration (Comp : Entity_Id);
+ -- Create the subprograms for the barrier and for the body, and append
+ -- then to Entry_Bodies_Array.
+
function Static_Component_Size (Comp : Entity_Id) return Boolean;
-- When compiling under the Ravenscar profile, private components must
-- have a static size, or else a protected object will require heap
@@ -8860,6 +8867,68 @@ package body Exp_Ch9 is
end if;
end Static_Component_Size;
+ ------------------------------
+ -- Expand_Entry_Declaration --
+ ------------------------------
+
+ procedure Expand_Entry_Declaration (Comp : Entity_Id) is
+ Bdef : Entity_Id;
+ Edef : Entity_Id;
+
+ begin
+ E_Count := E_Count + 1;
+ Comp_Id := Defining_Identifier (Comp);
+
+ Edef :=
+ Make_Defining_Identifier (Loc,
+ Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'E'));
+ Sub :=
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Build_Protected_Entry_Specification (Loc, Edef, Comp_Id));
+
+ Insert_After (Current_Node, Sub);
+ Analyze (Sub);
+
+ -- Build wrapper procedure for pre/postconditions
+
+ Build_PPC_Wrapper (Comp_Id, N);
+
+ Set_Protected_Body_Subprogram
+ (Defining_Identifier (Comp),
+ Defining_Unit_Name (Specification (Sub)));
+
+ Current_Node := Sub;
+
+ Bdef :=
+ Make_Defining_Identifier (Loc,
+ Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'B'));
+ Sub :=
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Build_Barrier_Function_Specification (Loc, Bdef));
+
+ Insert_After (Current_Node, Sub);
+ Analyze (Sub);
+ Set_Protected_Body_Subprogram (Bdef, Bdef);
+ Set_Barrier_Function (Comp_Id, Bdef);
+ Set_Scope (Bdef, Scope (Comp_Id));
+ Current_Node := Sub;
+
+ -- Collect pointers to the protected subprogram and the barrier
+ -- of the current entry, for insertion into Entry_Bodies_Array.
+
+ Append_To (Expressions (Entries_Aggr),
+ Make_Aggregate (Loc,
+ Expressions => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Bdef, Loc),
+ Attribute_Name => Name_Unrestricted_Access),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Edef, Loc),
+ Attribute_Name => Name_Unrestricted_Access))));
+ end Expand_Entry_Declaration;
+
----------------------
-- Register_Handler --
----------------------
@@ -9049,7 +9118,7 @@ package body Exp_Ch9 is
end loop;
end if;
- -- Except for the lock-free implementation, prepend the _Object field
+ -- Except for the lock-free implementation, append the _Object field
-- with the right type to the component list. We need to compute the
-- number of entries, and in some cases the number of Attach_Handler
-- pragmas.
@@ -9253,57 +9322,9 @@ package body Exp_Ch9 is
end if;
elsif Nkind (Comp) = N_Entry_Declaration then
- E_Count := E_Count + 1;
- Comp_Id := Defining_Identifier (Comp);
-
- Edef :=
- Make_Defining_Identifier (Loc,
- Build_Selected_Name (Prot_Typ, Comp_Id, 'E'));
- Sub :=
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Build_Protected_Entry_Specification (Loc, Edef, Comp_Id));
-
- Insert_After (Current_Node, Sub);
- Analyze (Sub);
-
- -- Build wrapper procedure for pre/postconditions
-
- Build_PPC_Wrapper (Comp_Id, N);
- Set_Protected_Body_Subprogram
- (Defining_Identifier (Comp),
- Defining_Unit_Name (Specification (Sub)));
-
- Current_Node := Sub;
-
- Bdef :=
- Make_Defining_Identifier (Loc,
- Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'B'));
- Sub :=
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Build_Barrier_Function_Specification (Loc, Bdef));
-
- Insert_After (Current_Node, Sub);
- Analyze (Sub);
- Set_Protected_Body_Subprogram (Bdef, Bdef);
- Set_Barrier_Function (Comp_Id, Bdef);
- Set_Scope (Bdef, Scope (Comp_Id));
- Current_Node := Sub;
-
- -- Collect pointers to the protected subprogram and the barrier
- -- of the current entry, for insertion into Entry_Bodies_Array.
+ Expand_Entry_Declaration (Comp);
- Append_To (Expressions (Entries_Aggr),
- Make_Aggregate (Loc,
- Expressions => New_List (
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Bdef, Loc),
- Attribute_Name => Name_Unrestricted_Access),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Edef, Loc),
- Attribute_Name => Name_Unrestricted_Access))));
end if;
Next (Comp);
@@ -9316,54 +9337,7 @@ package body Exp_Ch9 is
Comp := First (Private_Declarations (Pdef));
while Present (Comp) loop
if Nkind (Comp) = N_Entry_Declaration then
- E_Count := E_Count + 1;
- Comp_Id := Defining_Identifier (Comp);
-
- Edef :=
- Make_Defining_Identifier (Loc,
- Build_Selected_Name (Prot_Typ, Comp_Id, 'E'));
- Sub :=
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Build_Protected_Entry_Specification (Loc, Edef, Comp_Id));
-
- Insert_After (Current_Node, Sub);
- Analyze (Sub);
-
- Set_Protected_Body_Subprogram
- (Defining_Identifier (Comp),
- Defining_Unit_Name (Specification (Sub)));
-
- Current_Node := Sub;
-
- Bdef :=
- Make_Defining_Identifier (Loc,
- Chars => Build_Selected_Name (Prot_Typ, Comp_Id, 'E'));
-
- Sub :=
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Build_Barrier_Function_Specification (Loc, Bdef));
-
- Insert_After (Current_Node, Sub);
- Analyze (Sub);
- Set_Protected_Body_Subprogram (Bdef, Bdef);
- Set_Barrier_Function (Comp_Id, Bdef);
- Set_Scope (Bdef, Scope (Comp_Id));
- Current_Node := Sub;
-
- -- Collect pointers to the protected subprogram and the barrier
- -- of the current entry, for insertion into Entry_Bodies_Array.
-
- Append_To (Expressions (Entries_Aggr),
- Make_Aggregate (Loc,
- Expressions => New_List (
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Bdef, Loc),
- Attribute_Name => Name_Unrestricted_Access),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Edef, Loc),
- Attribute_Name => Name_Unrestricted_Access))));
+ Expand_Entry_Declaration (Comp);
end if;
Next (Comp);
@@ -9401,15 +9375,7 @@ package body Exp_Ch9 is
Aliased_Present => True,
Object_Definition => New_Reference_To
(RTE (RE_Entry_Body), Loc),
- Expression =>
- Make_Aggregate (Loc,
- Expressions => New_List (
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Bdef, Loc),
- Attribute_Name => Name_Unrestricted_Access),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Edef, Loc),
- Attribute_Name => Name_Unrestricted_Access))));
+ Expression => Remove_Head (Expressions (Entries_Aggr)));
when others =>
raise Program_Error;
@@ -11262,7 +11228,7 @@ package body Exp_Ch9 is
-- Single task declarations should never be present after semantic
-- analysis, since we expect them to be replaced by a declaration of an
-- anonymous task type, followed by a declaration of the task object. We
- -- include this routine to make sure that is happening!
+ -- include this routine to make sure that is happening.
procedure Expand_N_Single_Task_Declaration (N : Node_Id) is
begin
@@ -13428,6 +13394,12 @@ package body Exp_Ch9 is
-- Start of processing for Is_Exception_Safe
begin
+ -- When exceptions can't be propagated, the subprogram returns normally
+
+ if No_Exception_Handlers_Set then
+ return True;
+ end if;
+
-- If the checks handled by the back end are not disabled, we cannot
-- ensure that no exception will be raised.
diff --git a/main/gcc/ada/exp_dbug.adb b/main/gcc/ada/exp_dbug.adb
index 7d74ed13fa4..6db896fa72d 100644
--- a/main/gcc/ada/exp_dbug.adb
+++ b/main/gcc/ada/exp_dbug.adb
@@ -488,7 +488,7 @@ package body Exp_Dbug is
-- If we get an exception, just figure it is a case that we cannot
-- successfully handle using our current approach, since this is
- -- only for debugging, no need to take the compilation with us!
+ -- only for debugging, no need to take the compilation with us.
exception
when others =>
@@ -1199,9 +1199,7 @@ package body Exp_Dbug is
function Is_BNPE (S : Entity_Id) return Boolean is
begin
- return
- Ekind (S) = E_Package
- and then Is_Package_Body_Entity (S);
+ return Ekind (S) = E_Package and then Is_Package_Body_Entity (S);
end Is_BNPE;
--------------------
@@ -1212,7 +1210,7 @@ package body Exp_Dbug is
begin
-- If we got all the way to Standard, then we have certainly
-- fully qualified the name, so set the flag appropriately,
- -- and then return False, since we are most certainly done!
+ -- and then return False, since we are most certainly done.
if S = Standard_Standard then
Set_Has_Fully_Qualified_Name (Ent, True);
@@ -1221,13 +1219,10 @@ package body Exp_Dbug is
-- Otherwise figure out if further qualification is required
else
- return
- Is_Subprogram (Ent)
- or else
- Ekind (Ent) = E_Subprogram_Body
- or else
- (Ekind (S) /= E_Block
- and then not Is_Dynamic_Scope (S));
+ return Is_Subprogram (Ent)
+ or else Ekind (Ent) = E_Subprogram_Body
+ or else (Ekind (S) /= E_Block
+ and then not Is_Dynamic_Scope (S));
end if;
end Qualify_Needed;
diff --git a/main/gcc/ada/exp_disp.adb b/main/gcc/ada/exp_disp.adb
index 1f84738985f..d18e32c18c4 100644
--- a/main/gcc/ada/exp_disp.adb
+++ b/main/gcc/ada/exp_disp.adb
@@ -1287,11 +1287,11 @@ package body Exp_Disp is
Selector_Name => New_Occurrence_Of (Iface_Tag, Loc))));
else
- -- Build internal function to handle the case in which the
- -- actual is null. If the actual is null returns null because
- -- no displacement is required; otherwise performs a type
- -- conversion that will be expanded in the code that returns
- -- the value of the displaced actual. That is:
+ -- Build internal function to handle the case in which the actual is
+ -- null. If the actual is null returns null because no displacement
+ -- is required; otherwise performs a type conversion that will be
+ -- expanded in the code that returns the value of the displaced
+ -- actual. That is:
-- function Func (O : Address) return Iface_Typ is
-- type Op_Typ is access all Operand_Typ;
@@ -5050,7 +5050,7 @@ package body Exp_Disp is
-- Of course this value will only be valid if the tagged type is still
-- in scope, but it clearly must be erroneous to compute the internal
- -- tag of a tagged type that is out of scope!
+ -- tag of a tagged type that is out of scope.
-- We don't do this processing if an explicit external tag has been
-- specified. That's an odd case for which we have already issued a
@@ -7217,7 +7217,7 @@ package body Exp_Disp is
-- the decoration required by the backend.
-- Odd comment, the back end cannot require anything not properly
- -- documented in einfo! ???
+ -- documented in einfo. ???
Set_Is_Dispatch_Table_Entity (RTE (RE_Prim_Ptr));
Set_Is_Dispatch_Table_Entity (RTE (RE_Predef_Prims_Table_Ptr));
diff --git a/main/gcc/ada/exp_fixd.adb b/main/gcc/ada/exp_fixd.adb
index 28b93b5f8a5..37cded71c9e 100644
--- a/main/gcc/ada/exp_fixd.adb
+++ b/main/gcc/ada/exp_fixd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -122,7 +122,7 @@ package body Exp_Fixd is
-- both integer types, which need not be the same. Build_Rem converts the
-- operand with the smaller sized type to match the type of the other
-- operand and sets this as the result type. The result is never rounded
- -- (rem operations cannot be rounded in any case!) On return, the resulting
+ -- (rem operations cannot be rounded in any case). On return, the resulting
-- node is analyzed and has its Etype set.
function Build_Scaled_Divide
@@ -407,7 +407,7 @@ package body Exp_Fixd is
begin
-- If denominator fits in 64 bits, we can build the operations directly
- -- without causing any intermediate overflow, so that's what we do!
+ -- without causing any intermediate overflow, so that's what we do.
if Int'Max (Y_Size, Z_Size) <= 32 then
return
@@ -787,7 +787,7 @@ package body Exp_Fixd is
begin
-- If numerator fits in 64 bits, we can build the operations directly
- -- without causing any intermediate overflow, so that's what we do!
+ -- without causing any intermediate overflow, so that's what we do.
if Int'Max (X_Size, Y_Size) <= 32 then
return
diff --git a/main/gcc/ada/exp_imgv.adb b/main/gcc/ada/exp_imgv.adb
index 5da403bb35d..2a62dad72c2 100644
--- a/main/gcc/ada/exp_imgv.adb
+++ b/main/gcc/ada/exp_imgv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -310,7 +310,8 @@ package body Exp_Imgv is
Tent := Rtyp;
-- For standard character, we have to select the version which handles
- -- soft hyphen correctly, based on the version of Ada in use (ugly!)
+ -- soft hyphen correctly, based on the version of Ada in use (this is
+ -- ugly, but we have no choice).
elsif Rtyp = Standard_Character then
if Ada_Version < Ada_2005 then
diff --git a/main/gcc/ada/exp_intr.adb b/main/gcc/ada/exp_intr.adb
index 6289b1ee224..6f9df388362 100644
--- a/main/gcc/ada/exp_intr.adb
+++ b/main/gcc/ada/exp_intr.adb
@@ -420,7 +420,7 @@ package body Exp_Intr is
New_Occurrence_Of (Choice_Parameter (P), Loc))));
exit;
- -- Keep climbing!
+ -- Keep climbing
else
P := Parent (P);
@@ -747,7 +747,7 @@ package body Exp_Intr is
-- Loop to output the name
- -- is this right wrt wide char encodings ??? (no!)
+ -- This is not right wrt wide char encodings ??? ()
SDef := Sloc (E);
while TDef (SDef) in '0' .. '9'
diff --git a/main/gcc/ada/exp_util.adb b/main/gcc/ada/exp_util.adb
index 52626277cb4..c77a1cb3a7b 100644
--- a/main/gcc/ada/exp_util.adb
+++ b/main/gcc/ada/exp_util.adb
@@ -1403,6 +1403,12 @@ package body Exp_Util is
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => New_Occurrence_Of (Len, Loc)))))));
+ -- Indicate that the result is an internal temporary, so it does not
+ -- receive a bogus initialization when declaration is expanded. This
+ -- is both efficient, and prevents anomalies in the handling of
+ -- dynamic objects on the secondary stack.
+
+ Set_Is_Internal (Res);
Pos := Make_Temporary (Loc, 'P');
Append_To (Decls,
@@ -4685,7 +4691,7 @@ package body Exp_Util is
-- The following code is historical, it used to be present but it
-- is too cautious, because the front-end does not know the proper
-- default alignments for the target. Also, if the alignment is
- -- not known, the front end can't know in any case! If a copy is
+ -- not known, the front end can't know in any case. If a copy is
-- needed, the back-end will take care of it. This whole section
-- including this comment can be removed later ???
@@ -6219,7 +6225,7 @@ package body Exp_Util is
end;
-- For a slice, test the prefix, if that is possibly misaligned,
- -- then for sure the slice is!
+ -- then for sure the slice is.
when N_Slice =>
return Possible_Bit_Aligned_Component (Prefix (N));
@@ -7952,7 +7958,7 @@ package body Exp_Util is
-- We need the last guard because we don't want to raise CE for empty
-- arrays since no out of range values result. (Empty arrays with a
-- component type of True .. True -- very useful -- even the ACATS
- -- does not test that marginal case!)
+ -- does not test that marginal case).
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
@@ -8003,7 +8009,7 @@ package body Exp_Util is
-- We need the last guard because we don't want to raise CE for empty
-- arrays since no out of range values result (Empty arrays with a
-- component type of True .. True -- very useful -- even the ACATS
- -- does not test that marginal case!).
+ -- does not test that marginal case).
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
@@ -8033,7 +8039,7 @@ package body Exp_Util is
Integer_Sized_Small : Ureal;
-- Set to 2.0 ** -(Integer'Size - 1) the first time that this function is
- -- called (we don't want to compute it more than once!)
+ -- called (we don't want to compute it more than once).
Long_Integer_Sized_Small : Ureal;
-- Set to 2.0 ** -(Long_Integer'Size - 1) the first time that this function
diff --git a/main/gcc/ada/expander.adb b/main/gcc/ada/expander.adb
index 869c16c899b..9f57cda26a8 100644
--- a/main/gcc/ada/expander.adb
+++ b/main/gcc/ada/expander.adb
@@ -57,7 +57,7 @@ package body Expander is
-- The following table is used to save values of the Expander_Active flag
-- when they are saved by Expander_Mode_Save_And_Set. We use an extendible
-- table (which is a bit of overkill) because it is easier than figuring
- -- out a maximum value or bothering with range checks!
+ -- out a maximum value or bothering with range checks.
package Expander_Flags is new Table.Table (
Table_Component_Type => Boolean,
@@ -132,6 +132,14 @@ package body Expander is
if GNATprove_Mode then
Expand_SPARK (N);
+ Set_Analyzed (N);
+
+ -- Regular expansion is normally followed by special handling
+ -- for transient scopes for unconstrained results, etc. but
+ -- this is not needed, and in general cannot be done correctly,
+ -- in this mode, so we are all done.
+
+ return;
-- Here for normal non-SPARK mode
diff --git a/main/gcc/ada/freeze.adb b/main/gcc/ada/freeze.adb
index 4dd7347eebc..3b5f01b9ec6 100644
--- a/main/gcc/ada/freeze.adb
+++ b/main/gcc/ada/freeze.adb
@@ -2147,11 +2147,9 @@ package body Freeze is
then
Error_Msg_Sloc := Sloc (Comp_Size_C);
Error_Msg_NE
- ("?r?pragma Pack for& ignored!",
- Pack_Pragma, Ent);
+ ("?r?pragma Pack for& ignored!", Pack_Pragma, Ent);
Error_Msg_N
- ("\?r?explicit component size given#!",
- Pack_Pragma);
+ ("\?r?explicit component size given#!", Pack_Pragma);
Set_Is_Packed (Base_Type (Ent), False);
Set_Is_Bit_Packed_Array (Base_Type (Ent), False);
end if;
@@ -3280,7 +3278,7 @@ package body Freeze is
and then RM_Size (Rec) < Scalar_Component_Total_Esize
-- And the total RM size cannot be greater than the specified size
- -- since otherwise packing will not get us where we have to be!
+ -- since otherwise packing will not get us where we have to be.
and then RM_Size (Rec) >= Scalar_Component_Total_RM_Size
@@ -3966,7 +3964,7 @@ package body Freeze is
-- However, we don't do that for internal entities. We figure
-- that if we deliberately set Is_True_Constant for an internal
- -- entity, e.g. a dispatch table entry, then we mean it!
+ -- entity, e.g. a dispatch table entry, then we mean it.
if (Is_Aliased (E) or else Is_Aliased (Etype (E)))
and then not Is_Internal_Name (Chars (E))
@@ -4091,7 +4089,7 @@ package body Freeze is
then
-- Make sure we actually have a pragma, and have not merely
-- inherited the indication from elsewhere (e.g. an address
- -- clause, which is not good enough in RM terms!)
+ -- clause, which is not good enough in RM terms).
if Has_Rep_Pragma (E, Name_Atomic)
or else
@@ -5393,7 +5391,7 @@ package body Freeze is
-- expression, see section "Handling of Default Expressions" in the
-- spec of package Sem for further details. Note that we have to make
-- sure that we actually have a real expression (if we have a subtype
- -- indication, we can't test Is_Static_Expression!) However, we exclude
+ -- indication, we can't test Is_Static_Expression). However, we exclude
-- the case of the prefix of an attribute of a static scalar subtype
-- from this early return, because static subtype attributes should
-- always cause freezing, even in default expressions, but the attribute
@@ -5740,7 +5738,7 @@ package body Freeze is
end case;
-- We fall through the case if we did not yet find the proper
- -- place in the free for inserting the freeze node, so climb!
+ -- place in the free for inserting the freeze node, so climb.
P := Parent_P;
end loop;
@@ -6532,7 +6530,7 @@ package body Freeze is
-- For non-foreign convention subprograms, this is where we create
-- the extra formals (for accessibility level and constrained bit
-- information). We delay this till the freeze point precisely so
- -- that we know the convention!
+ -- that we know the convention.
if not Has_Foreign_Convention (E) then
Create_Extra_Formals (E);
diff --git a/main/gcc/ada/frontend.adb b/main/gcc/ada/frontend.adb
index 20a92f47980..e07e0cc6c7b 100644
--- a/main/gcc/ada/frontend.adb
+++ b/main/gcc/ada/frontend.adb
@@ -226,7 +226,7 @@ begin
end loop;
end if;
- -- Restore style check, but if config file turned on checks, leave on!
+ -- Restore style check, but if config file turned on checks, leave on
Opt.Style_Check := Save_Style_Check or Style_Check;
diff --git a/main/gcc/ada/g-comlin.ads b/main/gcc/ada/g-comlin.ads
index c4b290e5567..c3bfe304b62 100644
--- a/main/gcc/ada/g-comlin.ads
+++ b/main/gcc/ada/g-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2012, AdaCore --
+-- Copyright (C) 1999-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -64,7 +64,7 @@
-- when 'b' => Put_Line ("Got b + " & Parameter);
-- when others =>
--- raise Program_Error; -- cannot occur!
+-- raise Program_Error; -- cannot occur
-- end case;
-- end loop;
diff --git a/main/gcc/ada/g-mbdira.adb b/main/gcc/ada/g-mbdira.adb
index 44937f9d6a5..3d026ab5242 100644
--- a/main/gcc/ada/g-mbdira.adb
+++ b/main/gcc/ada/g-mbdira.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -111,7 +111,7 @@ package body GNAT.MBBS_Discrete_Random is
S.X2 := Square_Mod_N (S.X2, S.Q);
Temp := S.X2 - S.X1;
- -- Following duplication is not an error, it is a loop unwinding!
+ -- Following duplication is not an error, it is a loop unwinding
if Temp < 0 then
Temp := Temp + S.Q;
diff --git a/main/gcc/ada/g-spipat.adb b/main/gcc/ada/g-spipat.adb
index b1dacd98dc1..f11bcfc997a 100644
--- a/main/gcc/ada/g-spipat.adb
+++ b/main/gcc/ada/g-spipat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2011, AdaCore --
+-- Copyright (C) 1998-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1081,7 +1081,7 @@ package body GNAT.Spitbol.Patterns is
-- control. One might be tempted to think that at this point, the
-- history stack entries made by matching P can just be removed since
-- they certainly are not going to be used for rematching (that is
- -- whole point of Fence after all!) However, this is wrong, because
+ -- whole point of Fence after all). However, this is wrong, because
-- it would result in the loss of possible assign-on-match entries
-- for deferred pattern assignments.
diff --git a/main/gcc/ada/gnat1drv.adb b/main/gcc/ada/gnat1drv.adb
index ba30b4c1d74..f5c312a678d 100644
--- a/main/gcc/ada/gnat1drv.adb
+++ b/main/gcc/ada/gnat1drv.adb
@@ -283,7 +283,7 @@ procedure Gnat1drv is
-- Make the Ada front-end more liberal so that the compiler will
-- allow illegal code that is allowed by other compilers. CodePeer
- -- is in the business of finding problems, not enforcing rules!
+ -- is in the business of finding problems, not enforcing rules.
-- This is useful when using CodePeer mode with other compilers.
Relaxed_RM_Semantics := True;
@@ -441,7 +441,7 @@ procedure Gnat1drv is
-- Deal with forcing OpenVMS switches True if debug flag M is set, but
-- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target
- -- before doing this, so we know if we are in real OpenVMS or not!
+ -- before doing this, so we know if we are in real OpenVMS or not.
Opt.True_VMS_Target := Targparm.OpenVMS_On_Target;
@@ -696,8 +696,8 @@ procedure Gnat1drv is
-- Remaining cases are packages and generic packages. Here
-- we only do the test if there are no previous errors,
-- because if there are errors, they may lead us to
- -- incorrectly believe that a package does not allow a body
- -- when in fact it does.
+ -- incorrectly believe that a package does not allow a
+ -- body when in fact it does.
elsif not Compilation_Errors then
if Main_Kind = N_Package_Declaration then
@@ -1258,7 +1258,7 @@ begin
when Storage_Error =>
-- Assume this is a bug. If it is real, the message will in any case
- -- say Storage_Error, giving a strong hint!
+ -- say Storage_Error, giving a strong hint.
Comperr.Compiler_Abort ("Storage_Error");
end;
diff --git a/main/gcc/ada/gnat_rm.texi b/main/gcc/ada/gnat_rm.texi
index 6f04498d4f9..abb00383157 100644
--- a/main/gcc/ada/gnat_rm.texi
+++ b/main/gcc/ada/gnat_rm.texi
@@ -6309,124 +6309,75 @@ pragma SPARK_Mode [(On | Off)] ;
@end smallexample
@noindent
-This pragma is used to specify whether a construct must
-satisfy the syntactic and semantic rules of the SPARK 2014 programming
-language. The pragma is intended for use with formal verification tools
-and has no effect on the generated code.
+In general a program can have some parts that are in SPARK 2014 (and
+follow all the rules in the SPARK Reference Manual), and some parts
+that are full Ada 2012.
-The SPARK_Mode pragma is used to specify the value of the SPARK_Mode aspect
-(either Off or On) of an entity.
-More precisely, it is used to specify the aspect value of a ``section''
-of an entity (the term ``section'' is defined below).
-If a Spark_Mode pragma's (optional) argument is omitted,
-an implicit argument of On is assumed.
-
-A SPARK_Mode pragma may be used as a configuration pragma and then has the
-semantics described below.
-
-A SPARK_Mode pragma can be used as a local pragma only
-in the following contexts:
+The SPARK_Mode pragma is used to identify which parts are in SPARK
+2014 (by default programs are in full Ada). The SPARK_Mode pragma can
+be used in the following places:
@itemize @bullet
@item
-When the pragma is at the start of the visible declarations (preceded only
-by other pragmas) of a package declaration, it marks the visible part
-of the package as being in or out of SPARK 2014.
+As a configuration pragma, in which case it sets the default mode for
+all units compiled with this pragma.
@item
-When the pragma appears at the start of the private declarations of a
-package (preceded only by other pragmas), it marks the private part
-of the package as being in or out of SPARK 2014.
+Immediately following a library-level subprogram spec
@item
-When the pragma appears at the start of the declarations of a
-package body (preceded only by other pragmas),
-it marks the declaration list of the package body body as being
-in or out of SPARK 2014.
+Immediately within a library-level package body
@item
-When the pragma appears at the start of the elaboration statements of
-a package body (preceded only by other pragmas),
-it marks the handled_sequence_of_statements of the package body
-as being in or out of SPARK 2014.
+Immediately following the @code{private} keyword of a library-level
+package spec
@item
-When the pragma appears after a subprogram declaration (with only other
-pragmas intervening), it marks the subprogram's specification as
-being in or out of SPARK 2014.
+Immediately following the @code{begin} keyword of a library-level
+package body
@item
-When the pragma appears at the start of the declarations of a subprogram
-body (preceded only by other pragmas), it marks the subprogram body
-as being in or out of SPARK 2014. For a subprogram body which is
-not a completion of another declaration, it also applies to the
-specification of the subprogram.
+Immediately within a library-level subprogram body
@end itemize
-A package is defined to have 4 ``sections'': its visible part, its private
-part, its body's declaration list, and its body's
-handled_sequence_of_statements. Any other construct which requires a
-completion is defined to have 2 ``sections'': its declaration and its
-completion. Any other construct is defined to have 1 section.
+@noindent
+Normally a subprogram or package spec/body inherits the current mode
+that is active at the point it is declared. But this can be overridden
+by pragma within the spec or body as above.
-The SPARK_Mode aspect value of an arbitrary section of an arbitrary Ada entity
-or construct is then defined to be the following value:
+The basic consistency rule is that you can't turn SPARK_Mode back
+@code{On}, once you have explicitly (with a pragma) turned if
+@code{Off}. So the following rules apply:
-@itemize
+@noindent
+If a subprogram spec has SPARK_Mode @code{Off}, then the body must
+also have SPARK_Mode @code{Off}.
-@item
-If SPARK_Mode has been specified for the given section of the given entity or
-construct, then the specified value;
+@noindent
+For a package, we have four parts:
+@itemize
@item
-else if SPARK_Mode has been specified for at least one preceding section of
-the same entity, then the SPARK_Mode of the immediately preceding section;
-
+the package public declarations
@item
-else for any of the visible part or body declarations of a library unit package
-or either section of a library unit subprogram, if there is an applicable
-SPARK_Mode configuration pragma then the value specified by the
-pragma; if no such configuration pragma applies, then an implicit
-specification of Off is assumed;
-
+the package private part
@item
-else for any subsequent (i.e., not the first) section of a library unit
-package, the SPARK_Mode of the preceding section;
-
+the body of the package
@item
-else the SPARK_Mode of the enclosing section of the nearest enclosing package
-or subprogram;
-
+the elaboration code after @code{begin}
@end itemize
-If the above computation does not specify a SPARK_Mode setting for any
-construct other than one of the four sections of a package, then a result of On
-or Off is determined instead based on the legality (with respect to the rules
-of SPARK 2014) of the construct. The construct's SPARK_Mode is On if and only
-if the construct is in SPARK 2014.
-
-If an earlier section of an entity has a Spark_Mode of Off, then the
-Spark_Mode aspect of any later section of that entity shall not be
-specified to be On. For example,
-if the specification of a subprogram has a Spark_Mode of Off, then the
-body of the subprogram shall not have a Spark_Mode of On.
-
-The following rules apply to SPARK code (i.e., constructs which
-have a SPARK_Mode aspect value of On):
-
-@itemize
-
-@item
-SPARK code shall only reference SPARK declarations, but a SPARK declaration
-which requires a completion may have a non-SPARK completion.
-
-@item
-SPARK code shall only enclose SPARK code, except that SPARK code may enclose
-a non-SPARK completion of an enclosed SPARK declaration.
-
-@end itemize
+@noindent
+For a package, the rule is that if you explicitly turn SPARK_Mode
+@code{Off} for any part, then all the following parts must have
+SPARK_Mode @code{Off}. Note that this may require repeating a pragma
+SPARK_Mode (@code{Off}) in the body. For example, if we have a
+configuration pragma SPARK_Mode (@code{On}) that turns the mode on by
+default everywhere, and one particular package spec has pragma
+SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
+the package body.
@node Pragma Static_Elaboration_Desired
@unnumberedsec Pragma Static_Elaboration_Desired
diff --git a/main/gcc/ada/gnat_ugn.texi b/main/gcc/ada/gnat_ugn.texi
index 17983ef9d64..c5632d78449 100644
--- a/main/gcc/ada/gnat_ugn.texi
+++ b/main/gcc/ada/gnat_ugn.texi
@@ -10176,6 +10176,7 @@ some guidelines on debugging optimized code.
* Other Optimization Switches::
* Optimization and Strict Aliasing::
* Aliased Variables and Optimization::
+* Atomic Variables and Optimization::
* Passive Task Optimization::
@ifset vms
@@ -11022,6 +11023,80 @@ inhibits optimizations that assume the value cannot be assigned.
This means that the above example will in fact "work" reliably,
that is, it will produce the expected results.
+@node Atomic Variables and Optimization
+@subsection Atomic Variables and Optimization
+@cindex Atomic
+There are two considerations with regard to performance when
+atomic variables are used.
+
+First, the RM only guarantees that access to atomic variables
+be atomic, it has nothing to say about how this is achieved,
+though there is a strong implication that this should not be
+achieved by explicit locking code. Indeed GNAT will never
+generate any locking code for atomic variable access (it will
+simply reject any attempt to make a variable or type atomic
+if the atomic access cannot be achieved without such locking code).
+
+That being said, it is important to understand that you cannot
+assume that the entire variable will always be accessed. Consider
+this example:
+
+@smallexample @c ada
+type R is record
+ A,B,C,D : Character;
+end record;
+for R'Size use 32;
+for R'Alignment use 4;
+
+RV : R;
+pragma Atomic (RV);
+X : Character;
+...
+X := RV.B;
+@end smallexample
+
+@noindent
+You cannot assume that the reference to @code{RV.B}
+will read the entire 32-bit
+variable with a single load instruction. It is perfectly legitimate if
+the hardware allows it to do a byte read of just the B field. This read
+is still atomic, which is all the RM requires. GNAT can and does take
+advantage of this, depending on the architecture and optimization level.
+Any assumption to the contrary is non-portable and risky. Even if you
+examine the assembly language and see a full 32-bit load, this might
+change in a future version of the compiler.
+
+If your application requires that all accesses to @code{RV} in this
+example be full 32-bit loads, you need to make a copy for the access
+as in:
+
+@smallexample @c ada
+declare
+ RV_Copy : constant R := RV;
+begin
+ X := RV_Copy.B;
+end;
+@end smallexample
+
+
+@noindent
+Now the reference to RV must read the whole variable.
+Actually one can imagine some compiler which figures
+out that the whole copy is not required (because only
+the B field is actually accessed), but GNAT
+certainly won't do that, and we don't know of any
+compiler that would not handle this right, and the
+above code will in practice work portably across
+all architectures (that permit the Atomic declaration).
+
+The second issue with atomic variables has to do with
+the possible requirement of generating synchronization
+code. For more details on this, consult the sections on
+the pragmas Enable/Disable_Atomic_Synchronization in the
+GNAT Reference Manual. If performance is critical, and
+such synchronization code is not required, it may be
+useful to disable it.
+
@node Passive Task Optimization
@subsection Passive Task Optimization
@cindex Passive Task
diff --git a/main/gcc/ada/gnatcmd.adb b/main/gcc/ada/gnatcmd.adb
index d879cb7813a..1bca7d80f46 100644
--- a/main/gcc/ada/gnatcmd.adb
+++ b/main/gcc/ada/gnatcmd.adb
@@ -1939,6 +1939,12 @@ begin
if Project = Prj.No_Project then
Fail ("""" & Project_File.all & """ processing failed");
+
+ elsif Project.Qualifier = Aggregate then
+ Fail ("aggregate projects are not supported");
+
+ elsif Aggregate_Libraries_In (Project_Tree) then
+ Fail ("aggregate library projects are not supported");
end if;
-- Check if a package with the name of the tool is in the project
diff --git a/main/gcc/ada/gnatlink.adb b/main/gcc/ada/gnatlink.adb
index ea679d9d25c..ce8f3d18b65 100644
--- a/main/gcc/ada/gnatlink.adb
+++ b/main/gcc/ada/gnatlink.adb
@@ -1598,7 +1598,7 @@ begin
-- Read it. Note that we ignore errors, since we only want very
-- limited information from the ali file, and likely a slightly
-- wrong version will be just fine, though in normal operation
- -- we don't expect this to happen!
+ -- we don't expect this to happen.
A := Scan_ALI
(F,
diff --git a/main/gcc/ada/gprep.adb b/main/gcc/ada/gprep.adb
index 8eb1465bff4..54d2c8e92e8 100644
--- a/main/gcc/ada/gprep.adb
+++ b/main/gcc/ada/gprep.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -165,7 +165,7 @@ package body GPrep is
procedure Gnatprep is
begin
- -- Do some initializations (order is important here!)
+ -- Do some initializations (order is important here)
Csets.Initialize;
Snames.Initialize;
diff --git a/main/gcc/ada/i-cpp.ads b/main/gcc/ada/i-cpp.ads
index 0435c135f62..27db1c2b1fd 100644
--- a/main/gcc/ada/i-cpp.ads
+++ b/main/gcc/ada/i-cpp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,7 +39,7 @@ package Interfaces.CPP is
subtype Vtable_Ptr is Ada.Tags.Tag;
- -- These need commenting (this is not an RM package!)
+ -- These need commenting (this is not an RM package) ???
function Expanded_Name (T : Vtable_Ptr) return String
renames Ada.Tags.Expanded_Name;
diff --git a/main/gcc/ada/i-vxwork-x86.ads b/main/gcc/ada/i-vxwork-x86.ads
index 479b6ad0787..549c3c7badb 100644
--- a/main/gcc/ada/i-vxwork-x86.ads
+++ b/main/gcc/ada/i-vxwork-x86.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2010, AdaCore --
+-- Copyright (C) 1999-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -85,9 +85,10 @@ package Interfaces.VxWorks is
--
-- with P; use P;
-- procedure Useint is
- -- -- Be sure to use a reasonable interrupt number for the target
- -- -- board!
+ --
+ -- -- Be sure to use a reasonable interrupt number for target board.
-- -- This one is an unreserved interrupt for the Pentium 3 BSP
+ --
-- Interrupt : constant := 16#33#;
--
-- task T;
@@ -101,6 +102,7 @@ package Interfaces.VxWorks is
-- delay 1.0;
--
-- -- Generate interrupt, using interrupt number
+ --
-- Asm ("int %0",
-- Inputs =>
-- Ada.Interrupts.Interrupt_ID'Asm_Input
@@ -134,32 +136,32 @@ package Interfaces.VxWorks is
(vector : Interrupt_Vector;
handler : VOIDFUNCPTR;
parameter : System.Address := System.Null_Address) return STATUS;
- -- Binding to the C routine intConnect. Use this to set up an
- -- user handler. The routine generates a wrapper around the user
- -- handler to save and restore context
+ -- Binding to the C routine intConnect. Use this to set up an user handler.
+ -- The routine generates a wrapper around the user handler to save and
+ -- restore context
function intContext return int;
- -- Binding to the C routine intContext. This function returns 1 only
- -- if the current execution state is in interrupt context.
+ -- Binding to the C routine intContext. This function returns 1 only if the
+ -- current execution state is in interrupt context.
function intVecGet
(Vector : Interrupt_Vector) return VOIDFUNCPTR;
- -- Binding to the C routine intVecGet. Use this to get the
- -- existing handler for later restoral
+ -- Binding to the C routine intVecGet. Use this to get the existing handler
+ -- for later restoral
procedure intVecSet
(Vector : Interrupt_Vector;
Handler : VOIDFUNCPTR);
- -- Binding to the C routine intVecSet. Use this to restore a
- -- handler obtained using intVecGet
+ -- Binding to the C routine intVecSet. Use this to restore a handler
+ -- obtained using intVecGet
procedure intVecGet2
(vector : Interrupt_Vector;
pFunction : out VOIDFUNCPTR;
pIdtGate : not null access int;
pIdtSelector : not null access int);
- -- Binding to the C routine intVecGet2. Use this to get the
- -- existing handler for later restoral
+ -- Binding to the C routine intVecGet2. Use this to get the existing
+ -- handler for later restoral
procedure intVecSet2
(vector : Interrupt_Vector;
@@ -180,12 +182,11 @@ package Interfaces.VxWorks is
-- (e.g logMsg ("Interrupt" & ASCII.NUL))
type FP_CONTEXT is private;
- -- Floating point context save and restore. Handlers using floating
- -- point must be bracketed with these calls. The pFpContext parameter
- -- should be an object of type FP_CONTEXT that is
- -- declared local to the handler.
- -- See the VxWorks Intel Architecture Supplement regarding
- -- these routines.
+ -- Floating point context save and restore. Handlers using floating point
+ -- must be bracketed with these calls. The pFpContext parameter should be
+ -- an object of type FP_CONTEXT that is declared local to the handler.
+ --
+ -- See the VxWorks Intel Architecture Supplement regarding these routines
procedure fppRestore (pFpContext : in out FP_CONTEXT);
-- Restore floating point context - old style
diff --git a/main/gcc/ada/i-vxwork.ads b/main/gcc/ada/i-vxwork.ads
index 0b2991e8122..81c42993730 100644
--- a/main/gcc/ada/i-vxwork.ads
+++ b/main/gcc/ada/i-vxwork.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2010, AdaCore --
+-- Copyright (C) 1999-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,15 +30,16 @@
------------------------------------------------------------------------------
-- This package provides a limited binding to the VxWorks API
+
-- In particular, it interfaces with the VxWorks hardware interrupt
--- facilities, allowing the use of low-latency direct-vectored
--- interrupt handlers. Note that such handlers have a variety of
--- restrictions regarding system calls and language constructs. In particular,
--- the use of exception handlers and functions returning variable-length
--- objects cannot be used. Less restrictive, but higher-latency handlers can
--- be written using Ada protected procedures, Ada 83 style interrupt entries,
--- or by signalling an Ada task from within an interrupt handler using a
--- binary semaphore as described in the VxWorks Programmer's Manual.
+-- facilities, allowing the use of low-latency direct-vectored interrupt
+-- handlers. Note that such handlers have a variety of restrictions regarding
+-- system calls and language constructs. In particular, the use of exception
+-- handlers and functions returning variable-length objects cannot be used.
+-- Less restrictive, but higher-latency handlers can be written using Ada
+-- protected procedures, Ada 83 style interrupt entries, or by signalling
+-- an Ada task from within an interrupt handler using a binary semaphore
+-- as described in the VxWorks Programmer's Manual.
--
-- For complete documentation of the operations in this package, please
-- consult the VxWorks Programmer's Manual and VxWorks Reference Manual.
@@ -81,6 +82,7 @@ package Interfaces.VxWorks is
-- logMsg ("received an interrupt" & ASCII.LF & ASCII.NUL);
--
-- -- Acknowledge VME interrupt
+ --
-- S := sysBusIntAck (intLevel => Level);
-- end Handler;
-- end P;
@@ -90,9 +92,10 @@ package Interfaces.VxWorks is
--
-- with P; use P;
-- procedure Useint is
- -- -- Be sure to use a reasonable interrupt number for the target
- -- -- board!
+ --
+ -- -- Be sure to use a reasonable interrupt number for board.
-- -- This one is the unused VME graphics interrupt on the PPC MV2604
+ --
-- Interrupt : constant := 16#14#;
--
-- task T;
@@ -106,6 +109,7 @@ package Interfaces.VxWorks is
-- delay 1.0;
--
-- -- Generate VME interrupt, using interrupt number
+ --
-- S := sysBusIntGen (1, Interrupt);
-- end loop;
-- end T;
@@ -137,24 +141,24 @@ package Interfaces.VxWorks is
(vector : Interrupt_Vector;
handler : VOIDFUNCPTR;
parameter : System.Address := System.Null_Address) return STATUS;
- -- Binding to the C routine intConnect. Use this to set up an
- -- user handler. The routine generates a wrapper around the user
- -- handler to save and restore context
+ -- Binding to the C routine intConnect. Use this to set up an user handler.
+ -- The routine generates a wrapper around the user handler to save and
+ -- restore context
function intContext return int;
- -- Binding to the C routine intContext. This function returns 1 only
- -- if the current execution state is in interrupt context.
+ -- Binding to the C routine intContext. This function returns 1 only if the
+ -- current execution state is in interrupt context.
function intVecGet
(Vector : Interrupt_Vector) return VOIDFUNCPTR;
- -- Binding to the C routine intVecGet. Use this to get the
- -- existing handler for later restoral
+ -- Binding to the C routine intVecGet. Use this to get the existing handler
+ -- for later restoral
procedure intVecSet
(Vector : Interrupt_Vector;
Handler : VOIDFUNCPTR);
- -- Binding to the C routine intVecSet. Use this to restore a
- -- handler obtained using intVecGet
+ -- Binding to the C routine intVecSet. Use this to restore a handler
+ -- obtained using intVecGet
function INUM_TO_IVEC (intNum : int) return Interrupt_Vector;
-- Equivalent to the C macro INUM_TO_IVEC used to convert an interrupt
@@ -170,10 +174,10 @@ package Interfaces.VxWorks is
-- Binding to the C routine sysBusIntAck
function sysBusIntGen (intLevel : int; Intnum : int) return STATUS;
- -- Binding to the C routine sysBusIntGen. Note that the T2
- -- documentation implies that a vector address is the proper
- -- argument - it's not. The interrupt number in the range
- -- 0 .. 255 (for 68K and PPC) is the correct argument.
+ -- Binding to the C routine sysBusIntGen. Note that the T2 documentation
+ -- implies that a vector address is the proper argument - it's not. The
+ -- interrupt number in the range 0 .. 255 (for 68K and PPC) is the correct
+ -- argument.
procedure logMsg
(fmt : String; arg1, arg2, arg3, arg4, arg5, arg6 : int := 0);
@@ -182,10 +186,9 @@ package Interfaces.VxWorks is
-- (e.g logMsg ("Interrupt" & ASCII.NUL))
type FP_CONTEXT is private;
- -- Floating point context save and restore. Handlers using floating
- -- point must be bracketed with these calls. The pFpContext parameter
- -- should be an object of type FP_CONTEXT that is
- -- declared local to the handler.
+ -- Floating point context save and restore. Handlers using floating point
+ -- must be bracketed with these calls. The pFpContext parameter should be
+ -- an object of type FP_CONTEXT that is declared local to the handler.
procedure fppRestore (pFpContext : in out FP_CONTEXT);
-- Restore floating point context
diff --git a/main/gcc/ada/inline.ads b/main/gcc/ada/inline.ads
index 825b958f1ef..651a7484c2e 100644
--- a/main/gcc/ada/inline.ads
+++ b/main/gcc/ada/inline.ads
@@ -96,6 +96,11 @@ package Inline is
Warnings : Warning_Record;
-- Capture values of warning flags
+
+ SPARK_Mode : SPARK_Mode_Type;
+ SPARK_Mode_Pragma : Node_Id;
+ -- SPARK_Mode for an instance is the one applicable at the point of
+ -- instantiation. SPARK_Mode_Pragma is the related active pragma.
end record;
package Pending_Instantiations is new Table.Table (
diff --git a/main/gcc/ada/krunch.ads b/main/gcc/ada/krunch.ads
index 95a0218e634..2a6d9681ed4 100644
--- a/main/gcc/ada/krunch.ads
+++ b/main/gcc/ada/krunch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -114,7 +114,7 @@
-- we replace the prefix ada.wide_wide_text_io- by a-zt- and then
-- the normal crunching rules are applied.
--- These are the only irregularity required (so far!) to keep the file names
+-- These are the only irregularity required (so far) to keep the file names
-- unique in the standard predefined libraries.
procedure Krunch
diff --git a/main/gcc/ada/layout.adb b/main/gcc/ada/layout.adb
index ff49104e066..75957c53fc1 100644
--- a/main/gcc/ada/layout.adb
+++ b/main/gcc/ada/layout.adb
@@ -751,7 +751,7 @@ package body Layout is
then
S := Expr_Value (Hi) - Expr_Value (Lo) + 1;
- -- If known flat bound, entire size of array is zero!
+ -- If known flat bound, entire size of array is zero
if S <= 0 then
return Make_Integer_Literal (Loc, 0);
@@ -1088,7 +1088,7 @@ package body Layout is
then
S := Expr_Value (Hi) - Expr_Value (Lo) + 1;
- -- If known flat bound, entire size of array is zero!
+ -- If known flat bound, entire size of array is zero
if S <= 0 then
Set_Esize (E, Uint_0);
@@ -1688,7 +1688,7 @@ package body Layout is
-- Set size of component from type. We use the Esize except in a
-- packed record, where we use the RM_Size (since that is what the
- -- RM_Size value, as distinct from the Object_Size is useful for!)
+ -- RM_Size value, as distinct from the Object_Size is useful for).
if Is_Packed (E) then
Set_Esize (Comp, RM_Size (Ctyp));
@@ -1771,7 +1771,7 @@ package body Layout is
End_NPMax : SO_Ref;
begin
- -- Only lay out components if there are some to lay out!
+ -- Only lay out components if there are some to lay out
if Present (From) then
@@ -2508,7 +2508,7 @@ package body Layout is
-- since this is part of the earlier processing and the front end is
-- always required to lay out the sizes of such types (since they are
-- available as static attributes). All we do is to check that this
- -- rule is indeed obeyed!
+ -- rule is indeed obeyed.
if Is_Discrete_Type (E) then
diff --git a/main/gcc/ada/lib-load.adb b/main/gcc/ada/lib-load.adb
index 6d65c81383c..540bd63043c 100644
--- a/main/gcc/ada/lib-load.adb
+++ b/main/gcc/ada/lib-load.adb
@@ -740,7 +740,7 @@ package body Lib.Load is
goto Done;
end if;
- -- If loaded unit had a fatal error, then caller inherits it!
+ -- If loaded unit had a fatal error, then caller inherits it
if Units.Table (Unum).Fatal_Error
and then Present (Error_Node)
diff --git a/main/gcc/ada/lib-writ.adb b/main/gcc/ada/lib-writ.adb
index 015c628b87b..48adf70c97a 100644
--- a/main/gcc/ada/lib-writ.adb
+++ b/main/gcc/ada/lib-writ.adb
@@ -1496,7 +1496,7 @@ package body Lib.Writ is
end if;
-- Output final blank line and we are done. This final blank line is
- -- probably junk, but we don't feel like making an incompatible change!
+ -- probably junk, but we don't feel like making an incompatible change.
Write_Info_Terminate;
Close_Output_Library_Info;
diff --git a/main/gcc/ada/lib-writ.ads b/main/gcc/ada/lib-writ.ads
index f886b668ce0..cfcc01c6dfa 100644
--- a/main/gcc/ada/lib-writ.ads
+++ b/main/gcc/ada/lib-writ.ads
@@ -260,7 +260,7 @@ package Lib.Writ is
-- Note: The P line must be present. Even in Ignore_Errors mode, Scan_ALI
-- insists on finding a P line. So if changes are made to the ALI format,
- -- they should not include removing the P line!
+ -- they should not include removing the P line.
-- ---------------------
-- -- R Restrictions --
diff --git a/main/gcc/ada/live.adb b/main/gcc/ada/live.adb
index b0c616f961e..5366b513d6c 100644
--- a/main/gcc/ada/live.adb
+++ b/main/gcc/ada/live.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -84,7 +84,7 @@ package body Live is
-- Given a subprogram body N, return defining identifier of its declaration
-- ??? the body of this package contains no comments at all, this
- -- should be fixed!
+ -- should be fixed.
-------------
-- Body_Of --
diff --git a/main/gcc/ada/make.adb b/main/gcc/ada/make.adb
index c8c605313e1..5078f0e1163 100644
--- a/main/gcc/ada/make.adb
+++ b/main/gcc/ada/make.adb
@@ -6617,6 +6617,13 @@ package body Make is
("""" & Project_File_Name.all & """ processing failed");
end if;
+ if Main_Project.Qualifier = Aggregate then
+ Make_Failed ("aggregate projects are not supported");
+
+ elsif Aggregate_Libraries_In (Project_Tree) then
+ Make_Failed ("aggregate library projects are not supported");
+ end if;
+
Create_Mapping_File := True;
if Verbose_Mode then
diff --git a/main/gcc/ada/makeutl.adb b/main/gcc/ada/makeutl.adb
index 4a8f8a8758d..a220cbec0e2 100644
--- a/main/gcc/ada/makeutl.adb
+++ b/main/gcc/ada/makeutl.adb
@@ -171,6 +171,26 @@ package body Makeutl is
end;
end Absolute_Path;
+ ----------------------------
+ -- Aggregate_Libraries_In --
+ ----------------------------
+
+ function Aggregate_Libraries_In (Tree : Project_Tree_Ref) return Boolean is
+ List : Project_List;
+
+ begin
+ List := Tree.Projects;
+ while List /= null loop
+ if List.Project.Qualifier = Aggregate_Library then
+ return True;
+ end if;
+
+ List := List.Next;
+ end loop;
+
+ return False;
+ end Aggregate_Libraries_In;
+
-------------------------
-- Base_Name_Index_For --
-------------------------
@@ -1654,9 +1674,11 @@ package body Makeutl is
end if;
end if;
- elsif Source.Kind = Spec then
- -- A spec needs to be taken into account unless there is
- -- also a body. So we delay the decision for them.
+ elsif Source.Kind = Spec
+ and then Source.Language.Config.Kind = Unit_Based
+ then
+ -- An Ada spec needs to be taken into account unless there
+ -- is also a body. So we delay the decision for them.
Get_Name_String (Source.File);
@@ -1785,7 +1807,7 @@ package body Makeutl is
if Source = No_Source then
Source := Find_File_Add_Extension
- (Tree, Get_Name_String (Main_Id));
+ (File.Tree, Get_Name_String (Main_Id));
end if;
if Is_Absolute
@@ -1852,10 +1874,10 @@ package body Makeutl is
-- reported later.
Error_Msg_File_1 := Main_Id;
- Error_Msg_Name_1 := Root_Project.Name;
+ Error_Msg_Name_1 := File.Project.Name;
Prj.Err.Error_Msg
(Flags, "{ is not a source of project %%",
- File.Location, Project);
+ File.Location, File.Project);
end if;
end if;
end;
diff --git a/main/gcc/ada/makeutl.ads b/main/gcc/ada/makeutl.ads
index e5f430440ec..88c9c988cbe 100644
--- a/main/gcc/ada/makeutl.ads
+++ b/main/gcc/ada/makeutl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -216,6 +216,10 @@ package Makeutl is
-- The source directories of imported projects are only included if one
-- of the declared languages is in the list Languages.
+ function Aggregate_Libraries_In (Tree : Project_Tree_Ref) return Boolean;
+ -- Return True iff there is one or more aggregate library projects in
+ -- the project tree Tree.
+
procedure Write_Path_File (FD : File_Descriptor);
-- Write in the specified open path file the directories in table
-- Directories, then closed the path file.
diff --git a/main/gcc/ada/namet.ads b/main/gcc/ada/namet.ads
index 4c9fc77bf78..431204b6a77 100644
--- a/main/gcc/ada/namet.ads
+++ b/main/gcc/ada/namet.ads
@@ -128,7 +128,7 @@ package Namet is
-- This buffer is used to set the name to be stored in the table for the
-- Name_Find call, and to retrieve the name for the Get_Name_String call.
-- The limit here is intended to be an infinite value that ensures that we
- -- never overflow the buffer (names this long are too absurd to worry!)
+ -- never overflow the buffer (names this long are too absurd to worry).
Name_Len : Natural := 0;
-- Length of name stored in Name_Buffer. Used as an input parameter for
diff --git a/main/gcc/ada/osint-c.adb b/main/gcc/ada/osint-c.adb
index d4333269477..72395f84c6b 100644
--- a/main/gcc/ada/osint-c.adb
+++ b/main/gcc/ada/osint-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -225,7 +225,7 @@ package body Osint.C is
function Debug_File_Eol_Length return Nat is
begin
- -- There has to be a cleaner way to do this! ???
+ -- There has to be a cleaner way to do this ???
if Directory_Separator = '/' then
return 1;
diff --git a/main/gcc/ada/osint.adb b/main/gcc/ada/osint.adb
index aefffc3ed59..b9b03d45f6d 100644
--- a/main/gcc/ada/osint.adb
+++ b/main/gcc/ada/osint.adb
@@ -2430,7 +2430,8 @@ package body Osint is
Len : Integer;
-- Length of source file text (ALI). If it doesn't fit in an integer
- -- we're probably stuck anyway (>2 gigs of source seems a lot!)
+ -- we're probably stuck anyway (>2 gigs of source seems a lot, and
+ -- there are other places in the compiler that make this assumption).
Text : Text_Buffer_Ptr;
-- Allocated text buffer
@@ -2585,7 +2586,7 @@ package body Osint is
-- indicates failure to open the specified source file.
Len : Integer;
- -- Length of file. Assume no more than 2 gigabytes of source!
+ -- Length of file, assume no more than 2 gigabytes of source
Actual_Len : Integer;
diff --git a/main/gcc/ada/output.ads b/main/gcc/ada/output.ads
index ddc395448d3..bcbca57328d 100644
--- a/main/gcc/ada/output.ads
+++ b/main/gcc/ada/output.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -168,7 +168,7 @@ package Output is
-- The following procedures are intended only for debugging purposes,
-- for temporary insertion into the text in environments where a debugger
-- is not available. They all have non-standard very short lower case
- -- names, precisely to make sure that they are only used for debugging!
+ -- names, precisely to make sure that they are only used for debugging.
procedure w (C : Character);
-- Dump quote, character, quote, followed by line return
diff --git a/main/gcc/ada/par-ch10.adb b/main/gcc/ada/par-ch10.adb
index 00b294b1edd..2cb424102a7 100644
--- a/main/gcc/ada/par-ch10.adb
+++ b/main/gcc/ada/par-ch10.adb
@@ -514,7 +514,7 @@ package body Ch10 is
return Error;
end if;
- -- Only try this if we got an OK unit!
+ -- Only try this if we got an OK unit
if Unit_Node /= Error then
if Nkind (Unit_Node) = N_Subunit then
@@ -577,7 +577,7 @@ package body Ch10 is
Set_Sloc (Comp_Unit_Node, Sloc (Name_Node));
Set_Sloc (Aux_Decls_Node (Comp_Unit_Node), Sloc (Name_Node));
- -- Set Entity field in file table. Easier now that we have name!
+ -- Set Entity field in file table. Easier now that we have name.
-- Note that this is also skipped if we had a bad unit
if Nkind (Name_Node) = N_Defining_Program_Unit_Name then
@@ -601,7 +601,7 @@ package body Ch10 is
-- Clear away any missing semicolon indication, we are done with that
-- unit, so what's done is done, and we don't want anything hanging
- -- around from the attempt to parse it!
+ -- around from the attempt to parse it.
SIS_Entry_Active := False;
diff --git a/main/gcc/ada/par-ch13.adb b/main/gcc/ada/par-ch13.adb
index 18c63a3bf6c..4c661a5a5f7 100644
--- a/main/gcc/ada/par-ch13.adb
+++ b/main/gcc/ada/par-ch13.adb
@@ -454,7 +454,7 @@ package body Ch13 is
Scan; -- past FOR
-- Note that the name in a representation clause is always a simple
- -- name, even in the attribute case, see AI-300 which made this so!
+ -- name, even in the attribute case, see AI-300 which made this so.
Identifier_Node := P_Identifier (C_Use);
diff --git a/main/gcc/ada/par-ch3.adb b/main/gcc/ada/par-ch3.adb
index 29126152d43..c09a68fbb2f 100644
--- a/main/gcc/ada/par-ch3.adb
+++ b/main/gcc/ada/par-ch3.adb
@@ -701,7 +701,7 @@ package body Ch3 is
else
Decl_Node := New_Node (N_Private_Type_Declaration, Type_Loc);
Set_Limited_Present (Decl_Node, True);
- T_Private; -- past PRIVATE (or complain if not there!)
+ T_Private; -- past PRIVATE (or complain if not there)
end if;
exit;
@@ -4506,7 +4506,7 @@ package body Ch3 is
Scan; -- past PRIVATE
end if;
- -- An end of file definitely terminates the declarations!
+ -- An end of file definitely terminates the declarations
when Tok_EOF =>
Done := True;
@@ -4730,7 +4730,7 @@ package body Ch3 is
-- declaration sequence on a second error, we scan out the statement
-- and append it to the list of declarations (note that the semantics
-- can handle statements in a declaration list so if we proceed to
- -- call the semantic phase, all will be (reasonably) well!
+ -- call the semantic phase, all will be (reasonably) well.
Append_List_To (Decls, P_Sequence_Of_Statements (SS_Unco));
diff --git a/main/gcc/ada/par-ch4.adb b/main/gcc/ada/par-ch4.adb
index 4003d96812a..8dd49f3166c 100644
--- a/main/gcc/ada/par-ch4.adb
+++ b/main/gcc/ada/par-ch4.adb
@@ -1512,7 +1512,7 @@ package body Ch4 is
-- If we are at an expression terminator, something is seriously
-- wrong, so let's get out now, before we start eating up stuff
- -- that doesn't belong to us!
+ -- that doesn't belong to us.
if Token in Token_Class_Eterm then
Error_Msg_AP
@@ -1992,7 +1992,7 @@ package body Ch4 is
-- If range attribute, then we return with Token pointing to the
-- apostrophe. Note: avoid the normal error check on exit. We
- -- know that the expression really is complete in this case!
+ -- know that the expression really is complete in this case.
else -- Token = Tok_Range then
Restore_Scan_State (Scan_State); -- to apostrophe
@@ -2634,7 +2634,7 @@ package body Ch4 is
end if;
-- Minus may well be an improper attempt at a unary minus. Give
- -- a message, skip the minus and keep going!
+ -- a message, skip the minus and keep going.
when Tok_Minus =>
Error_Msg_SC ("parentheses required for unary minus");
@@ -2893,7 +2893,7 @@ package body Ch4 is
-- Parsed by P_Factor (4.4)
- -- Note: this rule is not in fact used by the grammar at any point!
+ -- Note: this rule is not in fact used by the grammar at any point
--------------------------
-- 4.6 Type Conversion --
diff --git a/main/gcc/ada/par-ch5.adb b/main/gcc/ada/par-ch5.adb
index 779acc34ae9..2f83c3bc1e3 100644
--- a/main/gcc/ada/par-ch5.adb
+++ b/main/gcc/ada/par-ch5.adb
@@ -447,7 +447,7 @@ package body Ch5 is
-- Otherwise we treat THEN as some kind of mess where we did
-- not see the associated IF, but we pick up assuming it had
- -- been there!
+ -- been there.
Restore_Scan_State (Scan_State); -- to THEN
Append_To (Statement_List, P_If_Statement);
@@ -570,7 +570,7 @@ package body Ch5 is
-- We will set Error_name as the Block_Label since
-- we really don't know which of the labels might
- -- be used at the end of the loop or block!
+ -- be used at the end of the loop or block.
Block_Label := Error_Name;
diff --git a/main/gcc/ada/par-ch6.adb b/main/gcc/ada/par-ch6.adb
index 560cf4c989c..b8391e53145 100644
--- a/main/gcc/ada/par-ch6.adb
+++ b/main/gcc/ada/par-ch6.adb
@@ -1146,7 +1146,7 @@ package body Ch6 is
-- On exit from the loop, Ident_Node is the last identifier scanned,
-- i.e. the defining identifier, and Prefix_Node is a node for the
- -- entire name, structured (incorrectly!) as a selected component.
+ -- entire name, structured (incorrectly) as a selected component.
Name_Node := Prefix (Prefix_Node);
Change_Node (Prefix_Node, N_Designator);
@@ -1252,7 +1252,7 @@ package body Ch6 is
-- On exit from the loop, Ident_Node is the last identifier scanned,
-- i.e. the defining identifier, and Prefix_Node is a node for the
- -- entire name, structured (incorrectly!) as a selected component.
+ -- entire name, structured (incorrectly) as a selected component.
Name_Node := Prefix (Prefix_Node);
Change_Node (Prefix_Node, N_Defining_Program_Unit_Name);
@@ -1399,7 +1399,7 @@ package body Ch6 is
-- If we run into a semicolon, then assume that a
-- colon was missing, e.g. Parms (X Y; ...). Also
- -- assume missing colon on EOF (a real disaster!)
+ -- assume missing colon on EOF (a real disaster)
-- and on a right paren, e.g. Parms (X Y), and also
-- on an assignment symbol, e.g. Parms (X Y := ..)
diff --git a/main/gcc/ada/par-ch9.adb b/main/gcc/ada/par-ch9.adb
index e1692c4a11b..7e4a9ee4e39 100644
--- a/main/gcc/ada/par-ch9.adb
+++ b/main/gcc/ada/par-ch9.adb
@@ -267,7 +267,7 @@ package body Ch9 is
-- regard the semicolon after end as part of the Task_Definition, and in
-- the official syntax, it's part of the enclosing declaration. The reason
-- for this deviation is that otherwise the end processing would have to
- -- be special cased, which would be a nuisance!
+ -- be special cased, which would be a nuisance.
-- Error recovery: cannot raise Error_Resync
@@ -1036,7 +1036,7 @@ package body Ch9 is
else
Restore_Scan_State (Scan_State); -- to left paren
- Scan; -- past left paren (again!)
+ Scan; -- past left paren (again)
Set_Entry_Index (Accept_Node, P_Expression);
T_Right_Paren;
Set_Parameter_Specifications (Accept_Node, P_Parameter_Profile);
@@ -1280,7 +1280,7 @@ package body Ch9 is
Scan; -- past DELAY
-- The following check for delay until misused in Ada 83 doesn't catch
- -- all cases, but it's good enough to catch most of them!
+ -- all cases, but it's good enough to catch most of them.
if Token_Name = Name_Until then
Check_95_Keyword (Tok_Until, Tok_Left_Paren);
diff --git a/main/gcc/ada/par-endh.adb b/main/gcc/ada/par-endh.adb
index e41e7a31ba4..d22cce2a534 100644
--- a/main/gcc/ada/par-endh.adb
+++ b/main/gcc/ada/par-endh.adb
@@ -700,7 +700,7 @@ package body Endh is
-- Extra statements past the bogus END are discarded. This is not
-- ideal for maximum error recovery, but it's too much trouble to
- -- find an appropriate place to put them!
+ -- find an appropriate place to put them.
Discard_Junk_List (P_Sequence_Of_Statements (SS_None));
end loop;
@@ -973,7 +973,7 @@ package body Endh is
-- The other possibility is a missing END for a subprogram with a
-- suspicious IS (that probably should have been a semicolon). The
- -- missing IS confirms the suspicion!
+ -- missing IS confirms the suspicion.
else -- End_Type = E_Suspicious_Is or E_Bad_Is
Scope.Table (Scope.Last).Etyp := E_Bad_Is;
diff --git a/main/gcc/ada/par-labl.adb b/main/gcc/ada/par-labl.adb
index f709dd088ee..8b2cb5eccba 100644
--- a/main/gcc/ada/par-labl.adb
+++ b/main/gcc/ada/par-labl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -407,7 +407,7 @@ procedure Labl is
-- Intervening label before possible end of loop. Current
-- label is not a candidate. This is conservative, because
-- the label might not be the target of any jumps, but not
- -- worth dealing with useless labels!
+ -- worth dealing with useless labels.
No_Header (N);
return;
diff --git a/main/gcc/ada/par-prag.adb b/main/gcc/ada/par-prag.adb
index 0d70800973e..2061eb9e0f3 100644
--- a/main/gcc/ada/par-prag.adb
+++ b/main/gcc/ada/par-prag.adb
@@ -407,7 +407,7 @@ begin
-- We unconditionally make a List_On entry for the pragma, so that
-- in the List (Off) case, the pragma will print even in a region
- -- of code with listing turned off (this is required!)
+ -- of code with listing turned off (this is required).
List_Pragmas.Increment_Last;
List_Pragmas.Table (List_Pragmas.Last) :=
@@ -1236,6 +1236,7 @@ begin
Pragma_Overflow_Mode |
Pragma_Overriding_Renamings |
Pragma_Pack |
+ Pragma_Part_Of |
Pragma_Partition_Elaboration_Policy |
Pragma_Passive |
Pragma_Preelaborable_Initialization |
diff --git a/main/gcc/ada/par-sync.adb b/main/gcc/ada/par-sync.adb
index cbf1d1ef01e..0cf73db55a4 100644
--- a/main/gcc/ada/par-sync.adb
+++ b/main/gcc/ada/par-sync.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,7 +41,7 @@ package body Sync is
Resync_Init;
-- Loop till we get a token that terminates a choice. Note that EOF is
- -- one such token, so we are sure to get out of this loop eventually!
+ -- one such token, so we are sure to get out of this loop eventually.
while Token not in Token_Class_Cterm loop
Scan;
@@ -135,7 +135,7 @@ package body Sync is
-- loop resynchronizing and getting nowhere. If we are called to do a
-- resynchronize and we are exactly at the same point that we left off
-- on the last resynchronize call, then we force at least one token to
- -- be skipped so that we make progress!
+ -- be skipped so that we make progress.
if Token_Ptr = Last_Resync_Point then
Scan; -- to skip at least one token
diff --git a/main/gcc/ada/par-tchk.adb b/main/gcc/ada/par-tchk.adb
index eefd7b4302e..c2d37bda22a 100644
--- a/main/gcc/ada/par-tchk.adb
+++ b/main/gcc/ada/par-tchk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -558,11 +558,11 @@ package body Tchk is
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
- Restore_Scan_State (Scan_State); -- to where we were!
+ Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Arrow then
Scan; -- past arrow
@@ -600,11 +600,11 @@ package body Tchk is
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
- Restore_Scan_State (Scan_State); -- to where we were!
+ Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Is
or else Token = Tok_Of
@@ -642,11 +642,11 @@ package body Tchk is
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
- Restore_Scan_State (Scan_State); -- to where we were!
+ Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Loop or else Token = Tok_Then then
Scan; -- past loop or then (message already generated)
@@ -677,11 +677,11 @@ package body Tchk is
or else Token = Tok_Semicolon
or else Token = Tok_EOF
then
- Restore_Scan_State (Scan_State); -- to where we were!
+ Restore_Scan_State (Scan_State); -- to where we were
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Return then
Scan; -- past RETURN
@@ -784,7 +784,7 @@ package body Tchk is
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Then then
Scan; -- past THEN
@@ -818,7 +818,7 @@ package body Tchk is
return;
end if;
- Scan; -- continue search!
+ Scan; -- continue search
if Token = Tok_Use then
Scan; -- past use
diff --git a/main/gcc/ada/par-util.adb b/main/gcc/ada/par-util.adb
index f2ac335e08c..ff75cf1c49c 100644
--- a/main/gcc/ada/par-util.adb
+++ b/main/gcc/ada/par-util.adb
@@ -97,7 +97,7 @@ package body Util is
-- Never consider something a misspelling if either the actual or
-- expected string is less than 3 characters (before this check we
- -- used to consider i to be a misspelled if in some cases!)
+ -- used to consider i to be a misspelled if in some cases).
if SL < 3 or else Name_Len < 3 then
return False;
@@ -268,7 +268,7 @@ package body Util is
Paren_Count : Nat;
begin
- -- First check, if a comma is present, then a comma is present!
+ -- First check, if a comma is present, then a comma is present
if Token = Tok_Comma then
T_Comma;
@@ -318,7 +318,7 @@ package body Util is
-- If that test didn't work, loop ahead looking for a comma or
-- semicolon at the same parenthesis level. Always remember that
- -- we can't go badly wrong in an error situation like this!
+ -- we can't go badly wrong in an error situation like this.
Paren_Count := 0;
diff --git a/main/gcc/ada/par.adb b/main/gcc/ada/par.adb
index 7e69166ddc0..93f5bb537bd 100644
--- a/main/gcc/ada/par.adb
+++ b/main/gcc/ada/par.adb
@@ -589,11 +589,11 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
-- Quite a bit of work, but really helpful in the case where it helps, and
-- the need for this is based on actual experience with tracking down this
- -- kind of error (the eye often easily mistakes semicolon for colon!)
+ -- kind of error (the eye often easily mistakes semicolon for colon).
-- Note: we actually have enough information to patch up the tree, but
- -- this may not be worth the effort! Also we could deal with the same
- -- situation for EXIT with a label, but for now don't bother with that!
+ -- this may not be worth the effort. Also we could deal with the same
+ -- situation for EXIT with a label, but for now don't bother with that.
---------------------------------
-- Parsing Routines by Chapter --
diff --git a/main/gcc/ada/prj-makr.adb b/main/gcc/ada/prj-makr.adb
index 7de436943f5..f6d71f46b90 100644
--- a/main/gcc/ada/prj-makr.adb
+++ b/main/gcc/ada/prj-makr.adb
@@ -889,6 +889,14 @@ package body Prj.Makr is
if No (Project_Node) then
Prj.Com.Fail ("parsing of existing project file failed");
+ elsif Project_Qualifier_Of (Project_Node, Tree) = Aggregate then
+ Prj.Com.Fail ("aggregate projects are not supported");
+
+ elsif Project_Qualifier_Of (Project_Node, Tree) =
+ Aggregate_Library
+ then
+ Prj.Com.Fail ("aggregate library projects are not supported");
+
else
-- If parsing was successful, remove the components that are
-- automatically generated, if any, so that they will be
diff --git a/main/gcc/ada/prj-part.adb b/main/gcc/ada/prj-part.adb
index ffcd69a2733..771f83ac83e 100644
--- a/main/gcc/ada/prj-part.adb
+++ b/main/gcc/ada/prj-part.adb
@@ -151,6 +151,12 @@ package body Prj.Part is
Project : Project_Node_Id);
-- Check that an aggregate project only imports abstract projects
+ procedure Check_Import_Aggregate
+ (Flags : Processing_Flags;
+ In_Tree : Project_Node_Tree_Ref;
+ Project : Project_Node_Id);
+ -- Check that a non aggregate project does not import an aggregate project
+
procedure Create_Virtual_Extending_Project
(For_Project : Project_Node_Id;
Main_Project : Project_Node_Id;
@@ -1101,6 +1107,36 @@ package body Prj.Part is
end Check_Aggregate_Imports;
----------------------------
+ -- Check_Import_Aggregate --
+ ----------------------------
+
+ procedure Check_Import_Aggregate
+ (Flags : Processing_Flags;
+ In_Tree : Project_Node_Tree_Ref;
+ Project : Project_Node_Id)
+ is
+ With_Clause : Project_Node_Id;
+ Imported : Project_Node_Id;
+
+ begin
+ if Project_Qualifier_Of (Project, In_Tree) /= Aggregate then
+ With_Clause := First_With_Clause_Of (Project, In_Tree);
+ while Present (With_Clause) loop
+ Imported := Project_Node_Of (With_Clause, In_Tree);
+
+ if Project_Qualifier_Of (Imported, In_Tree) = Aggregate then
+ Error_Msg_Name_1 := Name_Id (Path_Name_Of (Imported, In_Tree));
+ Error_Msg
+ (Flags, "cannot import aggregate project %%", Token_Ptr);
+ exit;
+ end if;
+
+ With_Clause := Next_With_Clause_Of (With_Clause, In_Tree);
+ end loop;
+ end if;
+ end Check_Import_Aggregate;
+
+ ----------------------------
-- Read_Project_Qualifier --
----------------------------
@@ -1767,6 +1803,7 @@ package body Prj.Part is
Check_Extending_All_Imports (Env.Flags, In_Tree, Project);
Check_Aggregate_Imports (Env.Flags, In_Tree, Project);
+ Check_Import_Aggregate (Env.Flags, In_Tree, Project);
-- Check that a project with a name including a dot either imports
-- or extends the project whose name precedes the last dot.
diff --git a/main/gcc/ada/prj.adb b/main/gcc/ada/prj.adb
index d7e2bc74a6b..6a0a830fe10 100644
--- a/main/gcc/ada/prj.adb
+++ b/main/gcc/ada/prj.adb
@@ -229,7 +229,7 @@ package body Prj is
-- Make sure that we don't have a config file for this
-- project, in case there are several mains. In this case,
-- we will recreate another config file: we cannot reuse the
- -- one that we just deleted!
+ -- one that we just deleted.
Proj.Project.Config_Checked := False;
Proj.Project.Config_File_Name := No_Path;
diff --git a/main/gcc/ada/projects.texi b/main/gcc/ada/projects.texi
index af3387492cc..e0ef9895904 100644
--- a/main/gcc/ada/projects.texi
+++ b/main/gcc/ada/projects.texi
@@ -2474,8 +2474,8 @@ so that all files are searched for only once on the disk
(thus reducing the number of system calls and contributing to faster
compilation times especially on systems with sources on remote
servers). As part of the loading, @command{gprbuild}
-computes how and where a source file should be compiled, and even if it is found
-several times in the aggregated projects it will be compiled only
+computes how and where a source file should be compiled, and even if it is
+found several times in the aggregated projects it will be compiled only
once.
Since there is no ambiguity as to which switches should be used, files
@@ -2494,9 +2494,10 @@ recommended extension is still @file{.gpr}. However, a special
@code{project}.
An aggregate project cannot @code{with} any other project (standard or
-aggregate), except an abstract project which can be used to share
-attribute values. Building other aggregate projects from an aggregate
-project is done through the Project_Files attribute (see below).
+aggregate), except an abstract project which can be used to share attribute
+values. Also, aggregate projects cannot be extended or imported though a
+@code{with} clause by any other project. Building other aggregate projects from
+an aggregate project is done through the Project_Files attribute (see below).
An aggregate project does not have any source files directly (only
through other standard projects). Therefore a number of the standard
@@ -2548,11 +2549,13 @@ attribute nor the @code{Library_*} attributes, and the result will be to
build all their source files (not just the ones needed by other
projects).
-The file can include paths (absolute or relative). Paths are
-relative to the location of the aggregate project file itself (if
-you use a base name, we expect to find the .gpr file in the same
-directory as the aggregate project file). The extension @file{.gpr} is
-mandatory, since this attribute contains file names, not project names.
+The file can include paths (absolute or relative). Paths are relative to
+the location of the aggregate project file itself (if you use a base name,
+we expect to find the .gpr file in the same directory as the aggregate
+project file). The environment variables @code{ADA_PROJECT_PATH},
+@code{GPR_PROJECT_PATH} and @code{GPR_PROJECT_PATH_FILE} are not used to find
+the project files. The extension @file{.gpr} is mandatory, since this attribute
+contains file names, not project names.
Paths can also include the @code{"*"} and @code{"**"} globbing patterns. The
latter indicates that any subdirectory (recursively) will be
@@ -2936,7 +2939,9 @@ The only package that is authorized (albeit optional) is Builder.
The Project_Files attribute (See @pxref{Aggregate Projects}) is used to
described the aggregated projects whose object files have to be
-included into the aggregate library.
+included into the aggregate library. The environment variables
+@code{ADA_PROJECT_PATH}, @code{GPR_PROJECT_PATH} and
+@code{GPR_PROJECT_PATH_FILE} are not used to find the project files.
@c ---------------------------------------------
@node Project File Reference
diff --git a/main/gcc/ada/repinfo.adb b/main/gcc/ada/repinfo.adb
index 11b92e62c38..19b63397d0d 100644
--- a/main/gcc/ada/repinfo.adb
+++ b/main/gcc/ada/repinfo.adb
@@ -929,7 +929,7 @@ package body Repinfo is
else
-- For the packed case, we don't know the bit positions if we
- -- don't know the starting position!
+ -- don't know the starting position.
if Is_Packed (Ent) then
Write_Line ("?? range ? .. ??;");
diff --git a/main/gcc/ada/rtsfind.adb b/main/gcc/ada/rtsfind.adb
index 9eeaa331f62..2c74afbe85e 100644
--- a/main/gcc/ada/rtsfind.adb
+++ b/main/gcc/ada/rtsfind.adb
@@ -710,7 +710,7 @@ package body Rtsfind is
-- of diagnostics, since we will take care of it here.
-- We save style checking switches and turn off style checking for
- -- loading the unit, since we don't want any style checking!
+ -- loading the unit, since we don't want any style checking.
declare
Save_Style_Check : constant Boolean := Style_Check;
@@ -1088,7 +1088,7 @@ package body Rtsfind is
-- declaration and otherwise do a regular find.
-- Not pleasant, but these kinds of annoying recursion when
- -- writing an Ada compiler in Ada have to be broken somewhere!
+ -- writing an Ada compiler in Ada have to be broken somewhere.
if Present (Main_Unit_Entity)
and then Chars (Main_Unit_Entity) = Name_System
diff --git a/main/gcc/ada/rtsfind.ads b/main/gcc/ada/rtsfind.ads
index 5ae85f32b96..8325bcf1fb3 100644
--- a/main/gcc/ada/rtsfind.ads
+++ b/main/gcc/ada/rtsfind.ads
@@ -1747,7 +1747,6 @@ package Rtsfind is
RE_Unlock_Entry, -- Protected_Objects.Single_Entry
RE_Protected_Single_Entry_Call, -- Protected_Objects.Single_Entry
RE_Service_Entry, -- Protected_Objects.Single_Entry
- RE_Complete_Single_Entry_Body, -- Protected_Objects.Single_Entry
RE_Exceptional_Complete_Single_Entry_Body,
RE_Protected_Count_Entry, -- Protected_Objects.Single_Entry
RE_Protected_Single_Entry_Caller, -- Protected_Objects.Single_Entry
@@ -3057,8 +3056,6 @@ package Rtsfind is
System_Tasking_Protected_Objects_Single_Entry,
RE_Service_Entry =>
System_Tasking_Protected_Objects_Single_Entry,
- RE_Complete_Single_Entry_Body =>
- System_Tasking_Protected_Objects_Single_Entry,
RE_Exceptional_Complete_Single_Entry_Body =>
System_Tasking_Protected_Objects_Single_Entry,
RE_Protected_Count_Entry =>
diff --git a/main/gcc/ada/s-arit64.adb b/main/gcc/ada/s-arit64.adb
index b6f253585c1..ce4f75abef5 100644
--- a/main/gcc/ada/s-arit64.adb
+++ b/main/gcc/ada/s-arit64.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -199,7 +199,7 @@ package body System.Arith_64 is
-- Compute Y * Z. Note that if the result overflows 64 bits unsigned,
-- then the rounded result is clearly zero (since the dividend is at
- -- most 2**63 - 1, the extra bit of precision is nice here!)
+ -- most 2**63 - 1, the extra bit of precision is nice here).
if Yhi /= 0 then
if Zhi /= 0 then
diff --git a/main/gcc/ada/s-asthan-vms-alpha.adb b/main/gcc/ada/s-asthan-vms-alpha.adb
index 623538f8613..253870f619b 100644
--- a/main/gcc/ada/s-asthan-vms-alpha.adb
+++ b/main/gcc/ada/s-asthan-vms-alpha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -399,7 +399,7 @@ package body System.AST_Handling is
STI.Undefer_Abort (Self_Id);
- -- We are awake, there is something to do!
+ -- We are awake, there is something to do
Lock_AST (Self_Id);
Num_Waiting_AST_Servers := Num_Waiting_AST_Servers - 1;
diff --git a/main/gcc/ada/s-asthan-vms-ia64.adb b/main/gcc/ada/s-asthan-vms-ia64.adb
index bd88b3a03fc..0f16fe8e331 100644
--- a/main/gcc/ada/s-asthan-vms-ia64.adb
+++ b/main/gcc/ada/s-asthan-vms-ia64.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -404,7 +404,7 @@ package body System.AST_Handling is
STI.Undefer_Abort (Self_Id);
- -- We are awake, there is something to do!
+ -- We are awake, there is something to do
Lock_AST (Self_Id);
Num_Waiting_AST_Servers := Num_Waiting_AST_Servers - 1;
diff --git a/main/gcc/ada/s-bignum.adb b/main/gcc/ada/s-bignum.adb
index cfcf7edf063..d12a9e3cd5f 100644
--- a/main/gcc/ada/s-bignum.adb
+++ b/main/gcc/ada/s-bignum.adb
@@ -364,7 +364,7 @@ package body System.Bignums is
Free_Bignum (XY2);
-- Raise storage error if intermediate value is getting too
- -- large, which we arbitrarily define as 200 words for now!
+ -- large, which we arbitrarily define as 200 words for now.
if XY2S.Len > 200 then
Free_Bignum (XY2S);
@@ -708,7 +708,7 @@ package body System.Bignums is
-- If both X and Y are less than 2**63-1, we can use Long_Long_Integer
-- arithmetic. Note it is good not to do an accurate range check against
- -- Long_Long_Integer since -2**63 / -1 overflows!
+ -- Long_Long_Integer since -2**63 / -1 overflows.
elsif (X.Len <= 1 or else (X.Len = 2 and then X.D (1) < 2**31))
and then
diff --git a/main/gcc/ada/s-dimmks.ads b/main/gcc/ada/s-dimmks.ads
index 879f5d740a9..d5526900461 100644
--- a/main/gcc/ada/s-dimmks.ads
+++ b/main/gcc/ada/s-dimmks.ads
@@ -105,7 +105,7 @@ package System.Dim.Mks is
-- Turn off the all the dimension warnings for these basic assignments
-- since otherwise we would get complaints about assigning dimensionless
- -- values to dimensioned subtypes (we can't assign 1.0*m to m!).
+ -- values to dimensioned subtypes (we can't assign 1.0*m to m).
pragma Warnings (Off, "*assumed to be*");
diff --git a/main/gcc/ada/s-fatgen.adb b/main/gcc/ada/s-fatgen.adb
index 1288904278d..f68dc76204f 100644
--- a/main/gcc/ada/s-fatgen.adb
+++ b/main/gcc/ada/s-fatgen.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -342,7 +342,7 @@ package body System.Fat_Gen is
-- The trick with Machine is to force the compiler to store the result
-- in memory so that we do not have extra precision used. The compiler
- -- is clever, so we have to outwit its possible optimizations! We do
+ -- is clever, so we have to outwit its possible optimizations. We do
-- this by using an intermediate pragma Volatile location.
function Machine (X : T) return T is
diff --git a/main/gcc/ada/s-fatgen.ads b/main/gcc/ada/s-fatgen.ads
index 81d6b1b9e02..13e78850416 100644
--- a/main/gcc/ada/s-fatgen.ads
+++ b/main/gcc/ada/s-fatgen.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,7 +47,7 @@ package System.Fat_Gen is
-- actual type used. For functions returning universal integer, there
-- is no problem, since the result always is in range of integer. For
-- input arguments, the expander has to do some special casing to deal
- -- with the (very annoying!) cases of out of range values. If we used
+ -- with the (very annoying) cases of out of range values. If we used
-- Long_Long_Integer to represent universal, then there would be no
-- problem, but the resulting inefficiency would be annoying.
diff --git a/main/gcc/ada/s-fileio.adb b/main/gcc/ada/s-fileio.adb
index 64b89926753..01313a09cff 100644
--- a/main/gcc/ada/s-fileio.adb
+++ b/main/gcc/ada/s-fileio.adb
@@ -348,7 +348,7 @@ package body System.File_IO is
-- Now unlink the external file. Note that we use the full name in
-- this unlink, because the working directory may have changed since
- -- we did the open, and we want to unlink the right file!
+ -- we did the open, and we want to unlink the right file.
if unlink (Filename'Address) = -1 then
raise Use_Error with Errno_Message;
@@ -492,7 +492,7 @@ package body System.File_IO is
-- initial call will be made by the caller to first open the file in "r"
-- mode to be sure that it exists. The real open, in "w" mode, will then
-- destroy this file. This is peculiar, but that's what Ada semantics
- -- require and the ACATS tests insist on!
+ -- require and the ACATS tests insist on.
-- If text file translation is required, then either "b" or "t" is appended
-- to the mode, depending on the setting of Text.
@@ -1238,7 +1238,7 @@ package body System.File_IO is
-- Note: for a corresponding delete, we will use the full name,
-- since by the time of the delete, the current working directory
- -- may have changed and we do not want to delete a different file!
+ -- may have changed and we do not want to delete a different file.
if VMS_Formstr = null then
Stream := fopen (Namestr'Address, Fopstr'Address, Encoding,
diff --git a/main/gcc/ada/s-imgcha.adb b/main/gcc/ada/s-imgcha.adb
index 67613ddbd48..bd60dc2d70b 100644
--- a/main/gcc/ada/s-imgcha.adb
+++ b/main/gcc/ada/s-imgcha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -134,7 +134,7 @@ package body System.Img_Char is
-- Special case, res means RESERVED_nnn where nnn is the three digit
-- decimal value corresponding to the code position (more efficient
- -- to compute than to store!)
+ -- to compute than to store).
else
declare
diff --git a/main/gcc/ada/s-imgrea.adb b/main/gcc/ada/s-imgrea.adb
index 5c5cbef24b7..fcfd107dd03 100644
--- a/main/gcc/ada/s-imgrea.adb
+++ b/main/gcc/ada/s-imgrea.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -158,7 +158,7 @@ package body System.Img_Real is
Field_Max : constant := 255;
-- This should be the same value as Ada.[Wide_]Text_IO.Field'Last.
-- It is not worth dragging in Ada.Text_IO to pick up this value,
- -- since it really should never be necessary to change it!
+ -- since it really should never be necessary to change it.
Digs : String (1 .. 2 * Field_Max + 16);
-- Array used to hold digits of converted integer value. This is a
diff --git a/main/gcc/ada/s-os_lib.adb b/main/gcc/ada/s-os_lib.adb
index 268e5418656..dc51fa17716 100644
--- a/main/gcc/ada/s-os_lib.adb
+++ b/main/gcc/ada/s-os_lib.adb
@@ -844,7 +844,7 @@ package body System.OS_Lib is
-- temp file names. Return Invalid_FD. There is almost
-- no chance that this code will be ever be executed,
-- since it would mean that there are one million temp
- -- files in the same directory!
+ -- files in the same directory.
SSL.Unlock_Task.all;
FD := Invalid_FD;
@@ -1718,7 +1718,7 @@ package body System.OS_Lib is
-- If argument is terminated by '\', then double it. Otherwise
-- the ending quote will be taken as-is. This is quite strange
- -- spawn behavior from Windows, but this is what we see!
+ -- spawn behavior from Windows, but this is what we see.
else
if Res (J) = '\' then
@@ -1927,9 +1927,10 @@ package body System.OS_Lib is
-- Start of processing for Normalize_Pathname
begin
- -- Special case, if name is null, then return null
+ -- Special case, return null if name is null, or if it is bigger than
+ -- the biggest name allowed.
- if Name'Length = 0 then
+ if Name'Length = 0 or else Name'Length > Max_Path then
return "";
end if;
diff --git a/main/gcc/ada/s-os_lib.ads b/main/gcc/ada/s-os_lib.ads
index 4e11fb1c211..cd644964f1f 100644
--- a/main/gcc/ada/s-os_lib.ads
+++ b/main/gcc/ada/s-os_lib.ads
@@ -445,9 +445,10 @@ package System.OS_Lib is
-- directory pointed to. This is slightly less efficient, since it
-- requires system calls.
--
- -- If Name cannot be resolved or is null on entry (for example if there is
- -- symbolic link circularity, e.g. A is a symbolic link for B, and B is a
- -- symbolic link for A), then Normalize_Pathname returns an empty string.
+ -- If Name cannot be resolved, is invalid (for example if it is too big) or
+ -- is null on entry (for example if there is symbolic link circularity,
+ -- e.g. A is a symbolic link for B, and B is a symbolic link for A), then
+ -- Normalize_Pathname returns an empty string.
--
-- In VMS, if Name follows the VMS syntax file specification, it is first
-- converted into Unix syntax. If the conversion fails, Normalize_Pathname
diff --git a/main/gcc/ada/s-regexp.adb b/main/gcc/ada/s-regexp.adb
index 56c38a8a5ee..68cef650aac 100644
--- a/main/gcc/ada/s-regexp.adb
+++ b/main/gcc/ada/s-regexp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2012, AdaCore --
+-- Copyright (C) 1999-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,11 +30,17 @@
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
-
with System.Case_Util;
package body System.Regexp is
+ Initial_Max_States_In_Primary_Table : constant := 100;
+ -- Initial size for the number of states in the indefinite state
+ -- machine. The number of states will be increased as needed.
+ --
+ -- This is also used as the maximal number of meta states (groups of
+ -- states) in the secondary table.
+
Open_Paren : constant Character := '(';
Close_Paren : constant Character := ')';
Open_Bracket : constant Character := '[';
@@ -45,13 +51,12 @@ package body System.Regexp is
type Regexp_Array is array
(State_Index range <>, Column_Index range <>) of State_Index;
- -- First index is for the state number
- -- Second index is for the character type
- -- Contents is the new State
+ -- First index is for the state number. Second index is for the character
+ -- type. Contents is the new State.
type Regexp_Array_Access is access Regexp_Array;
- -- Use this type through the functions Set below, so that it
- -- can grow dynamically depending on the needs.
+ -- Use this type through the functions Set below, so that it can grow
+ -- dynamically depending on the needs.
type Mapping is array (Character'Range) of Column_Index;
-- Mapping between characters and column in the Regexp_Array
@@ -84,10 +89,9 @@ package body System.Regexp is
function Get
(Table : Regexp_Array_Access;
State : State_Index;
- Column : Column_Index)
- return State_Index;
- -- Returns the value in the table at (State, Column).
- -- If this index does not exist in the table, returns 0
+ Column : Column_Index) return State_Index;
+ -- Returns the value in the table at (State, Column). If this index does
+ -- not exist in the table, returns zero.
procedure Free is new Ada.Unchecked_Deallocation
(Regexp_Array, Regexp_Array_Access);
@@ -98,7 +102,6 @@ package body System.Regexp is
procedure Adjust (R : in out Regexp) is
Tmp : Regexp_Access;
-
begin
if R.R /= null then
Tmp := new Regexp_Value (Alphabet_Size => R.R.Alphabet_Size,
@@ -115,8 +118,7 @@ package body System.Regexp is
function Compile
(Pattern : String;
Glob : Boolean := False;
- Case_Sensitive : Boolean := True)
- return Regexp
+ Case_Sensitive : Boolean := True) return Regexp
is
S : String := Pattern;
-- The pattern which is really compiled (when the pattern is case
@@ -152,10 +154,10 @@ package body System.Regexp is
-- parenthesis sub-expressions.
--
-- Table : at the end of the procedure : Column 0 is for any character
- -- ('.') and the last columns are for no character (closure)
- -- Num_States is set to the number of states in the table
- -- Start_State is the number of the starting state in the regexp
- -- End_State is the number of the final state when the regexp matches
+ -- ('.') and the last columns are for no character (closure). Num_States
+ -- is set to the number of states in the table Start_State is the number
+ -- of the starting state in the regexp End_State is the number of the
+ -- final state when the regexp matches.
procedure Create_Primary_Table_Glob
(Table : out Regexp_Array_Access;
@@ -168,10 +170,8 @@ package body System.Regexp is
function Create_Secondary_Table
(First_Table : Regexp_Array_Access;
- Num_States : State_Index;
Start_State : State_Index;
- End_State : State_Index)
- return Regexp;
+ End_State : State_Index) return Regexp;
-- Creates the definitive table representing the regular expression
-- This is actually a transformation of the primary table First_Table,
-- where every state is grouped with the states in its 'no-character'
@@ -543,8 +543,8 @@ package body System.Regexp is
J := J + 1;
end loop;
- -- A close bracket must follow a open_bracket,
- -- and cannot be found alone on the line
+ -- A close bracket must follow a open_bracket and cannot be
+ -- found alone on the line
when Close_Bracket =>
Raise_Exception
@@ -556,7 +556,7 @@ package body System.Regexp is
Add_In_Map (S (J));
else
- -- \ not allowed at the end of the regexp
+ -- Back slash \ not allowed at the end of the regexp
Raise_Exception
("Incorrect character '\' in regular expression", J);
@@ -690,11 +690,11 @@ package body System.Regexp is
End_Index : Integer;
Start_State : out State_Index;
End_State : out State_Index);
- -- Fill the table for the regexp Simple.
- -- This is the recursive procedure called to handle () expressions
- -- If End_State = 0, then the call to Create_Simple creates an
- -- independent regexp, not a concatenation
- -- Start_Index .. End_Index is the starting index in the string S.
+ -- Fill the table for the regexp Simple. This is the recursive
+ -- procedure called to handle () expressions If End_State = 0, then
+ -- the call to Create_Simple creates an independent regexp, not a
+ -- concatenation Start_Index .. End_Index is the starting index in
+ -- the string S.
--
-- Warning: it may look like we are creating too many empty-string
-- transitions, but they are needed to get the correct regexp.
@@ -741,8 +741,7 @@ package body System.Regexp is
function Next_Sub_Expression
(Start_Index : Integer;
- End_Index : Integer)
- return Integer;
+ End_Index : Integer) return Integer;
-- Returns the index of the last character of the next sub-expression
-- in Simple. Index cannot be greater than End_Index.
@@ -1038,8 +1037,7 @@ package body System.Regexp is
function Next_Sub_Expression
(Start_Index : Integer;
- End_Index : Integer)
- return Integer
+ End_Index : Integer) return Integer
is
J : Integer := Start_Index;
Start_On_Alter : Boolean := False;
@@ -1130,15 +1128,15 @@ package body System.Regexp is
(State : State_Index;
To_State : State_Index)
is
- J : Column_Index := Empty_Char;
+ J : Column_Index;
begin
+ J := Empty_Char;
while Get (Table, State, J) /= 0 loop
J := J + 1;
end loop;
- Set (Table, State, J,
- Value => To_State);
+ Set (Table, State, J, Value => To_State);
end Add_Empty_Char;
-------------------
@@ -1151,13 +1149,14 @@ package body System.Regexp is
Start_State : out State_Index;
End_State : out State_Index)
is
- J : Integer := Start_Index;
+ J : Integer;
Last_Start : State_Index := 0;
begin
Start_State := 0;
End_State := 0;
+ J := Start_Index;
while J <= End_Index loop
case S (J) is
@@ -1198,6 +1197,7 @@ package body System.Regexp is
then
declare
Start : constant Integer := J - 1;
+
begin
J := J + 1;
@@ -1369,56 +1369,109 @@ package body System.Regexp is
function Create_Secondary_Table
(First_Table : Regexp_Array_Access;
- Num_States : State_Index;
Start_State : State_Index;
End_State : State_Index) return Regexp
is
- pragma Warnings (Off, Num_States);
-
Last_Index : constant State_Index := First_Table'Last (1);
- type Meta_State is array (1 .. Last_Index) of Boolean;
-
- Table : Regexp_Array (1 .. Last_Index, 0 .. Alphabet_Size) :=
- (others => (others => 0));
- Meta_States : array (1 .. Last_Index + 1) of Meta_State :=
- (others => (others => False));
+ type Meta_State is array (0 .. Last_Index) of Boolean;
+ pragma Pack (Meta_State);
+ -- Whether a state from first_table belongs to a metastate.
+
+ No_States : constant Meta_State := (others => False);
+
+ type Meta_States_Array is array (State_Index range <>) of Meta_State;
+ type Meta_States_List is access all Meta_States_Array;
+ procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+ (Meta_States_Array, Meta_States_List);
+ Meta_States : Meta_States_List;
+ -- Components of meta-states. A given state might belong to
+ -- several meta-states.
+ -- This array grows dynamically.
+
+ type Char_To_State is array (0 .. Alphabet_Size) of State_Index;
+ type Meta_States_Transition_Arr is
+ array (State_Index range <>) of Char_To_State;
+ type Meta_States_Transition is access all Meta_States_Transition_Arr;
+ procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+ (Meta_States_Transition_Arr, Meta_States_Transition);
+ Table : Meta_States_Transition;
+ -- Documents the transitions between each meta-state. The
+ -- first index is the meta-state, the second column is the
+ -- character seen in the input, the value is the new meta-state.
Temp_State_Not_Null : Boolean;
- Is_Final : Boolean_Array (1 .. Last_Index) := (others => False);
-
Current_State : State_Index := 1;
+ -- The current meta-state we are creating
+
Nb_State : State_Index := 1;
+ -- The total number of meta-states created so far.
procedure Closure
- (State : in out Meta_State;
- Item : State_Index);
+ (Meta_State : State_Index;
+ State : State_Index);
-- Compute the closure of the state (that is every other state which
-- has a empty-character transition) and add it to the state
+ procedure Ensure_Meta_State (Meta : State_Index);
+ -- grows the Meta_States array as needed to make sure that there
+ -- is enough space to store the new meta state.
+
+ -----------------------
+ -- Ensure_Meta_State --
+ -----------------------
+
+ procedure Ensure_Meta_State (Meta : State_Index) is
+ Tmp : Meta_States_List := Meta_States;
+ Tmp2 : Meta_States_Transition := Table;
+
+ begin
+ if Meta_States = null then
+ Meta_States := new Meta_States_Array
+ (1 .. State_Index'Max (Last_Index, Meta) + 1);
+ Meta_States (Meta_States'Range) := (others => No_States);
+
+ Table := new Meta_States_Transition_Arr
+ (1 .. State_Index'Max (Last_Index, Meta) + 1);
+ Table.all := (others => (others => 0));
+
+ elsif Meta > Meta_States'Last then
+ Meta_States := new Meta_States_Array
+ (1 .. State_Index'Max (2 * Tmp'Last, Meta));
+ Meta_States (Tmp'Range) := Tmp.all;
+ Meta_States (Tmp'Last + 1 .. Meta_States'Last) :=
+ (others => No_States);
+ Unchecked_Free (Tmp);
+
+ Table := new Meta_States_Transition_Arr
+ (1 .. State_Index'Max (2 * Tmp2'Last, Meta) + 1);
+ Table (Tmp2'Range) := Tmp2.all;
+ Table (Tmp2'Last + 1 .. Table'Last) :=
+ (others => (others => 0));
+ Unchecked_Free (Tmp2);
+ end if;
+ end Ensure_Meta_State;
+
-------------
-- Closure --
-------------
procedure Closure
- (State : in out Meta_State;
- Item : State_Index)
+ (Meta_State : State_Index;
+ State : State_Index)
is
begin
- if State (Item) then
- return;
- end if;
+ if not Meta_States (Meta_State)(State) then
+ Meta_States (Meta_State)(State) := True;
- State (Item) := True;
+ -- For each transition on empty-character
- for Column in Alphabet_Size + 1 .. First_Table'Last (2) loop
- if First_Table (Item, Column) = 0 then
- return;
- end if;
-
- Closure (State, First_Table (Item, Column));
- end loop;
+ for Column in Alphabet_Size + 1 .. First_Table'Last (2) loop
+ exit when First_Table (State, Column) = 0;
+ Closure (Meta_State, First_Table (State, Column));
+ end loop;
+ end if;
end Closure;
-- Start of processing for Create_Secondary_Table
@@ -1426,30 +1479,26 @@ package body System.Regexp is
begin
-- Create a new state
- Closure (Meta_States (Current_State), Start_State);
+ Ensure_Meta_State (Current_State);
+ Closure (Current_State, Start_State);
while Current_State <= Nb_State loop
- -- If this new meta-state includes the primary table end state,
- -- then this meta-state will be a final state in the regexp
+ -- We will be trying, below, to create the next meta-state
- if Meta_States (Current_State)(End_State) then
- Is_Final (Current_State) := True;
- end if;
+ Ensure_Meta_State (Nb_State + 1);
-- For every character in the regexp, calculate the possible
- -- transitions from Current_State
+ -- transitions from Current_State.
for Column in 0 .. Alphabet_Size loop
- Meta_States (Nb_State + 1) := (others => False);
Temp_State_Not_Null := False;
for K in Meta_States (Current_State)'Range loop
if Meta_States (Current_State)(K)
and then First_Table (K, Column) /= 0
then
- Closure
- (Meta_States (Nb_State + 1), First_Table (K, Column));
+ Closure (Nb_State + 1, First_Table (K, Column));
Temp_State_Not_Null := True;
end if;
end loop;
@@ -1462,16 +1511,21 @@ package body System.Regexp is
for K in 1 .. Nb_State loop
if Meta_States (K) = Meta_States (Nb_State + 1) then
- Table (Current_State, Column) := K;
+ Table (Current_State)(Column) := K;
+
+ -- Reset data, for the next time we try that state
+
+ Meta_States (Nb_State + 1) := No_States;
exit;
end if;
end loop;
-- If not, create a new state
- if Table (Current_State, Column) = 0 then
+ if Table (Current_State)(Column) = 0 then
Nb_State := Nb_State + 1;
- Table (Current_State, Column) := Nb_State;
+ Ensure_Meta_State (Nb_State + 1);
+ Table (Current_State)(Column) := Nb_State;
end if;
end if;
end loop;
@@ -1488,15 +1542,21 @@ package body System.Regexp is
R := new Regexp_Value (Alphabet_Size => Alphabet_Size,
Num_States => Nb_State);
R.Map := Map;
- R.Is_Final := Is_Final (1 .. Nb_State);
R.Case_Sensitive := Case_Sensitive;
+ for S in 1 .. Nb_State loop
+ R.Is_Final (S) := Meta_States (S)(End_State);
+ end loop;
+
for State in 1 .. Nb_State loop
for K in 0 .. Alphabet_Size loop
- R.States (State, K) := Table (State, K);
+ R.States (State, K) := Table (State)(K);
end loop;
end loop;
+ Unchecked_Free (Meta_States);
+ Unchecked_Free (Table);
+
return (Ada.Finalization.Controlled with R => R);
end;
end Create_Secondary_Table;
@@ -1515,6 +1575,7 @@ package body System.Regexp is
begin
-- Special case for the empty string: it always matches, and the
-- following processing would fail on it.
+
if S = "" then
return (Ada.Finalization.Controlled with
R => new Regexp_Value'
@@ -1546,7 +1607,7 @@ package body System.Regexp is
R : Regexp;
begin
- Table := new Regexp_Array (1 .. 100,
+ Table := new Regexp_Array (1 .. Initial_Max_States_In_Primary_Table,
0 .. Alphabet_Size + 10);
if not Glob then
Create_Primary_Table (Table, Num_States, Start_State, End_State);
@@ -1557,8 +1618,7 @@ package body System.Regexp is
-- Creates the secondary table
- R := Create_Secondary_Table
- (Table, Num_States, Start_State, End_State);
+ R := Create_Secondary_Table (Table, Start_State, End_State);
Free (Table);
return R;
end;
@@ -1571,7 +1631,6 @@ package body System.Regexp is
procedure Finalize (R : in out Regexp) is
procedure Free is new
Ada.Unchecked_Deallocation (Regexp_Value, Regexp_Access);
-
begin
Free (R.R);
end Finalize;
@@ -1647,7 +1706,7 @@ package body System.Regexp is
Table (State, Column) := Value;
else
-- Doubles the size of the table until it is big enough that
- -- (State, Column) is a valid index
+ -- (State, Column) is a valid index.
New_Lines := Table'Last (1) * (State / Table'Last (1) + 1);
New_Columns := Table'Last (2) * (Column / Table'Last (2) + 1);
diff --git a/main/gcc/ada/s-regpat.adb b/main/gcc/ada/s-regpat.adb
index 88143289e44..d32bb03f06d 100644
--- a/main/gcc/ada/s-regpat.adb
+++ b/main/gcc/ada/s-regpat.adb
@@ -2556,7 +2556,7 @@ package body System.Regpat is
case Op is
when EOP =>
Dump_Indent := Dump_Indent - 1;
- return True; -- Success !
+ return True; -- Success
when BRANCH =>
if Program (Next) /= BRANCH then
diff --git a/main/gcc/ada/s-secsta.adb b/main/gcc/ada/s-secsta.adb
index 0afea184baf..e883721e309 100644
--- a/main/gcc/ada/s-secsta.adb
+++ b/main/gcc/ada/s-secsta.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -161,7 +161,7 @@ package body System.Secondary_Stack is
-- Well it is not quite true that we never allocate an object of the
-- type. This dummy object is allocated for the purpose of getting the
-- offset of the Mem field via the 'Position attribute (such a nuisance
- -- that we cannot apply this to a field of a type!)
+ -- that we cannot apply this to a field of a type).
type Fixed_Stack_Ptr is access Fixed_Stack_Id;
-- Pointer to record used to describe statically allocated sec stack
diff --git a/main/gcc/ada/s-stalib.ads b/main/gcc/ada/s-stalib.ads
index 6658afbae31..b1c06180939 100644
--- a/main/gcc/ada/s-stalib.ads
+++ b/main/gcc/ada/s-stalib.ads
@@ -87,7 +87,7 @@ package System.Standard_Library is
-- The following record defines the underlying representation of exceptions
- -- WARNING! Any changes to this may need to be reflected in the following
+ -- WARNING: Any changes to this may need to be reflected in the following
-- locations in the compiler and runtime code:
-- 1. The Internal_Exception routine in s-exctab.adb
diff --git a/main/gcc/ada/s-stchop.adb b/main/gcc/ada/s-stchop.adb
index b757c56532b..bce3e3f391a 100644
--- a/main/gcc/ada/s-stchop.adb
+++ b/main/gcc/ada/s-stchop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -180,7 +180,7 @@ package body System.Stack_Checking.Operations is
raise Standard'Abort_Signal;
end if;
- -- Never trust the cached value, but return local copy!
+ -- Never trust the cached value, but return local copy
return My_Stack;
end Set_Stack_Info;
@@ -233,7 +233,7 @@ package body System.Stack_Checking.Operations is
declare
My_Stack : constant Stack_Access := Set_Stack_Info (Cache'Access);
-- At this point Stack.all might already be invalid, so
- -- it is essential to use our local copy of Stack!
+ -- it is essential to use our local copy of Stack.
begin
if (Stack_Grows_Down and then
diff --git a/main/gcc/ada/s-stoele.ads b/main/gcc/ada/s-stoele.ads
index af60beb5518..132482b7502 100644
--- a/main/gcc/ada/s-stoele.ads
+++ b/main/gcc/ada/s-stoele.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -35,7 +35,7 @@
-- Warning: declarations in this package are ambiguous with respect to the
-- extra declarations that can be introduced into System using Extend_System.
--- It is a good idea to avoid use clauses for this package!
+-- It is a good idea to avoid use clauses for this package.
pragma Compiler_Unit;
diff --git a/main/gcc/ada/s-taprop-solaris.adb b/main/gcc/ada/s-taprop-solaris.adb
index 92088e10cb4..1d8797913e8 100644
--- a/main/gcc/ada/s-taprop-solaris.adb
+++ b/main/gcc/ada/s-taprop-solaris.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1125,7 +1125,7 @@ package body System.Task_Primitives.Operations is
-- on the Real_Time clock. That is technically incorrect, if the Calendar
-- clock happens to be reset or adjusted. To solve this defect will require
-- modification to the compiler interface, so that it can pass through more
- -- information, to tell us here which clock to use!
+ -- information, to tell us here which clock to use.
-- cond_timedwait will return if any of the following happens:
-- 1) some other task did cond_signal on this condition variable
diff --git a/main/gcc/ada/s-tasdeb-vms.adb b/main/gcc/ada/s-tasdeb-vms.adb
index 1dbb5c53fc5..6c9ae75e332 100644
--- a/main/gcc/ada/s-tasdeb-vms.adb
+++ b/main/gcc/ada/s-tasdeb-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2008-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1248,10 +1248,10 @@ package body System.Tasking.Debug is
is
Task_Value : Task_Id;
Task_Index : constant Integer := Integer (Event_Value) - 1;
- begin
+ begin
-- At least one event enabled, any and all events will cause a
- -- condition to be raised and checked. Major tasking slowdown!
+ -- condition to be raised and checked. Major tasking slowdown.
Global_Task_Debug_Event_Set := True;
Events_Enabled_Count := Events_Enabled_Count + 1;
@@ -1284,8 +1284,8 @@ package body System.Tasking.Debug is
Event_Entry : out Unsigned_Longword;
Status : out Cond_Value_Type)
is
- K_SUCCESS : constant := 1;
- K_NO_SUCH_EVENT : constant := 9;
+ K_SUCCESS : constant := 1;
+ K_NO_SUCH_EVENT : constant := 9;
begin
Trace_Output ("Looking for Event: ");
@@ -1313,8 +1313,8 @@ package body System.Tasking.Debug is
Event_Entry : out Unsigned_Longword;
Status : out Cond_Value_Type)
is
- K_SUCCESS : constant := 1;
- K_NO_SUCH_EVENT : constant := 9;
+ K_SUCCESS : constant := 1;
+ K_NO_SUCH_EVENT : constant := 9;
Event_Name_Cstr : constant ASCIC := To_AASCIC (Event_Name).all;
begin
@@ -1384,7 +1384,7 @@ package body System.Tasking.Debug is
Task_Image : ASCIC :=
(Entry_Call.Self.Common.Task_Image_Len,
Entry_Call.Self.Common.Task_Image
- (1 .. Entry_Call.Self.Common.Task_Image_Len));
+ (1 .. Entry_Call.Self.Common.Task_Image_Len));
begin
Print_Routine (Print_FAO, Print_Newline,
To_UL (DoAC (" %TASK !UI, type: !AC")),
diff --git a/main/gcc/ada/s-tasini.adb b/main/gcc/ada/s-tasini.adb
index 7203c1ccec2..27bf9398151 100644
--- a/main/gcc/ada/s-tasini.adb
+++ b/main/gcc/ada/s-tasini.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -598,7 +598,7 @@ package body System.Tasking.Initialization is
-- Undefer_Abort --
-------------------
- -- Precondition : Self does not hold any locks!
+ -- Precondition : Self does not hold any locks
-- Undefer_Abort is called on any abort completion point (aka.
-- synchronization point). It performs the following actions if they
diff --git a/main/gcc/ada/s-tassta.adb b/main/gcc/ada/s-tassta.adb
index 487bf8d5340..79669584b4c 100644
--- a/main/gcc/ada/s-tassta.adb
+++ b/main/gcc/ada/s-tassta.adb
@@ -459,7 +459,7 @@ package body System.Tasking.Stages is
Vulnerable_Complete_Task (Self_ID);
- -- All of our dependents have terminated. Never undefer abort again!
+ -- All of our dependents have terminated, never undefer abort again
end Complete_Task;
@@ -829,7 +829,7 @@ package body System.Tasking.Stages is
Initialization.Defer_Abort_Nestable (Self_ID);
- -- Never undefer again!!!
+ -- Never undefer again
end if;
-- This code is only executed by the environment task
@@ -1394,7 +1394,7 @@ package body System.Tasking.Stages is
-- unlocking, after which the parent was observed to race ahead, deallocate
-- the ATCB, and then reallocate it to another task. The call to
-- Undefer_Abort in Task_Unlock by the "terminated" task was overwriting
- -- the data of the new task that reused the ATCB! To solve this problem, we
+ -- the data of the new task that reused the ATCB. To solve this problem, we
-- introduced the new operation Final_Task_Unlock.
procedure Terminate_Task (Self_ID : Task_Id) is
diff --git a/main/gcc/ada/s-tposen.adb b/main/gcc/ada/s-tposen.adb
index 10cfca21016..356da5aa461 100644
--- a/main/gcc/ada/s-tposen.adb
+++ b/main/gcc/ada/s-tposen.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -278,20 +278,6 @@ package body System.Tasking.Protected_Objects.Single_Entry is
-- Restricted GNARLI --
-----------------------
- --------------------------------
- -- Complete_Single_Entry_Body --
- --------------------------------
-
- procedure Complete_Single_Entry_Body (Object : Protection_Entry_Access) is
- pragma Warnings (Off, Object);
-
- begin
- -- Nothing needs to do (Object.Call_In_Progress.Exception_To_Raise
- -- has already been set to Null_Id).
-
- null;
- end Complete_Single_Entry_Body;
-
--------------------------------------------
-- Exceptional_Complete_Single_Entry_Body --
--------------------------------------------
diff --git a/main/gcc/ada/s-tposen.ads b/main/gcc/ada/s-tposen.ads
index c5b832ce214..6cfd3de537d 100644
--- a/main/gcc/ada/s-tposen.ads
+++ b/main/gcc/ada/s-tposen.ads
@@ -250,12 +250,6 @@ package System.Tasking.Protected_Objects.Single_Entry is
-- Same as the Protected_Entry_Call but with time-out specified.
-- This routine is used to implement timed entry calls.
- procedure Complete_Single_Entry_Body
- (Object : Protection_Entry_Access);
- pragma Inline (Complete_Single_Entry_Body);
- -- Called from within an entry body procedure, indicates that the
- -- corresponding entry call has been serviced.
-
procedure Exceptional_Complete_Single_Entry_Body
(Object : Protection_Entry_Access;
Ex : Ada.Exceptions.Exception_Id);
diff --git a/main/gcc/ada/s-valdec.adb b/main/gcc/ada/s-valdec.adb
index 88b28c9b1a6..ecd76821cae 100644
--- a/main/gcc/ada/s-valdec.adb
+++ b/main/gcc/ada/s-valdec.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,7 +40,7 @@ package body System.Val_Dec is
-- For decimal types where Size < Integer'Size, it is fine to use
-- the floating-point circuit, since it certainly has sufficient
-- precision for any reasonable hardware, and we just don't support
- -- things on junk hardware!
+ -- things on junk hardware.
function Scan_Decimal
(Str : String;
diff --git a/main/gcc/ada/s-valuti.adb b/main/gcc/ada/s-valuti.adb
index ce6db6fecb4..6d6b827a79c 100644
--- a/main/gcc/ada/s-valuti.adb
+++ b/main/gcc/ada/s-valuti.adb
@@ -222,7 +222,7 @@ package body System.Val_Util is
P : Natural := Ptr.all;
begin
- -- Deal with case of null string (all blanks!). As per spec, we raise
+ -- Deal with case of null string (all blanks). As per spec, we raise
-- constraint error, with Ptr unchanged, and thus > Max.
if P > Max then
diff --git a/main/gcc/ada/s-wchjis.adb b/main/gcc/ada/s-wchjis.adb
index a005ec68d9b..73282796c8e 100644
--- a/main/gcc/ada/s-wchjis.adb
+++ b/main/gcc/ada/s-wchjis.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -118,7 +118,7 @@ package body System.WCh_JIS is
begin
-- The following is the required algorithm, it's hard to make any
- -- more intelligent comments! This was copied from a public domain
+ -- more intelligent comments. This was copied from a public domain
-- C program called etos.c (author unknown).
JIS1 := Byte (Natural (Wide_Character'Pos (J) / 256));
@@ -154,7 +154,7 @@ package body System.WCh_JIS is
begin
-- The following is the required algorithm, it's hard to make any
- -- more intelligent comments! This was copied from a public domain
+ -- more intelligent comments. This was copied from a public domain
-- C program called stoj.c written by shige@csk.JUNET.
SJIS1 := Character'Pos (SJ1);
diff --git a/main/gcc/ada/s-wchwts.adb b/main/gcc/ada/s-wchwts.adb
index 4902a7f48dd..895221e88dc 100644
--- a/main/gcc/ada/s-wchwts.adb
+++ b/main/gcc/ada/s-wchwts.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -86,7 +86,7 @@ package body System.WCh_WtS is
(S : Wide_String;
EM : WC_Encoding_Method) return String
is
- R : String (S'First .. S'First + 5 * S'Length); -- worst case length!
+ R : String (S'First .. S'First + 5 * S'Length); -- worst case length
RP : Natural;
begin
@@ -106,7 +106,7 @@ package body System.WCh_WtS is
(S : Wide_Wide_String;
EM : WC_Encoding_Method) return String
is
- R : String (S'First .. S'First + 7 * S'Length); -- worst case length!
+ R : String (S'First .. S'First + 7 * S'Length); -- worst case length
RP : Natural;
begin
diff --git a/main/gcc/ada/scans.adb b/main/gcc/ada/scans.adb
index 0c51891f369..121ab11a8fd 100644
--- a/main/gcc/ada/scans.adb
+++ b/main/gcc/ada/scans.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -51,7 +51,7 @@ package body Scans is
-- Set up Token_Type values in Names table entries for reserved
-- words. We use the Pos value of the Token_Type value. Note that
-- Is_Keyword_Name relies on the fact that Token_Type'Val (0) is not
- -- a reserved word!
+ -- a reserved word.
Set_Name_Table_Byte (N, Token_Type'Pos (T));
end Set_Reserved;
diff --git a/main/gcc/ada/scng.adb b/main/gcc/ada/scng.adb
index 8b08949601a..f8377f4bb5c 100644
--- a/main/gcc/ada/scng.adb
+++ b/main/gcc/ada/scng.adb
@@ -429,7 +429,7 @@ package body Scng is
procedure Error_Illegal_Wide_Character;
-- Give illegal wide character message. On return, Scan_Ptr is bumped
-- past the illegal character, which may still leave us pointing to
- -- junk, not much we can do if the escape sequence is messed up!
+ -- junk, not much we can do if the escape sequence is messed up.
procedure Error_No_Double_Underline;
-- Signal error of two underline or punctuation characters in a row.
@@ -2511,7 +2511,7 @@ package body Scng is
-- Left bracket not followed by a quote terminates an identifier.
-- This is an error, but we don't want to give a junk error msg
- -- about wide characters in this case!
+ -- about wide characters in this case.
elsif Source (Scan_Ptr) = '['
and then Source (Scan_Ptr + 1) /= '"'
diff --git a/main/gcc/ada/sem_aggr.adb b/main/gcc/ada/sem_aggr.adb
index 374bb7b9081..18365fc781c 100644
--- a/main/gcc/ada/sem_aggr.adb
+++ b/main/gcc/ada/sem_aggr.adb
@@ -761,7 +761,7 @@ package body Sem_Aggr is
begin
-- All the components of List are matched against Component and a count
-- is maintained of possible misspellings. When at the end of the the
- -- analysis there are one or two (not more!) possible misspellings,
+ -- analysis there are one or two (not more) possible misspellings,
-- these misspellings will be suggested as possible correction.
Component_Elmt := First_Elmt (Elements);
diff --git a/main/gcc/ada/sem_attr.adb b/main/gcc/ada/sem_attr.adb
index ee1841196ff..b69c1b241a7 100644
--- a/main/gcc/ada/sem_attr.adb
+++ b/main/gcc/ada/sem_attr.adb
@@ -6183,7 +6183,7 @@ package body Sem_Attr is
-- Note, we need a range check in general, but we wait for the
-- Resolve call to do this, since we want to let Eval_Attribute
- -- have a chance to find an static illegality first!
+ -- have a chance to find an static illegality first.
end Val;
-----------
@@ -6726,7 +6726,7 @@ package body Sem_Attr is
-- Note that the whole point of the E_String_Literal_Subtype is to
-- avoid this construction of bounds, but the cases in which we
- -- have to materialize them are rare enough that we don't worry!
+ -- have to materialize them are rare enough that we don't worry.
-- The low bound is simply the low bound of the base type. The
-- high bound is computed from the length of the string and this
@@ -6776,7 +6776,7 @@ package body Sem_Attr is
end loop;
-- If no index type, get out (some other error occurred, and
- -- we don't have enough information to complete the job!)
+ -- we don't have enough information to complete the job).
if No (Indx) then
Lo_Bound := Error;
@@ -9075,7 +9075,7 @@ package body Sem_Attr is
if J > 255 then
- -- No need to compute this more than once!
+ -- No need to compute this more than once
exit;
@@ -10444,7 +10444,7 @@ package body Sem_Attr is
-----------------
-- Prefix must not be resolved in this case, since it is not a
- -- real entity reference. No action of any kind is require!
+ -- real entity reference. No action of any kind is require.
when Attribute_UET_Address =>
return;
@@ -10533,7 +10533,7 @@ package body Sem_Attr is
-- Eval_Attribute may replace the node with a raise CE, or
-- fold it to a constant. Obviously we only apply a scalar
- -- range check if this did not happen!
+ -- range check if this did not happen.
if Nkind (N) = N_Attribute_Reference
and then Attribute_Name (N) = Name_Val
diff --git a/main/gcc/ada/sem_aux.adb b/main/gcc/ada/sem_aux.adb
index 84547c2fb55..9aa7f4cac4f 100644
--- a/main/gcc/ada/sem_aux.adb
+++ b/main/gcc/ada/sem_aux.adb
@@ -977,7 +977,7 @@ package body Sem_Aux is
-- Otherwise we will look around to see if there is some other reason
-- for it to be limited, except that if an error was posted on the
-- entity, then just assume it is non-limited, because it can cause
- -- trouble to recurse into a murky erroneous entity!
+ -- trouble to recurse into a murky erroneous entity.
elsif Error_Posted (Ent) then
return False;
diff --git a/main/gcc/ada/sem_cat.adb b/main/gcc/ada/sem_cat.adb
index 3692e519330..47736565dd5 100644
--- a/main/gcc/ada/sem_cat.adb
+++ b/main/gcc/ada/sem_cat.adb
@@ -1066,7 +1066,7 @@ package body Sem_Cat is
-- Note that the 10.2.1(9) restrictions are not relevant to us anyway.
-- We have to enforce them for RM compatibility, but we have no trouble
-- accepting these objects and doing the right thing. Note that there is
- -- no requirement that Preelaborate not actually generate any code!
+ -- no requirement that Preelaborate not actually generate any code.
if In_Preelaborated_Unit
and then not Debug_Flag_PP
diff --git a/main/gcc/ada/sem_ch10.adb b/main/gcc/ada/sem_ch10.adb
index 257de8ee414..eac99c3ac8d 100644
--- a/main/gcc/ada/sem_ch10.adb
+++ b/main/gcc/ada/sem_ch10.adb
@@ -1171,7 +1171,7 @@ package body Sem_Ch10 is
Set_Elaboration_Entity_Required (Spec_Id, False);
-- Case of elaboration entity is required for access before
- -- elaboration checking (so certainly we must build it!)
+ -- elaboration checking (so certainly we must build it).
else
Set_Elaboration_Entity_Required (Spec_Id, True);
@@ -5532,8 +5532,9 @@ package body Sem_Ch10 is
Set_Ekind (Ent, E_Abstract_State);
Set_Etype (Ent, Standard_Void_Type);
Set_Scope (Ent, Scop);
- Set_Refined_State (Ent, Empty);
+ Set_Encapsulating_State (Ent, Empty);
Set_Refinement_Constituents (Ent, New_Elmt_List);
+ Set_Part_Of_Constituents (Ent, New_Elmt_List);
end Decorate_State;
-------------------
diff --git a/main/gcc/ada/sem_ch12.adb b/main/gcc/ada/sem_ch12.adb
index 565df4edf07..4ddfdc56220 100644
--- a/main/gcc/ada/sem_ch12.adb
+++ b/main/gcc/ada/sem_ch12.adb
@@ -98,7 +98,7 @@ package body Sem_Ch12 is
-- tree and the copy, in order to recognize non-local references within
-- the generic, and propagate them to each instance (recall that name
-- resolution is done on the generic declaration: generics are not really
- -- macros!). This is summarized in the following diagram:
+ -- macros). This is summarized in the following diagram:
-- .-----------. .----------.
-- | semantic |<--------------| generic |
@@ -3899,7 +3899,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings));
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma));
end if;
end if;
@@ -4245,7 +4247,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings)),
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma)),
Inlined_Body => True);
Pop_Scope;
@@ -4363,7 +4367,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings)),
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma)),
Inlined_Body => True);
end if;
end Inline_Instance_Body;
@@ -4421,7 +4427,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings));
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma));
return True;
-- Here if not inlined, or we ignore the inlining
@@ -6765,7 +6773,7 @@ package body Sem_Ch12 is
-- If the node is a compilation unit, it is the subunit of a stub, which
-- has been loaded already (see code below). In this case, the library
-- unit field of N points to the parent unit (which is a compilation
- -- unit) and need not (and cannot!) be copied.
+ -- unit) and need not (and cannot) be copied.
-- When the proper body of the stub is analyzed, the library_unit link
-- is used to establish the proper context (see sem_ch10).
@@ -9913,6 +9921,8 @@ package body Sem_Ch12 is
Opt.Ada_Version := Body_Info.Version;
Opt.Ada_Version_Pragma := Body_Info.Version_Pragma;
Restore_Warnings (Body_Info.Warnings);
+ Opt.SPARK_Mode := Body_Info.SPARK_Mode;
+ Opt.SPARK_Mode_Pragma := Body_Info.SPARK_Mode_Pragma;
if No (Gen_Body_Id) then
Load_Parent_Of_Generic
@@ -10203,6 +10213,8 @@ package body Sem_Ch12 is
Opt.Ada_Version := Body_Info.Version;
Opt.Ada_Version_Pragma := Body_Info.Version_Pragma;
Restore_Warnings (Body_Info.Warnings);
+ Opt.SPARK_Mode := Body_Info.SPARK_Mode;
+ Opt.SPARK_Mode_Pragma := Body_Info.SPARK_Mode_Pragma;
if No (Gen_Body_Id) then
@@ -12091,7 +12103,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings);
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma);
-- Package instance
@@ -12133,7 +12147,9 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
Version => Ada_Version,
Version_Pragma => Ada_Version_Pragma,
- Warnings => Save_Warnings)),
+ Warnings => Save_Warnings,
+ SPARK_Mode => SPARK_Mode,
+ SPARK_Mode_Pragma => SPARK_Mode_Pragma)),
Body_Optional => Body_Optional);
end;
end if;
@@ -13799,7 +13815,9 @@ package body Sem_Ch12 is
(Gen_Unit : Entity_Id;
Act_Unit : Entity_Id)
is
- Assertion_Status : constant Boolean := Assertions_Enabled;
+ Assertion_Status : constant Boolean := Assertions_Enabled;
+ Save_SPARK_Mode : constant SPARK_Mode_Type := SPARK_Mode;
+ Save_SPARK_Mode_Pragma : constant Node_Id := SPARK_Mode_Pragma;
begin
-- Regardless of the current mode, predefined units are analyzed in the
@@ -13822,6 +13840,12 @@ package body Sem_Ch12 is
if Ada_Version >= Ada_2012 then
Assertions_Enabled := Assertion_Status;
end if;
+
+ -- SPARK_Mode for an instance is the one applicable at the point of
+ -- instantiation.
+
+ SPARK_Mode := Save_SPARK_Mode;
+ SPARK_Mode_Pragma := Save_SPARK_Mode_Pragma;
end if;
Current_Instantiated_Parent :=
diff --git a/main/gcc/ada/sem_ch13.adb b/main/gcc/ada/sem_ch13.adb
index 61db885924c..6540bbf0400 100644
--- a/main/gcc/ada/sem_ch13.adb
+++ b/main/gcc/ada/sem_ch13.adb
@@ -1140,33 +1140,35 @@ package body Sem_Ch13 is
-----------------------------------
procedure Analyze_Aspect_Specifications (N : Node_Id; E : Entity_Id) is
- procedure Decorate_Delayed_Aspect_And_Pragma
- (Asp : Node_Id;
- Prag : Node_Id);
- -- Establish the linkages between a delayed aspect and its corresponding
- -- pragma. Set all delay-related flags on both constructs.
+ procedure Decorate_Aspect_And_Pragma
+ (Asp : Node_Id;
+ Prag : Node_Id;
+ Delayed : Boolean := False);
+ -- Establish the linkages between an aspect and its corresponding
+ -- pragma. Flag Delayed should be set when both constructs are delayed.
procedure Insert_Delayed_Pragma (Prag : Node_Id);
-- Insert a postcondition-like pragma into the tree depending on the
-- context. Prag must denote one of the following: Pre, Post, Depends,
-- Global or Contract_Cases.
- ----------------------------------------
- -- Decorate_Delayed_Aspect_And_Pragma --
- ----------------------------------------
+ --------------------------------
+ -- Decorate_Aspect_And_Pragma --
+ --------------------------------
- procedure Decorate_Delayed_Aspect_And_Pragma
- (Asp : Node_Id;
- Prag : Node_Id)
+ procedure Decorate_Aspect_And_Pragma
+ (Asp : Node_Id;
+ Prag : Node_Id;
+ Delayed : Boolean := False)
is
begin
- Set_Aspect_Rep_Item (Asp, Prag);
+ Set_Aspect_Rep_Item (Asp, Prag);
Set_Corresponding_Aspect (Prag, Asp);
Set_From_Aspect_Specification (Prag);
- Set_Is_Delayed_Aspect (Prag);
- Set_Is_Delayed_Aspect (Asp);
+ Set_Is_Delayed_Aspect (Prag, Delayed);
+ Set_Is_Delayed_Aspect (Asp, Delayed);
Set_Parent (Prag, Asp);
- end Decorate_Delayed_Aspect_And_Pragma;
+ end Decorate_Aspect_And_Pragma;
---------------------------
-- Insert_Delayed_Pragma --
@@ -2004,7 +2006,7 @@ package body Sem_Ch13 is
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Abstract_State);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma (Aspect, Aitem);
if No (Decls) then
Decls := New_List;
@@ -2036,7 +2038,8 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Depends);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
Insert_Delayed_Pragma (Aitem);
goto Continue;
@@ -2054,7 +2057,8 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Global);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
Insert_Delayed_Pragma (Aitem);
goto Continue;
@@ -2079,7 +2083,9 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name =>
Name_Initial_Condition);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
if No (Decls) then
Decls := New_List;
@@ -2117,7 +2123,9 @@ package body Sem_Ch13 is
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Initializes);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
if No (Decls) then
Decls := New_List;
@@ -2135,6 +2143,24 @@ package body Sem_Ch13 is
goto Continue;
end Initializes;
+ -- Part_Of
+
+ when Aspect_Part_Of =>
+ if Nkind_In (N, N_Object_Declaration,
+ N_Package_Instantiation)
+ then
+ Make_Aitem_Pragma
+ (Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expr))),
+ Pragma_Name => Name_Part_Of);
+
+ else
+ Error_Msg_NE
+ ("aspect & must apply to a variable or package "
+ & "instantiation", Aspect, Id);
+ end if;
+
-- SPARK_Mode
when Aspect_SPARK_Mode => SPARK_Mode : declare
@@ -2152,7 +2178,8 @@ package body Sem_Ch13 is
-- emulate the behavior of a source pragma.
if Nkind (N) = N_Package_Body then
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma (Aspect, Aitem);
+
Decls := Declarations (N);
if No (Decls) then
@@ -2168,7 +2195,8 @@ package body Sem_Ch13 is
-- declarations to emulate the behavior of a source pragma.
elsif Nkind (N) = N_Package_Declaration then
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma (Aspect, Aitem);
+
Decls := Visible_Declarations (Specification (N));
if No (Decls) then
@@ -2195,7 +2223,8 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_Depends);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
Insert_Delayed_Pragma (Aitem);
goto Continue;
@@ -2213,7 +2242,7 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_Global);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma (Aspect, Aitem, Delayed => True);
Insert_Delayed_Pragma (Aitem);
goto Continue;
@@ -2245,7 +2274,7 @@ package body Sem_Ch13 is
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Refined_State);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma (Aspect, Aitem);
if No (Decls) then
Decls := New_List;
@@ -2515,7 +2544,8 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Nam);
- Decorate_Delayed_Aspect_And_Pragma (Aspect, Aitem);
+ Decorate_Aspect_And_Pragma
+ (Aspect, Aitem, Delayed => True);
Insert_Delayed_Pragma (Aitem);
goto Continue;
@@ -4774,7 +4804,7 @@ package body Sem_Ch13 is
begin
if Is_Task_Type (U_Ent) then
- -- Check obsolescent (but never obsolescent if from aspect!)
+ -- Check obsolescent (but never obsolescent if from aspect)
if not From_Aspect_Specification (N) then
Check_Restriction (No_Obsolescent_Features, N);
@@ -5362,7 +5392,7 @@ package body Sem_Ch13 is
end;
end if;
- -- We repeat the too late test in case it froze itself!
+ -- We repeat the too late test in case it froze itself
if Rep_Item_Too_Late (Enumtype, N) then
null;
@@ -6765,7 +6795,7 @@ package body Sem_Ch13 is
-- Build the body, we declare the boolean expression before
-- doing the return, because we are not really confident of
- -- what happens if a return appears within a return!
+ -- what happens if a return appears within a return.
BTemp :=
Make_Defining_Identifier (Loc,
@@ -7989,6 +8019,7 @@ package body Sem_Ch13 is
Aspect_Implicit_Dereference |
Aspect_Initial_Condition |
Aspect_Initializes |
+ Aspect_Part_Of |
Aspect_Post |
Aspect_Postcondition |
Aspect_Pre |
@@ -9571,10 +9602,10 @@ package body Sem_Ch13 is
-- on the modified variant part, since its only effect would be
-- to compute the Others_Discrete_Choices node laboriously, and
-- of course we already know the list of choices corresponding
- -- to the others choice (it's the list we're replacing!)
+ -- to the others choice (it's the list we're replacing).
-- We only want to do this if the expander is active, since
- -- we do not want to clobber the ASIS tree!
+ -- we do not want to clobber the ASIS tree.
if Expander_Active then
declare
@@ -11195,7 +11226,7 @@ package body Sem_Ch13 is
-- If we are dealing with private types, then do the check on their
-- fully declared counterparts if the full declarations have been
- -- encountered (they don't have to be visible, but they must exist!)
+ -- encountered (they don't have to be visible, but they must exist).
Source := Ancestor_Subtype (Etype (First_Formal (Act_Unit)));
diff --git a/main/gcc/ada/sem_ch13.ads b/main/gcc/ada/sem_ch13.ads
index 37bf09132ab..edf106ad3ff 100644
--- a/main/gcc/ada/sem_ch13.ads
+++ b/main/gcc/ada/sem_ch13.ads
@@ -306,7 +306,7 @@ package Sem_Ch13 is
-- in these two expressions are the same, by seeing if the two expressions
-- are fully conformant, and if not, issue appropriate error messages.
- -- Quite an awkward approach, but this is an awkard requirement!
+ -- Quite an awkward approach, but this is an awkard requirement
procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id);
-- Analyze all the delayed aspects for entity E at freezing point. This
diff --git a/main/gcc/ada/sem_ch3.adb b/main/gcc/ada/sem_ch3.adb
index 56bd43a0037..817ccb58fba 100644
--- a/main/gcc/ada/sem_ch3.adb
+++ b/main/gcc/ada/sem_ch3.adb
@@ -99,6 +99,7 @@ package body Sem_Ch3 is
-- Async_Writers
-- Effective_Reads
-- Effective_Writes
+ -- Part_Of
procedure Build_Derived_Type
(N : Node_Id;
@@ -2086,12 +2087,6 @@ package body Sem_Ch3 is
-- If the states have visible refinement, remove the visibility of each
-- constituent at the end of the package body declarations.
- function Requires_State_Refinement
- (Spec_Id : Entity_Id;
- Body_Id : Entity_Id) return Boolean;
- -- Determine whether a package denoted by its spec and body entities
- -- requires refinement of abstract states.
-
-----------------
-- Adjust_Decl --
-----------------
@@ -2185,89 +2180,11 @@ package body Sem_Ch3 is
end if;
end Remove_Visible_Refinements;
- -------------------------------
- -- Requires_State_Refinement --
- -------------------------------
-
- function Requires_State_Refinement
- (Spec_Id : Entity_Id;
- Body_Id : Entity_Id) return Boolean
- is
- function Mode_Is_Off (Prag : Node_Id) return Boolean;
- -- Given pragma SPARK_Mode, determine whether the mode is Off
-
- -----------------
- -- Mode_Is_Off --
- -----------------
-
- function Mode_Is_Off (Prag : Node_Id) return Boolean is
- Mode : Node_Id;
-
- begin
- -- The default SPARK mode is On
-
- if No (Prag) then
- return False;
- end if;
-
- Mode :=
- Get_Pragma_Arg (First (Pragma_Argument_Associations (Prag)));
-
- -- Then the pragma lacks an argument, the default mode is On
-
- if No (Mode) then
- return False;
- else
- return Chars (Mode) = Name_Off;
- end if;
- end Mode_Is_Off;
-
- -- Start of processing for Requires_State_Refinement
-
- begin
- -- A package that does not define at least one abstract state cannot
- -- possibly require refinement.
-
- if No (Abstract_States (Spec_Id)) then
- return False;
-
- -- The package instroduces a single null state which does not merit
- -- refinement.
-
- elsif Has_Null_Abstract_State (Spec_Id) then
- return False;
-
- -- Check whether the package body is subject to pragma SPARK_Mode. If
- -- it is and the mode is Off, the package body is considered to be in
- -- regular Ada and does not require refinement.
-
- elsif Mode_Is_Off (SPARK_Pragma (Body_Id)) then
- return False;
-
- -- The body's SPARK_Mode may be inherited from a similar pragma that
- -- appears in the private declarations of the spec. The pragma we are
- -- interested appears as the second entry in SPARK_Pragma.
-
- elsif Present (SPARK_Pragma (Spec_Id))
- and then Mode_Is_Off (Next_Pragma (SPARK_Pragma (Spec_Id)))
- then
- return False;
-
- -- The spec defines at least one abstract state and the body has no
- -- way of circumventing the refinement.
-
- else
- return True;
- end if;
- end Requires_State_Refinement;
-
-- Local variables
- Body_Id : Entity_Id;
Context : Node_Id;
Freeze_From : Entity_Id := Empty;
Next_Decl : Node_Id;
- Prag : Node_Id;
Spec_Id : Entity_Id;
Body_Seen : Boolean := False;
@@ -2415,54 +2332,21 @@ package body Sem_Ch3 is
Decl := Next_Decl;
end loop;
+ -- Analyze the contracts of packages and their bodies
+
if Present (L) then
Context := Parent (L);
- -- Analyze pragmas Initializes and Initial_Condition of a package at
- -- the end of the visible declarations as the pragmas have visibility
- -- over the said region.
-
if Nkind (Context) = N_Package_Specification
and then L = Visible_Declarations (Context)
then
- Spec_Id := Defining_Entity (Parent (Context));
- Prag := Get_Pragma (Spec_Id, Pragma_Initializes);
-
- if Present (Prag) then
- Analyze_Initializes_In_Decl_Part (Prag);
- end if;
-
- Prag := Get_Pragma (Spec_Id, Pragma_Initial_Condition);
-
- if Present (Prag) then
- Analyze_Initial_Condition_In_Decl_Part (Prag);
- end if;
-
- -- Analyze the state refinements within a package body now, after
- -- all hidden states have been encountered and freely visible.
- -- Refinements must be processed before pragmas Refined_Depends and
- -- Refined_Global because the last two may mention constituents.
+ Analyze_Package_Contract (Defining_Entity (Context));
elsif Nkind (Context) = N_Package_Body then
In_Package_Body := True;
-
- Body_Id := Defining_Entity (Context);
Spec_Id := Corresponding_Spec (Context);
- Prag := Get_Pragma (Body_Id, Pragma_Refined_State);
-
- -- The analysis of pragma Refined_State detects whether the spec
- -- has abstract states available for refinement.
-
- if Present (Prag) then
- Analyze_Refined_State_In_Decl_Part (Prag);
-
- -- State refinement is required when the package declaration has
- -- abstract states. Null states are not considered.
- elsif Requires_State_Refinement (Spec_Id, Body_Id) then
- Error_Msg_NE
- ("package & requires state refinement", Context, Spec_Id);
- end if;
+ Analyze_Package_Body_Contract (Defining_Entity (Context));
end if;
end if;
@@ -2472,14 +2356,14 @@ package body Sem_Ch3 is
Decl := First (L);
while Present (Decl) loop
- if Nkind (Decl) = N_Subprogram_Body then
+ if Nkind (Decl) = N_Object_Declaration then
+ Analyze_Object_Contract (Defining_Entity (Decl));
+
+ elsif Nkind (Decl) = N_Subprogram_Body then
Analyze_Subprogram_Body_Contract (Defining_Entity (Decl));
elsif Nkind (Decl) = N_Subprogram_Declaration then
Analyze_Subprogram_Contract (Defining_Entity (Decl));
-
- elsif Nkind (Decl) = N_Object_Declaration then
- Analyze_Object_Contract (Defining_Entity (Decl));
end if;
Next (Decl);
@@ -3078,8 +2962,6 @@ package body Sem_Ch3 is
AW_Val : Boolean := False;
ER_Val : Boolean := False;
EW_Val : Boolean := False;
- Items : Node_Id;
- Nam : Name_Id;
Prag : Node_Id;
Seen : Boolean := False;
@@ -3127,45 +3009,50 @@ package body Sem_Ch3 is
end if;
end if;
- -- Examine the contract
+ -- Analyze all external properties
- Items := Contract (Obj_Id);
+ Prag := Get_Pragma (Obj_Id, Pragma_Async_Readers);
- if Present (Items) then
-
- -- Analyze classification pragmas
+ if Present (Prag) then
+ Analyze_External_Property_In_Decl_Part (Prag, AR_Val);
+ Seen := True;
+ end if;
- Prag := Classifications (Items);
- while Present (Prag) loop
- Nam := Pragma_Name (Prag);
+ Prag := Get_Pragma (Obj_Id, Pragma_Async_Writers);
- if Nam = Name_Async_Readers then
- Analyze_External_Property_In_Decl_Part (Prag, AR_Val);
- Seen := True;
+ if Present (Prag) then
+ Analyze_External_Property_In_Decl_Part (Prag, AW_Val);
+ Seen := True;
+ end if;
- elsif Nam = Name_Async_Writers then
- Analyze_External_Property_In_Decl_Part (Prag, AW_Val);
- Seen := True;
+ Prag := Get_Pragma (Obj_Id, Pragma_Effective_Reads);
- elsif Nam = Name_Effective_Reads then
- Analyze_External_Property_In_Decl_Part (Prag, ER_Val);
- Seen := True;
+ if Present (Prag) then
+ Analyze_External_Property_In_Decl_Part (Prag, ER_Val);
+ Seen := True;
+ end if;
- else pragma Assert (Nam = Name_Effective_Writes);
- Analyze_External_Property_In_Decl_Part (Prag, EW_Val);
- Seen := True;
- end if;
+ Prag := Get_Pragma (Obj_Id, Pragma_Effective_Writes);
- Prag := Next_Pragma (Prag);
- end loop;
+ if Present (Prag) then
+ Analyze_External_Property_In_Decl_Part (Prag, EW_Val);
+ Seen := True;
end if;
- -- Once all external properties have been processed, verify their
- -- mutual interaction.
+ -- Verify the mutual interaction of the various external properties
if Seen then
Check_External_Properties (Obj_Id, AR_Val, AW_Val, ER_Val, EW_Val);
end if;
+
+ -- Check whether the lack of indicator Part_Of agrees with the
+ -- placement of the variable with respect to the state space.
+
+ Prag := Get_Pragma (Obj_Id, Pragma_Part_Of);
+
+ if No (Prag) then
+ Check_Missing_Part_Of (Obj_Id);
+ end if;
end if;
end Analyze_Object_Contract;
@@ -3990,7 +3877,7 @@ package body Sem_Ch3 is
-- If not library level entity, then indicate we don't know max
-- tasks and also check task hierarchy restriction and blocking
- -- operation (since starting a task is definitely blocking!)
+ -- operation (since starting a task is definitely blocking).
else
Check_Restriction (Max_Tasks, N);
@@ -4117,7 +4004,7 @@ package body Sem_Ch3 is
-- common destination for legal and illegal object declarations.
if Ekind (Id) = E_Variable then
- Set_Refined_State (Id, Empty);
+ Set_Encapsulating_State (Id, Empty);
end if;
if Has_Aspects (N) then
@@ -4855,7 +4742,7 @@ package body Sem_Ch3 is
-- record.
elsif Ekind (Scope (Id)) /= E_Protected_Type
- and then Present (Scope (Scope (Id))) -- error defense!
+ and then Present (Scope (Scope (Id))) -- error defense
and then Ekind (Scope (Scope (Id))) /= E_Protected_Type
then
Conditional_Delay (Id, T);
@@ -9258,8 +9145,8 @@ package body Sem_Ch3 is
-- be unanalyzed at this point? and if it is, what business do we
-- have messing around with it? and why is the base type of the
-- parent type the right type for the resolution. It probably is
- -- not! It is OK for the new bound we are creating, but not for
- -- the old one??? Still if it never happens, no problem!
+ -- not. It is OK for the new bound we are creating, but not for
+ -- the old one??? Still if it never happens, no problem.
Analyze_And_Resolve (Bound, Base_Type (Par_T));
@@ -10793,7 +10680,7 @@ package body Sem_Ch3 is
Set_Is_Itype (Full);
-- A subtype of a private-type-without-discriminants, whose full-view
- -- has discriminants with default expressions, is not constrained!
+ -- has discriminants with default expressions, is not constrained.
if not Has_Discriminants (Priv) then
Set_Is_Constrained (Full, Is_Constrained (Full_Base));
@@ -12179,7 +12066,7 @@ package body Sem_Ch3 is
procedure Fixup_Bad_Constraint;
-- This is called after finding a bad constraint, and after having
-- posted an appropriate error message. The mission is to leave the
- -- entity T in as reasonable state as possible!
+ -- entity T in as reasonable state as possible.
--------------------------
-- Fixup_Bad_Constraint --
@@ -12354,7 +12241,7 @@ package body Sem_Ch3 is
-- Check that digits value is in range. Obviously we can do this
-- at compile time, but it is strictly a runtime check, and of
- -- course there is an ACVC test that checks this!
+ -- course there is an ACVC test that checks this.
if Digits_Value (Def_Id) > Digits_Value (T) then
Error_Msg_Uint_1 := Digits_Value (T);
@@ -12581,7 +12468,7 @@ package body Sem_Ch3 is
-- Check that delta value is in range. Obviously we can do this
-- at compile time, but it is strictly a runtime check, and of
- -- course there is an ACVC test that checks this!
+ -- course there is an ACVC test that checks this.
if Delta_Value (Def_Id) < Delta_Value (T) then
Error_Msg_N ("??delta value is too small", D);
@@ -12957,7 +12844,7 @@ package body Sem_Ch3 is
-- Set the parent so we have a proper link for freezing etc. This is
-- not a real parent pointer, since of course our parent does not own
-- up to us and reference us, we are an illegitimate child of the
- -- original parent!
+ -- original parent.
Set_Parent (New_Compon, Parent (Old_Compon));
@@ -17458,7 +17345,7 @@ package body Sem_Ch3 is
begin
-- If the mod expression is (exactly) 2 * literal, where literal is
- -- 64 or less,then almost certainly the * was meant to be **. Warn!
+ -- 64 or less,then almost certainly the * was meant to be **. Warn.
if Warn_On_Suspicious_Modulus_Value
and then Nkind (Mod_Expr) = N_Op_Multiply
@@ -17504,7 +17391,7 @@ package body Sem_Ch3 is
-- Properly analyze the literals for the range. We do this manually
-- because we can't go calling Resolve, since we are resolving these
- -- bounds with the type, and this type is certainly not complete yet!
+ -- bounds with the type, and this type is certainly not complete yet.
Set_Etype (Low_Bound (Scalar_Range (T)), T);
Set_Etype (High_Bound (Scalar_Range (T)), T);
diff --git a/main/gcc/ada/sem_ch4.adb b/main/gcc/ada/sem_ch4.adb
index 51e7f090b19..abcec64c973 100644
--- a/main/gcc/ada/sem_ch4.adb
+++ b/main/gcc/ada/sem_ch4.adb
@@ -589,8 +589,8 @@ package body Sem_Ch4 is
N_Index_Or_Discriminant_Constraint
then
Error_Msg_N -- CODEFIX
- ("if qualified expression was meant, " &
- "use apostrophe!", Constraint (E));
+ ("if qualified expression was meant, "
+ & "use apostrophe!", Constraint (E));
end if;
E := New_Occurrence_Of (Def_Id, Loc);
@@ -1247,33 +1247,33 @@ package body Sem_Ch4 is
if Is_Signed_Integer_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Integer_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Integer_'I'O!", Nam);
elsif Is_Modular_Integer_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Modular_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Modular_'I'O!", Nam);
elsif Is_Floating_Point_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Float_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Float_'I'O!", Nam);
elsif Is_Ordinary_Fixed_Point_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Fixed_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Fixed_'I'O!", Nam);
elsif Is_Decimal_Fixed_Point_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Decimal_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Decimal_'I'O!", Nam);
elsif Is_Enumeration_Type (Typ) then
Error_Msg_N
- ("possible missing instantiation of " &
- "'Text_'I'O.'Enumeration_'I'O!", Nam);
+ ("possible missing instantiation of "
+ & "'Text_'I'O.'Enumeration_'I'O!", Nam);
end if;
end;
end if;
@@ -3273,9 +3273,9 @@ package body Sem_Ch4 is
Defining_Identifier
(Associated_Node_For_Itype (Nam));
begin
- Error_Msg_NE (
- "\\ =='> in call to dereference of !",
- Actual, Access_To_Subprogram_Typ);
+ Error_Msg_NE
+ ("\\ =='> in call to dereference of !",
+ Actual, Access_To_Subprogram_Typ);
end;
else
@@ -3940,10 +3940,10 @@ package body Sem_Ch4 is
-- In an instance, a component of a private extension may not be visible
-- while it was visible in the generic. Search candidate scope for a
-- component with the proper identifier. This is only done if all other
- -- searches have failed. When the match is found (it always will be),
- -- the Etype of both N and Sel are set from this component, and the
- -- entity of Sel is set to reference this component.
- -- ??? no longer true that a match is found ???
+ -- searches have failed. If a match is found, the Etype of both N and
+ -- Sel are set from this component, and the entity of Sel is set to
+ -- reference this component. If no match is found, Entity (Sel) remains
+ -- unset.
function Has_Mode_Conformant_Spec (Comp : Entity_Id) return Boolean;
-- It is known that the parent of N denotes a subprogram call. Comp
@@ -3972,7 +3972,9 @@ package body Sem_Ch4 is
Next_Component (Comp);
end loop;
- -- Need comment on what is going on when we fall through ???
+ -- If we fall through, no match, so no changes made
+
+ return;
end Find_Component_In_Instance;
------------------------------
@@ -5345,7 +5347,7 @@ package body Sem_Ch4 is
begin
-- All the components of the prefix of selector Sel are matched against
-- Sel and a count is maintained of possible misspellings. When at
- -- the end of the analysis there are one or two (not more!) possible
+ -- the end of the analysis there are one or two (not more) possible
-- misspellings, these misspellings will be suggested as possible
-- correction.
@@ -5890,6 +5892,9 @@ package body Sem_Ch4 is
-- In Ada 2005, the equality on anonymous access types is declared
-- in Standard, and is always visible.
+ -- In an instance, the type may have been immediately visible.
+ -- Either the types are compatible, or one operand is universal
+ -- (numeric or null).
elsif In_Open_Scopes (Scope (Bas))
or else Is_Potentially_Use_Visible (Bas)
@@ -5898,6 +5903,7 @@ package body Sem_Ch4 is
or else (In_Instance
and then
(First_Subtype (T1) = First_Subtype (Etype (R))
+ or else Nkind (R) = N_Null
or else
(Is_Numeric_Type (T1)
and then Is_Universal_Numeric_Type (Etype (R)))))
diff --git a/main/gcc/ada/sem_ch5.adb b/main/gcc/ada/sem_ch5.adb
index 590d8ab1788..a7cf878b33f 100644
--- a/main/gcc/ada/sem_ch5.adb
+++ b/main/gcc/ada/sem_ch5.adb
@@ -180,7 +180,7 @@ package body Sem_Ch5 is
end if;
else
- -- If we fall through, we have no special message to issue!
+ -- If we fall through, we have no special message to issue
Error_Msg_N ("left hand side of assignment must be a variable", N);
end if;
@@ -2865,7 +2865,7 @@ package body Sem_Ch5 is
----------------------------
-- Note: the semantics of the null statement is implemented by a single
- -- null statement, too bad everything isn't as simple as this!
+ -- null statement, too bad everything isn't as simple as this.
procedure Analyze_Null_Statement (N : Node_Id) is
pragma Warnings (Off, N);
@@ -2885,7 +2885,7 @@ package body Sem_Ch5 is
-- The labels declared in the statement list are reachable from
-- statements in the list. We do this as a prepass so that any goto
-- statement will be properly flagged if its target is not reachable.
- -- This is not required, but is nice behavior!
+ -- This is not required, but is nice behavior.
S := First (L);
while Present (S) loop
@@ -2989,7 +2989,7 @@ package body Sem_Ch5 is
then
-- Special very annoying exception. If we have a return that
-- follows a raise, then we allow it without a warning, since
- -- the Ada RM annoyingly requires a useless return here!
+ -- the Ada RM annoyingly requires a useless return here.
if Nkind (Original_Node (N)) /= N_Raise_Statement
or else Nkind (Nxt) /= N_Simple_Return_Statement
diff --git a/main/gcc/ada/sem_ch6.adb b/main/gcc/ada/sem_ch6.adb
index 715ca24f58b..a6054ab86db 100644
--- a/main/gcc/ada/sem_ch6.adb
+++ b/main/gcc/ada/sem_ch6.adb
@@ -2999,34 +2999,10 @@ package body Sem_Ch6 is
Push_Scope (Spec_Id);
- -- Set SPARK_Mode
+ -- Set SPARK_Mode from context
- -- For internally generated subprogram, always off. But generic
- -- instances are not generated implicitly, so are never considered
- -- as internal, even though Comes_From_Source is false.
-
- if not Comes_From_Source (Spec_Id)
- and then not Is_Generic_Instance (Spec_Id)
- then
- SPARK_Mode := Off;
- SPARK_Mode_Pragma := Empty;
-
- -- Inherited from spec
-
- elsif Present (SPARK_Pragma (Spec_Id))
- and then not SPARK_Pragma_Inherited (Spec_Id)
- then
- SPARK_Mode_Pragma := SPARK_Pragma (Spec_Id);
- SPARK_Mode := Get_SPARK_Mode_From_Pragma (SPARK_Mode_Pragma);
- Set_SPARK_Pragma (Body_Id, SPARK_Pragma (Spec_Id));
- Set_SPARK_Pragma_Inherited (Body_Id, True);
-
- -- Otherwise set from context
-
- else
- Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
- Set_SPARK_Pragma_Inherited (Body_Id, True);
- end if;
+ Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
+ Set_SPARK_Pragma_Inherited (Body_Id, True);
-- Make sure that the subprogram is immediately visible. For
-- child units that have no separate spec this is indispensable.
@@ -3076,17 +3052,10 @@ package body Sem_Ch6 is
Push_Scope (Body_Id);
- -- Set SPARK_Mode from context or OFF for internal routine
+ -- Set SPARK_Mode from context
- if Comes_From_Source (Body_Id) then
- Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
- Set_SPARK_Pragma_Inherited (Body_Id, True);
- else
- Set_SPARK_Pragma (Body_Id, Empty);
- Set_SPARK_Pragma_Inherited (Body_Id, False);
- SPARK_Mode := Off;
- SPARK_Mode_Pragma := Empty;
- end if;
+ Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
+ Set_SPARK_Pragma_Inherited (Body_Id, True);
end if;
-- For stubs and bodies with no previous spec, generate references to
@@ -3277,6 +3246,34 @@ package body Sem_Ch6 is
Analyze_Declarations (Declarations (N));
+ -- After declarations have been analyzed, the body has been set
+ -- its final value of SPARK_Mode. Check that SPARK_Mode for body
+ -- is consistent with SPARK_Mode for spec.
+
+ if Present (Spec_Id) and then Present (SPARK_Pragma (Body_Id)) then
+ if Present (SPARK_Pragma (Spec_Id)) then
+ if Get_SPARK_Mode_From_Pragma (SPARK_Pragma (Spec_Id)) = Off
+ and then
+ Get_SPARK_Mode_From_Pragma (SPARK_Pragma (Body_Id)) = On
+ then
+ Error_Msg_Sloc := Sloc (SPARK_Pragma (Body_Id));
+ Error_Msg_N ("incorrect application of SPARK_Mode#", N);
+ Error_Msg_Sloc := Sloc (SPARK_Pragma (Spec_Id));
+ Error_Msg_NE
+ ("\value Off was set for SPARK_Mode on", N, Spec_Id);
+ end if;
+
+ elsif Nkind (Parent (Parent (Spec_Id))) = N_Subprogram_Body_Stub then
+ null;
+
+ else
+ Error_Msg_Sloc := Sloc (SPARK_Pragma (Body_Id));
+ Error_Msg_N ("incorrect application of SPARK_Mode#", N);
+ Error_Msg_Sloc := Sloc (Spec_Id);
+ Error_Msg_NE ("\no value was set for SPARK_Mode on", N, Spec_Id);
+ end if;
+ end if;
+
-- Check completion, and analyze the statements
Check_Completion;
@@ -3350,12 +3347,11 @@ package body Sem_Ch6 is
-- the body of the procedure. But first we deal with a special case
-- where we want to modify this check. If the body of the subprogram
-- starts with a raise statement or its equivalent, or if the body
- -- consists entirely of a null statement, then it is pretty obvious
- -- that it is OK to not reference the parameters. For example, this
- -- might be the following common idiom for a stubbed function:
- -- statement of the procedure raises an exception. In particular this
- -- deals with the common idiom of a stubbed function, which might
- -- appear as something like:
+ -- consists entirely of a null statement, then it is pretty obvious that
+ -- it is OK to not reference the parameters. For example, this might be
+ -- the following common idiom for a stubbed function: statement of the
+ -- procedure raises an exception. In particular this deals with the
+ -- common idiom of a stubbed function, which appears something like:
-- function F (A : Integer) return Some_Type;
-- X : Some_Type;
@@ -3366,7 +3362,7 @@ package body Sem_Ch6 is
-- Here the purpose of X is simply to satisfy the annoying requirement
-- in Ada that there be at least one return, and we certainly do not
- -- want to go posting warnings on X that it is not initialized! On
+ -- want to go posting warnings on X that it is not initialized. On
-- the other hand, if X is entirely unreferenced that should still
-- get a warning.
@@ -3632,16 +3628,11 @@ package body Sem_Ch6 is
Generate_Definition (Designator);
- -- Set SPARK mode, always off for internal routines, otherwise set
- -- from current context (may be overwritten later with explicit pragma)
+ -- Set SPARK mode from current context (may be overwritten later with
+ -- explicit pragma).
- if Comes_From_Source (Designator) then
- Set_SPARK_Pragma (Designator, SPARK_Mode_Pragma);
- Set_SPARK_Pragma_Inherited (Designator, True);
- else
- Set_SPARK_Pragma (Designator, Empty);
- Set_SPARK_Pragma_Inherited (Designator, False);
- end if;
+ Set_SPARK_Pragma (Designator, SPARK_Mode_Pragma);
+ Set_SPARK_Pragma_Inherited (Designator, True);
if Debug_Flag_C then
Write_Str ("==> subprogram spec ");
@@ -3656,12 +3647,12 @@ package body Sem_Ch6 is
New_Overloaded_Entity (Designator);
Check_Delayed_Subprogram (Designator);
- -- If the type of the first formal of the current subprogram is a
- -- non-generic tagged private type, mark the subprogram as being a
- -- private primitive. Ditto if this is a function with controlling
- -- result, and the return type is currently private. In both cases,
- -- the type of the controlling argument or result must be in the
- -- current scope for the operation to be primitive.
+ -- If the type of the first formal of the current subprogram is a non-
+ -- generic tagged private type, mark the subprogram as being a private
+ -- primitive. Ditto if this is a function with controlling result, and
+ -- the return type is currently private. In both cases, the type of the
+ -- controlling argument or result must be in the current scope for the
+ -- operation to be primitive.
if Has_Controlling_Result (Designator)
and then Is_Private_Type (Etype (Designator))
@@ -4550,7 +4541,7 @@ package body Sem_Ch6 is
-- Emit a warning if this is a call to a runtime subprogram
-- which is located inside a generic. Previously this call
- -- was silently skipped!
+ -- was silently skipped.
if Is_Generic_Instance (Subp) then
declare
@@ -5293,7 +5284,7 @@ package body Sem_Ch6 is
-- Compiling with optimizations enabled
else
- -- Procedures are never frontend inlined in this case!
+ -- Procedures are never frontend inlined in this case
if Ekind (Subp) /= E_Function then
return False;
@@ -5680,7 +5671,7 @@ package body Sem_Ch6 is
end;
end if;
- -- Build the body to inline only if really needed!
+ -- Build the body to inline only if really needed
if Check_Body_To_Inline (N, Spec_Id)
and then Serious_Errors_Detected = 0
@@ -5890,7 +5881,7 @@ package body Sem_Ch6 is
-- Note: we use the entity information, rather than going directly
-- to the specification in the tree. This is not only simpler, but
-- absolutely necessary for some cases of conformance tests between
- -- operators, where the declaration tree simply does not exist!
+ -- operators, where the declaration tree simply does not exist.
Old_Formal := First_Formal (Old_Id);
New_Formal := First_Formal (New_Id);
@@ -7239,7 +7230,7 @@ package body Sem_Ch6 is
-- Note: if both ECA and DCA are missing the return, then we
-- post only one message, should be enough to fix the bugs.
-- If not we will get a message next time on the DCA when the
- -- ECA is fixed!
+ -- ECA is fixed.
elsif No (Statements (DCA)) then
Last_Stm := DCA;
@@ -8671,7 +8662,7 @@ package body Sem_Ch6 is
end if;
-- Compare two lists, skipping rewrite insertions (we want to compare
- -- the original trees, not the expanded versions!)
+ -- the original trees, not the expanded versions).
loop
if Is_Rewrite_Insertion (N1) then
@@ -8727,7 +8718,7 @@ package body Sem_Ch6 is
begin
-- Non-conformant if paren count does not match. Note: if some idiot
-- complains that we don't do this right for more than 3 levels of
- -- parentheses, they will be treated with the respect they deserve!
+ -- parentheses, they will be treated with the respect they deserve.
if Paren_Count (E1) /= Paren_Count (E2) then
return False;
@@ -11403,7 +11394,7 @@ package body Sem_Ch6 is
AS_Needed := False;
-- If we have unknown discriminants, then we do not need an actual
- -- subtype, or more accurately we cannot figure it out! Note that
+ -- subtype, or more accurately we cannot figure it out. Note that
-- all class-wide types have unknown discriminants.
elsif Has_Unknown_Discriminants (T) then
diff --git a/main/gcc/ada/sem_ch7.adb b/main/gcc/ada/sem_ch7.adb
index 5ae4aa360dd..4b3b613e8da 100644
--- a/main/gcc/ada/sem_ch7.adb
+++ b/main/gcc/ada/sem_ch7.adb
@@ -174,6 +174,31 @@ package body Sem_Ch7 is
end if;
end Analyze_Package_Body;
+ -----------------------------------
+ -- Analyze_Package_Body_Contract --
+ -----------------------------------
+
+ procedure Analyze_Package_Body_Contract (Body_Id : Entity_Id) is
+ Spec_Id : constant Entity_Id := Spec_Entity (Body_Id);
+ Prag : Node_Id;
+
+ begin
+ Prag := Get_Pragma (Body_Id, Pragma_Refined_State);
+
+ -- The analysis of pragma Refined_State detects whether the spec has
+ -- abstract states available for refinement.
+
+ if Present (Prag) then
+ Analyze_Refined_State_In_Decl_Part (Prag);
+
+ -- State refinement is required when the package declaration has
+ -- abstract states. Null states are not considered.
+
+ elsif Requires_State_Refinement (Spec_Id, Body_Id) then
+ Error_Msg_N ("package & requires state refinement", Spec_Id);
+ end if;
+ end Analyze_Package_Body_Contract;
+
---------------------------------
-- Analyze_Package_Body_Helper --
---------------------------------
@@ -346,28 +371,20 @@ package body Sem_Ch7 is
Push_Scope (Spec_Id);
- -- Set SPARK_Mode from private part of spec if it has a SPARK pragma.
- -- Note that in the default case, SPARK_Aux_Pragma will be a copy of
- -- SPARK_Pragma in the spec, so this properly handles the case where
- -- there is no explicit SPARK_Pragma mode in the private part.
+ -- Set SPARK_Mode only for non-generic package
- if Present (SPARK_Pragma (Spec_Id)) then
- SPARK_Mode_Pragma := SPARK_Aux_Pragma (Spec_Id);
- SPARK_Mode := Get_SPARK_Mode_From_Pragma (SPARK_Mode_Pragma);
- Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
- Set_SPARK_Pragma_Inherited (Body_Id, True);
+ if Ekind (Spec_Id) = E_Package then
- -- Otherwise set from context
+ -- Set SPARK_Mode from context
- else
Set_SPARK_Pragma (Body_Id, SPARK_Mode_Pragma);
Set_SPARK_Pragma_Inherited (Body_Id, True);
- end if;
- -- Set elaboration code SPARK mode the same for now
+ -- Set elaboration code SPARK mode the same for now
- Set_SPARK_Aux_Pragma (Body_Id, SPARK_Pragma (Body_Id));
- Set_SPARK_Aux_Pragma_Inherited (Body_Id, True);
+ Set_SPARK_Aux_Pragma (Body_Id, SPARK_Pragma (Body_Id));
+ Set_SPARK_Aux_Pragma_Inherited (Body_Id, True);
+ end if;
Set_Categorization_From_Pragmas (N);
@@ -400,6 +417,32 @@ package body Sem_Ch7 is
Inspect_Deferred_Constant_Completion (Declarations (N));
end if;
+ -- After declarations have been analyzed, the body has been set to have
+ -- the final value of SPARK_Mode. Check that the SPARK_Mode for the body
+ -- is consistent with the SPARK_Mode for the spec.
+
+ if Present (SPARK_Pragma (Body_Id)) then
+ if Present (SPARK_Aux_Pragma (Spec_Id)) then
+ if Get_SPARK_Mode_From_Pragma (SPARK_Aux_Pragma (Spec_Id)) = Off
+ and then
+ Get_SPARK_Mode_From_Pragma (SPARK_Pragma (Body_Id)) = On
+ then
+ Error_Msg_Sloc := Sloc (SPARK_Pragma (Body_Id));
+ Error_Msg_N ("incorrect application of SPARK_Mode#", N);
+ Error_Msg_Sloc := Sloc (SPARK_Aux_Pragma (Spec_Id));
+ Error_Msg_NE
+ ("\value Off was set for SPARK_Mode on & #", N, Spec_Id);
+ end if;
+
+ else
+ Error_Msg_Sloc := Sloc (SPARK_Pragma (Body_Id));
+ Error_Msg_N ("incorrect application of SPARK_Mode#", N);
+ Error_Msg_Sloc := Sloc (Spec_Id);
+ Error_Msg_NE
+ ("\no value was set for SPARK_Mode on & #", N, Spec_Id);
+ end if;
+ end if;
+
-- Analyze_Declarations has caused freezing of all types. Now generate
-- bodies for RACW primitives and stream attributes, if any.
@@ -522,12 +565,13 @@ package body Sem_Ch7 is
function Has_Referencer
(L : List_Id;
Outer : Boolean) return Boolean;
- -- Traverse the given list of declarations in reverse order.
- -- Return True if a referencer is present. Return False if none is
- -- found. The Outer parameter is True for the outer level call and
- -- False for inner level calls for nested packages. If Outer is
- -- True, then any entities up to the point of hitting a referencer
- -- get their Is_Public flag cleared, so that the entities will be
+ -- Traverse given list of declarations in reverse order. Return
+ -- True if a referencer is present. Return False if none is found.
+ --
+ -- The Outer parameter is True for the outer level call and False
+ -- for inner level calls for nested packages. If Outer is True,
+ -- then any entities up to the point of hitting a referencer get
+ -- their Is_Public flag cleared, so that the entities will be
-- treated as static entities in the C sense, and need not have
-- fully qualified names. Furthermore, if the referencer is an
-- inlined subprogram that doesn't reference other subprograms,
@@ -782,6 +826,41 @@ package body Sem_Ch7 is
end if;
end Analyze_Package_Body_Helper;
+ ------------------------------
+ -- Analyze_Package_Contract --
+ ------------------------------
+
+ procedure Analyze_Package_Contract (Pack_Id : Entity_Id) is
+ Prag : Node_Id;
+
+ begin
+ -- Analyze the initialization related pragmas. Initializes must come
+ -- before Initial_Condition due to item dependencies.
+
+ Prag := Get_Pragma (Pack_Id, Pragma_Initializes);
+
+ if Present (Prag) then
+ Analyze_Initializes_In_Decl_Part (Prag);
+ end if;
+
+ Prag := Get_Pragma (Pack_Id, Pragma_Initial_Condition);
+
+ if Present (Prag) then
+ Analyze_Initial_Condition_In_Decl_Part (Prag);
+ end if;
+
+ -- Check whether the lack of indicator Part_Of agrees with the placement
+ -- of the package instantiation with respect to the state space.
+
+ if Is_Generic_Instance (Pack_Id) then
+ Prag := Get_Pragma (Pack_Id, Pragma_Part_Of);
+
+ if No (Prag) then
+ Check_Missing_Part_Of (Pack_Id);
+ end if;
+ end if;
+ end Analyze_Package_Contract;
+
---------------------------------
-- Analyze_Package_Declaration --
---------------------------------
@@ -814,12 +893,14 @@ package body Sem_Ch7 is
Set_Etype (Id, Standard_Void_Type);
Set_Contract (Id, Make_Contract (Sloc (Id)));
- -- Inherit spark mode from context for now
+ -- Set SPARK_Mode from context only for non-generic package
- Set_SPARK_Pragma (Id, SPARK_Mode_Pragma);
- Set_SPARK_Aux_Pragma (Id, SPARK_Mode_Pragma);
- Set_SPARK_Pragma_Inherited (Id, True);
- Set_SPARK_Aux_Pragma_Inherited (Id, True);
+ if Ekind (Id) = E_Package then
+ Set_SPARK_Pragma (Id, SPARK_Mode_Pragma);
+ Set_SPARK_Aux_Pragma (Id, SPARK_Mode_Pragma);
+ Set_SPARK_Pragma_Inherited (Id, True);
+ Set_SPARK_Aux_Pragma_Inherited (Id, True);
+ end if;
-- Analyze aspect specifications immediately, since we need to recognize
-- things like Pure early enough to diagnose violations during analysis.
@@ -1791,6 +1872,15 @@ package body Sem_Ch7 is
end if;
Next_Entity (Prim_Op);
+
+ -- Derived operations appear immediately after the type
+ -- declaration (or the following subtype indication for
+ -- a derived scalar type). Further declarations cannot
+ -- include inherited operations of the type.
+
+ if Present (Prim_Op) then
+ exit when Ekind (Prim_Op) not in Overloadable_Kind;
+ end if;
end loop;
end if;
end if;
@@ -2820,8 +2910,7 @@ package body Sem_Ch7 is
not Is_Null_State (Node (First_Elmt (Abstract_States (P))))
then
Error_Msg_N
- ("?Y?info: & requires body (non-null abstract state aspect)",
- P);
+ ("?Y?info: & requires body (non-null abstract state aspect)", P);
end if;
-- Otherwise search entity chain for entity requiring completion
diff --git a/main/gcc/ada/sem_ch7.ads b/main/gcc/ada/sem_ch7.ads
index 783fc57efa0..b74e4667b4c 100644
--- a/main/gcc/ada/sem_ch7.ads
+++ b/main/gcc/ada/sem_ch7.ads
@@ -32,6 +32,20 @@ package Sem_Ch7 is
procedure Analyze_Package_Specification (N : Node_Id);
procedure Analyze_Private_Type_Declaration (N : Node_Id);
+ procedure Analyze_Package_Body_Contract (Body_Id : Entity_Id);
+ -- Analyze all delayed aspects chained on the contract of package body
+ -- Body_Id as if they appeared at the end of a declarative region. The
+ -- aspects that are considered are:
+ -- Refined_State
+
+ procedure Analyze_Package_Contract (Pack_Id : Entity_Id);
+ -- Analyze all delayed aspects chained on the contract of package Pack_Id
+ -- as if they appeared at the end of a declarative region. The aspects
+ -- that are considered are:
+ -- Initial_Condition
+ -- Initializes
+ -- Part_Of
+
procedure End_Package_Scope (P : Entity_Id);
-- Calls Uninstall_Declarations, and then pops the scope stack
@@ -45,7 +59,7 @@ package Sem_Ch7 is
-- On entrance to a package body, make declarations in package spec
-- immediately visible.
-
+ --
-- When compiling the body of a package, both routines are called in
-- succession. When compiling the body of a child package, the call
-- to Install_Private_Declaration is immediate for private children,
@@ -72,17 +86,16 @@ package Sem_Ch7 is
-- calling stubs.
procedure New_Private_Type (N : Node_Id; Id : Entity_Id; Def : Node_Id);
- -- Common processing for private type declarations and for formal
- -- private type declarations. For private types, N and Def are the type
- -- declaration node; for formal private types, Def is the formal type
- -- definition.
+ -- Common processing for private type declarations and for formal private
+ -- type declarations. For private types, N and Def are the type declaration
+ -- node; for formal private types, Def is the formal type definition.
procedure Uninstall_Declarations (P : Entity_Id);
- -- At the end of a package declaration or body, declarations in the
- -- visible part are no longer immediately visible, and declarations in
- -- the private part are not visible at all. For inner packages, place
- -- visible entities at the end of their homonym chains. For compilation
- -- units, make all entities invisible. In both cases, exchange private
- -- and visible declarations to restore order of elaboration.
+ -- At the end of a package declaration or body, declarations in the visible
+ -- part are no longer immediately visible, and declarations in the private
+ -- part are not visible at all. For inner packages, place visible entities
+ -- at the end of their homonym chains. For compilation units, make
+ -- all entities invisible. In both cases, exchange private and visible
+ -- declarations to restore order of elaboration.
end Sem_Ch7;
diff --git a/main/gcc/ada/sem_ch8.adb b/main/gcc/ada/sem_ch8.adb
index aea2a4d2d05..8a77e4861d6 100644
--- a/main/gcc/ada/sem_ch8.adb
+++ b/main/gcc/ada/sem_ch8.adb
@@ -259,7 +259,7 @@ package body Sem_Ch8 is
-- of use clauses consists in setting this flag on all visible entities
-- defined in the corresponding package. On exit from the scope of the use
-- clause, the corresponding flag must be reset. However, a package may
- -- appear in several nested use clauses (pathological but legal, alas!)
+ -- appear in several nested use clauses (pathological but legal, alas)
-- which forces us to use a slightly more involved scheme:
-- a) The defining occurrence for a package holds a flag -In_Use- to
@@ -1197,7 +1197,7 @@ package body Sem_Ch8 is
-- Initialize the object size and alignment. Note that we used to call
-- Init_Size_Align here, but that's wrong for objects which have only
- -- an Esize, not an RM_Size field!
+ -- an Esize, not an RM_Size field.
Init_Object_Size_Align (Id);
@@ -3333,7 +3333,7 @@ package body Sem_Ch8 is
-- This procedure is called in the context of subprogram renaming, and
-- thus the attribute must be one that is a subprogram. All of those
-- have at least one formal parameter, with the exceptions of AST_Entry
- -- (which is a real oddity, it is odd that this can be renamed at all!)
+ -- (which is a real oddity, it is odd that this can be renamed at all)
-- and the GNAT attribute 'Img, which GNAT treats as renameable.
if not Is_Non_Empty_List (Parameter_Specifications (Spec)) then
@@ -4785,7 +4785,7 @@ package body Sem_Ch8 is
-- If no entries on homonym chain that were potentially visible,
-- and no entities reasonably considered as non-visible, then
-- we have a plain undefined reference, with no additional
- -- explanation required!
+ -- explanation required.
if not Nvis_Entity then
Undefined (Nvis => False);
@@ -5511,7 +5511,7 @@ package body Sem_Ch8 is
-- If this is a selection from a dummy package, then suppress
-- the error message, of course the entity is missing if the
- -- package is missing!
+ -- package is missing.
elsif Sloc (Error_Msg_Node_2) = No_Location then
null;
diff --git a/main/gcc/ada/sem_disp.adb b/main/gcc/ada/sem_disp.adb
index bf4fa8f0379..53aefc9ecbf 100644
--- a/main/gcc/ada/sem_disp.adb
+++ b/main/gcc/ada/sem_disp.adb
@@ -1118,11 +1118,11 @@ package body Sem_Disp is
if Has_Dispatch_Table (Tagged_Type) then
Error_Msg_N
- ("overriding of& is too late for building" &
- " static dispatch tables!", Subp);
+ ("overriding of& is too late for building "
+ & " static dispatch tables!", Subp);
Error_Msg_N
- ("\spec should appear immediately after" &
- " the type!", Subp);
+ ("\spec should appear immediately after "
+ & "the type!", Subp);
end if;
-- No code required to register primitives in VM
@@ -1576,7 +1576,7 @@ package body Sem_Disp is
if Derives_From (Node (Op1)) then
if No (Prev) then
- -- Avoid adding it to the list of primitives if already there!
+ -- Avoid adding it to the list of primitives if already there
if Node (Op2) /= Subp then
Prepend_Elmt (Subp, New_Prim);
@@ -2250,7 +2250,7 @@ package body Sem_Disp is
begin
-- Diagnose failure to match No_Return in parent (Ada-2005, AI-414, but
- -- we do it unconditionally in Ada 95 now, since this is our pragma!)
+ -- we do it unconditionally in Ada 95 now, since this is our pragma).
if No_Return (Prev_Op) and then not No_Return (New_Op) then
Error_Msg_N ("procedure & must have No_Return pragma", New_Op);
diff --git a/main/gcc/ada/sem_elab.adb b/main/gcc/ada/sem_elab.adb
index 8447be198ff..70fc33f01cd 100644
--- a/main/gcc/ada/sem_elab.adb
+++ b/main/gcc/ada/sem_elab.adb
@@ -976,7 +976,7 @@ package body Sem_Elab is
-- elaboration Boolean for the unit containing the entity.
-- Note that for this case, we do check the real unit (the one
- -- from following renamings, since that is the issue!)
+ -- from following renamings, since that is the issue).
-- Could this possibly miss a useless but required PE???
@@ -2043,7 +2043,7 @@ package body Sem_Elab is
-- we go in unconditionally. This is not so terrible, it means the
-- error backtrace is not quite complete, and we are too eager to
-- scan bodies of tasks that are unused, but this is hardly very
- -- significant!
+ -- significant.
elsif Nkind (N) = N_Subprogram_Body
and then Comes_From_Source (N)
diff --git a/main/gcc/ada/sem_elim.adb b/main/gcc/ada/sem_elim.adb
index fdf9ba354c8..c8a07a97f0e 100644
--- a/main/gcc/ada/sem_elim.adb
+++ b/main/gcc/ada/sem_elim.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -408,7 +408,7 @@ package body Sem_Elim is
end if;
-- If given entity is a library level subprogram and pragma had a
- -- single parameter, a match!
+ -- single parameter, a match.
if Is_Compilation_Unit (E)
and then Is_Subprogram (E)
diff --git a/main/gcc/ada/sem_eval.adb b/main/gcc/ada/sem_eval.adb
index 920ee7c8777..4d690217987 100644
--- a/main/gcc/ada/sem_eval.adb
+++ b/main/gcc/ada/sem_eval.adb
@@ -758,7 +758,7 @@ package body Sem_Eval is
end if;
-- If either operand could raise constraint error, then we cannot
- -- know the result at compile time (since CE may be raised!)
+ -- know the result at compile time (since CE may be raised).
if not (Cannot_Raise_Constraint_Error (L)
and then
@@ -1707,7 +1707,7 @@ package body Sem_Eval is
-- Eval_Character_Literal --
----------------------------
- -- Nothing to be done!
+ -- Nothing to be done
procedure Eval_Character_Literal (N : Node_Id) is
pragma Warnings (Off, N);
@@ -2791,7 +2791,7 @@ package body Sem_Eval is
-- will be false because the lengths of one or more index subtypes are
-- compile time known and different, then we can replace the entire
-- result by False. We only do this for one dimensional arrays, because
- -- the case of multi-dimensional arrays is rare and too much trouble! If
+ -- the case of multi-dimensional arrays is rare and too much trouble. If
-- one of the operands is an illegal aggregate, its type might still be
-- an arbitrary composite type, so nothing to do.
@@ -3425,7 +3425,7 @@ package body Sem_Eval is
-- string literal is not marked as static (happens in some cases
-- of folding strings known at compile time, but not static).
-- Furthermore in such cases, we reword the message, since there
- -- is no string literal in the source program!
+ -- is no string literal in the source program.
if Is_Static_Expression (N) then
Apply_Compile_Time_Constraint_Error
@@ -5331,7 +5331,7 @@ package body Sem_Eval is
return In_Range;
-- Never known if not scalar type. Don't know if this can actually
- -- happen, but our spec allows it, so we must check!
+ -- happen, but our spec allows it, so we must check.
elsif not Is_Scalar_Type (Typ) then
return Unknown;
diff --git a/main/gcc/ada/sem_intr.adb b/main/gcc/ada/sem_intr.adb
index ed607ce53c1..4682d250d81 100644
--- a/main/gcc/ada/sem_intr.adb
+++ b/main/gcc/ada/sem_intr.adb
@@ -330,7 +330,7 @@ package body Sem_Intr is
-- We always allow intrinsic specifications in language defined units
-- and in expanded code. We assume that the GNAT implementors know what
- -- they are doing, and do not write or generate junk use of intrinsic!
+ -- they are doing, and do not write or generate junk use of intrinsic.
elsif not Comes_From_Source (E)
or else not Comes_From_Source (N)
@@ -416,7 +416,7 @@ package body Sem_Intr is
return;
end if;
- -- type'Size (not 'Object_Size!) must be one of the allowed values
+ -- type'Size (not 'Object_Size) must be one of the allowed values
Size := UI_To_Int (RM_Size (Typ1));
diff --git a/main/gcc/ada/sem_prag.adb b/main/gcc/ada/sem_prag.adb
index 3ddaed2773c..a3711c8353d 100644
--- a/main/gcc/ada/sem_prag.adb
+++ b/main/gcc/ada/sem_prag.adb
@@ -203,6 +203,15 @@ package body Sem_Prag is
-- _Post, _Invariant, or _Type_Invariant, which are special names used
-- in identifiers to represent these attribute references.
+ procedure Check_State_And_Constituent_Use
+ (States : Elist_Id;
+ Constits : Elist_Id;
+ Context : Node_Id);
+ -- Subsidiary to the analysis of pragmas [Refined_]Depends, [Refined_]
+ -- Global and Initializes. Determine whether a state from list States and a
+ -- corresponding constituent from list Constits (if any) appear in the same
+ -- context denoted by Context. If this is the case, emit an error.
+
procedure Collect_Global_Items
(Prag : Node_Id;
In_Items : in out Elist_Id;
@@ -259,14 +268,6 @@ package body Sem_Prag is
-- Get_SPARK_Mode_Type. Convert a name into a corresponding value of type
-- SPARK_Mode_Type.
- function Is_Part_Of
- (State : Entity_Id;
- Ancestor : Entity_Id) return Boolean;
- -- Subsidiary to the processing of pragma Refined_Depends and pragma
- -- Refined_Global. Determine whether abstract state State is part of an
- -- ancestor abstract state Ancestor. For this relationship to hold, State
- -- must have option Part_Of in its Abstract_State definition.
-
function Is_Unconstrained_Or_Tagged_Item (Item : Entity_Id) return Boolean;
-- Subsidiary to Collect_Subprogram_Inputs_Outputs and the analysis of
-- pragma Depends. Determine whether the type of dependency item Item is
@@ -279,11 +280,13 @@ package body Sem_Prag is
-- spec expressions (i.e. similar to a default expression).
procedure Record_Possible_Body_Reference
- (Item : Node_Id;
- Item_Id : Entity_Id);
- -- Given an entity reference (Item) and the corresponding Entity (Item_Id),
- -- determines if we have a body reference to an abstract state, which may
- -- be illegal if the state is refined within the body.
+ (State_Id : Entity_Id;
+ Ref : Node_Id);
+ -- Subsidiary to the analysis of pragmas [Refined_]Depends and [Refined_]
+ -- Global. Given an abstract state denoted by State_Id and a reference Ref
+ -- to it, determine whether the reference appears in a package body that
+ -- will eventually refine the state. If this is the case, record the
+ -- reference for future checks (see Analyze_Refined_State_In_Decls).
procedure Resolve_State (N : Node_Id);
-- Handle the overloading of state names by functions. When N denotes a
@@ -502,6 +505,11 @@ package body Sem_Prag is
-- The list is populated with unique entities because output items are
-- unique in a dependence relation.
+ Constits_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all constituents processed so far.
+ -- It aids in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma [Refinde_]Depends.
+
Global_Seen : Boolean := False;
-- A flag set when pragma Global has been processed
@@ -514,6 +522,11 @@ package body Sem_Prag is
Spec_Id : Entity_Id;
-- The entity of the subprogram subject to pragma [Refined_]Depends
+ States_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all states processed so far. It
+ -- helps in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma [Refined_]Depends.
+
Subp_Id : Entity_Id;
-- The entity of the subprogram [body or stub] subject to pragma
-- [Refined_]Depends.
@@ -788,8 +801,6 @@ package body Sem_Prag is
Item_Id := Entity_Of (Item);
if Present (Item_Id) then
- Record_Possible_Body_Reference (Item, Item_Id);
-
if Ekind_In (Item_Id, E_Abstract_State,
E_In_Parameter,
E_In_Out_Parameter,
@@ -831,34 +842,27 @@ package body Sem_Prag is
Add_Item (Item_Id, All_Inputs_Seen);
end if;
- if Ekind (Item_Id) = E_Abstract_State then
-
- -- The state acts as a constituent of some other
- -- state. Ensure that the other state is a proper
- -- ancestor of the item.
-
- if Present (Refined_State (Item_Id)) then
- if not Is_Part_Of
- (Item_Id, Refined_State (Item_Id))
- then
- Error_Msg_Name_1 :=
- Chars (Refined_State (Item_Id));
- Error_Msg_NE
- ("state & is not a valid constituent of "
- & "ancestor state %", Item, Item_Id);
- return;
- end if;
+ -- State related checks
- -- An abstract state with visible refinement cannot
- -- appear in pragma [Refined_]Global as its place must
- -- be taken by some of its constituents.
-
- elsif Has_Visible_Refinement (Item_Id) then
+ if Ekind (Item_Id) = E_Abstract_State then
+ if Has_Visible_Refinement (Item_Id) then
Error_Msg_NE
- ("cannot mention state & in global refinement, "
- & "use its constituents instead (SPARK RM "
- & "6.1.5(3))", Item, Item_Id);
+ ("cannot mention state & in global refinement",
+ Item, Item_Id);
+ Error_Msg_N
+ ("\use its constituents instead (SPARK RM "
+ & "6.1.5(3))", Item);
return;
+
+ -- If the reference to the abstract state appears in
+ -- an enclosing package body that will eventually
+ -- refine the state, record the reference for future
+ -- checks.
+
+ else
+ Record_Possible_Body_Reference
+ (State_Id => Item_Id,
+ Ref => Item);
end if;
end if;
@@ -871,6 +875,19 @@ package body Sem_Prag is
Analyze (Item);
end if;
+ -- Add the entity of the current item to the list of
+ -- processed items.
+
+ if Ekind (Item_Id) = E_Abstract_State then
+ Add_Item (Item_Id, States_Seen);
+ end if;
+
+ if Ekind_In (Item_Id, E_Abstract_State, E_Variable)
+ and then Present (Encapsulating_State (Item_Id))
+ then
+ Add_Item (Item_Id, Constits_Seen);
+ end if;
+
-- All other input/output items are illegal
else
@@ -1703,6 +1720,14 @@ package body Sem_Prag is
else
Error_Msg_N ("malformed dependency relation", Clause);
end if;
+
+ -- Ensure that a state and a corresponding constituent do not appear
+ -- together in pragma [Refined_]Depends.
+
+ Check_State_And_Constituent_Use
+ (States => States_Seen,
+ Constits => Constits_Seen,
+ Context => N);
end Analyze_Depends_In_Decl_Part;
--------------------------------------------
@@ -1761,6 +1786,11 @@ package body Sem_Prag is
---------------------------------
procedure Analyze_Global_In_Decl_Part (N : Node_Id) is
+ Constits_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all constituents processed so far.
+ -- It aids in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma [Refinde_]Global.
+
Seen : Elist_Id := No_Elist;
-- A list containing the entities of all the items processed so far. It
-- plays a role in detecting distinct entities.
@@ -1768,6 +1798,11 @@ package body Sem_Prag is
Spec_Id : Entity_Id;
-- The entity of the subprogram subject to pragma [Refined_]Global
+ States_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all states processed so far. It
+ -- helps in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma [Refined_]Global.
+
Subp_Id : Entity_Id;
-- The entity of the subprogram [body or stub] subject to pragma
-- [Refined_]Global.
@@ -1850,7 +1885,6 @@ package body Sem_Prag is
Item_Id := Entity_Of (Item);
if Present (Item_Id) then
- Record_Possible_Body_Reference (Item, Item_Id);
-- A global item may denote a formal parameter of an enclosing
-- subprogram. Do this check first to provide a better error
@@ -1886,29 +1920,25 @@ package body Sem_Prag is
if Ekind (Item_Id) = E_Abstract_State then
- -- The state acts as a constituent of some other state.
- -- Ensure that the other state is a proper ancestor of the
- -- item.
-
- if Present (Refined_State (Item_Id)) then
- if not Is_Part_Of (Item_Id, Refined_State (Item_Id)) then
- Error_Msg_Name_1 := Chars (Refined_State (Item_Id));
- Error_Msg_NE
- ("state & is not a valid constituent of ancestor "
- & "state %", Item, Item_Id);
- return;
- end if;
-
-- An abstract state with visible refinement cannot appear
-- in pragma [Refined_]Global as its place must be taken by
-- some of its constituents.
- elsif Has_Visible_Refinement (Item_Id) then
+ if Has_Visible_Refinement (Item_Id) then
Error_Msg_NE
("cannot mention state & in global refinement, use its "
& "constituents instead (SPARK RM 6.1.4(8))",
Item, Item_Id);
return;
+
+ -- If the reference to the abstract state appears in an
+ -- enclosing package body that will eventually refine the
+ -- state, record the reference for future checks.
+
+ else
+ Record_Possible_Body_Reference
+ (State_Id => Item_Id,
+ Ref => Item);
end if;
-- Variable related checks
@@ -1978,6 +2008,16 @@ package body Sem_Prag is
else
Add_Item (Item_Id, Seen);
+
+ if Ekind (Item_Id) = E_Abstract_State then
+ Add_Item (Item_Id, States_Seen);
+ end if;
+
+ if Ekind_In (Item_Id, E_Abstract_State, E_Variable)
+ and then Present (Encapsulating_State (Item_Id))
+ then
+ Add_Item (Item_Id, Constits_Seen);
+ end if;
end if;
end Analyze_Global_Item;
@@ -2227,6 +2267,14 @@ package body Sem_Prag is
End_Scope;
end if;
end if;
+
+ -- Ensure that a state and a corresponding constituent do not appear
+ -- together in pragma [Refined_]Global.
+
+ Check_State_And_Constituent_Use
+ (States => States_Seen,
+ Constits => Constits_Seen,
+ Context => N);
end Analyze_Global_In_Decl_Part;
--------------------------------------------
@@ -2425,6 +2473,11 @@ package body Sem_Prag is
Pack_Spec : constant Node_Id := Parent (N);
Pack_Id : constant Entity_Id := Defining_Entity (Parent (Pack_Spec));
+ Constits_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all constituents processed so far.
+ -- It aids in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma Initializes.
+
Items_Seen : Elist_Id := No_Elist;
-- A list of all initialization items processed so far. This list is
-- used to detect duplicate items.
@@ -2438,6 +2491,11 @@ package body Sem_Prag is
-- declarations of the related package. This list is used to detect the
-- legality of initialization items.
+ States_Seen : Elist_Id := No_Elist;
+ -- A list containing the entities of all states processed so far. It
+ -- helps in detecting illegal usage of a state and a corresponding
+ -- constituent in pragma Initializes.
+
procedure Analyze_Initialization_Item (Item : Node_Id);
-- Verify the legality of a single initialization item
@@ -2510,6 +2568,14 @@ package body Sem_Prag is
else
Add_Item (Item_Id, Items_Seen);
+
+ if Ekind (Item_Id) = E_Abstract_State then
+ Add_Item (Item_Id, States_Seen);
+ end if;
+
+ if Present (Encapsulating_State (Item_Id)) then
+ Add_Item (Item_Id, Constits_Seen);
+ end if;
end if;
-- The item references something that is not a state or a
@@ -2607,6 +2673,14 @@ package body Sem_Prag is
else
Add_Item (Input_Id, Inputs_Seen);
+
+ if Ekind (Input_Id) = E_Abstract_State then
+ Add_Item (Input_Id, States_Seen);
+ end if;
+
+ if Present (Encapsulating_State (Input_Id)) then
+ Add_Item (Input_Id, Constits_Seen);
+ end if;
end if;
-- The input references something that is not a state or a
@@ -2749,6 +2823,14 @@ package body Sem_Prag is
Next (Init);
end loop;
end if;
+
+ -- Ensure that a state and a corresponding constituent do not appear
+ -- together in pragma Initializes.
+
+ Check_State_And_Constituent_Use
+ (States => States_Seen,
+ Constits => Constits_Seen,
+ Context => N);
end Analyze_Initializes_In_Decl_Part;
--------------------
@@ -2794,6 +2876,17 @@ package body Sem_Prag is
-- In Ada 95 or 05 mode, these are implementation defined pragmas, so
-- should be caught by the No_Implementation_Pragmas restriction.
+ procedure Analyze_Part_Of
+ (Item_Id : Entity_Id;
+ State : Node_Id;
+ Indic : Node_Id;
+ Legal : out Boolean);
+ -- Subsidiary to the analysis of pragmas Abstract_State and Part_Of.
+ -- Perform full analysis of indicator Part_Of. Item_Id is the entity of
+ -- an abstract state, variable or package instantiation. State is the
+ -- encapsulating state. Indic is the Part_Of indicator. Flag Legal is
+ -- set when the indicator is legal.
+
procedure Analyze_Refined_Pragma
(Spec_Id : out Entity_Id;
Body_Id : out Entity_Id;
@@ -3344,6 +3437,124 @@ package body Sem_Prag is
end if;
end Ada_2012_Pragma;
+ ---------------------
+ -- Analyze_Part_Of --
+ ---------------------
+
+ procedure Analyze_Part_Of
+ (Item_Id : Entity_Id;
+ State : Node_Id;
+ Indic : Node_Id;
+ Legal : out Boolean)
+ is
+ Pack_Id : Entity_Id;
+ Placement : State_Space_Kind;
+ State_Id : Entity_Id;
+
+ begin
+ -- Assume that the pragma/option is illegal
+
+ Legal := False;
+
+ Analyze (State);
+ Resolve_State (State);
+
+ if Is_Entity_Name (State)
+ and then Ekind (Entity (State)) = E_Abstract_State
+ then
+ State_Id := Entity (State);
+
+ else
+ Error_Msg_N
+ ("indicator Part_Of must denote an abstract state", State);
+ return;
+ end if;
+
+ -- Determine where the state, variable or the package instantiation
+ -- lives with respect to the enclosing packages or package bodies (if
+ -- any). This placement dictates the legality of the encapsulating
+ -- state.
+
+ Find_Placement_In_State_Space
+ (Item_Id => Item_Id,
+ Placement => Placement,
+ Pack_Id => Pack_Id);
+
+ -- The item appears in a non-package construct with a declarative
+ -- part (subprogram, block, etc). As such, the item is not allowed
+ -- to be a part of an encapsulating state because the item is not
+ -- visible.
+
+ if Placement = Not_In_Package then
+ Error_Msg_N
+ ("indicator Part_Of may not appear in this context (SPARK RM "
+ & "7.2.6(5))", Indic);
+ Error_Msg_Name_1 := Chars (Scope (State_Id));
+ Error_Msg_NE
+ ("\& is not part of the hidden state of package %",
+ Indic, Item_Id);
+
+ -- The item appears in the visible state space of some package. In
+ -- general this scenario does not warrant Part_Of except when the
+ -- package is a private child unit and the encapsulating state is
+ -- declared in a parent unit or a public descendant of that parent
+ -- unit.
+
+ elsif Placement = Visible_State_Space then
+ if Is_Child_Unit (Pack_Id)
+ and then Is_Private_Descendant (Pack_Id)
+ then
+ if not Is_Child_Or_Sibling (Pack_Id, Scope (State_Id)) then
+ Error_Msg_N
+ ("indicator Part_Of must denote an abstract state of "
+ & "parent unit or descendant (SPARK RM 7.2.6(3))", Indic);
+ end if;
+
+ -- Indicator Part_Of is not needed when the related package is not
+ -- a private child unit or a public descendant thereof.
+
+ else
+ Error_Msg_N
+ ("indicator Part_Of may not appear in this context (SPARK "
+ & "RM 7.2.6(5))", Indic);
+ Error_Msg_Name_1 := Chars (Pack_Id);
+ Error_Msg_NE
+ ("\& is declared in the visible part of package %",
+ Indic, Item_Id);
+ end if;
+
+ -- When the item appears in the private state space of a package, the
+ -- encapsulating state must be declared in the same package.
+
+ elsif Placement = Private_State_Space then
+ if Scope (State_Id) /= Pack_Id then
+ Error_Msg_NE
+ ("indicator Part_Of must designate an abstract state of "
+ & "package & (SPARK RM 7.2.6(2))", Indic, Pack_Id);
+ Error_Msg_Name_1 := Chars (Pack_Id);
+ Error_Msg_NE
+ ("\& is declared in the private part of package %",
+ Indic, Item_Id);
+ end if;
+
+ -- Items declared in the body state space of a package do not need
+ -- Part_Of indicators as the refinement has already been seen.
+
+ else
+ Error_Msg_N
+ ("indicator Part_Of may not appear in this context (SPARK RM "
+ & "7.2.6(5))", Indic);
+
+ if Scope (State_Id) = Pack_Id then
+ Error_Msg_Name_1 := Chars (Pack_Id);
+ Error_Msg_NE
+ ("\& is declared in the body of package %", Indic, Item_Id);
+ end if;
+ end if;
+
+ Legal := True;
+ end Analyze_Part_Of;
+
----------------------------
-- Analyze_Refined_Pragma --
----------------------------
@@ -5842,7 +6053,7 @@ package body Sem_Prag is
D := Declaration_Node (E);
K := Nkind (D);
- -- Check duplicate before we chain ourselves!
+ -- Check duplicate before we chain ourselves
Check_Duplicate_Pragma (E);
@@ -6247,7 +6458,7 @@ package body Sem_Prag is
-- for an overridden dispatching operation. Technically this is
-- an amendment and should only be done in Ada 2005 mode. However,
-- this is clearly a mistake, since the problem that is addressed
- -- by this AI is that there is a clear gap in the RM!
+ -- by this AI is that there is a clear gap in the RM.
if Is_Dispatching_Operation (E)
and then Present (Overridden_Operation (E))
@@ -6279,7 +6490,7 @@ package body Sem_Prag is
-- Note: make this unconditional so that if there is more
-- than one call to which the pragma applies, we get a
-- message for each call. Also don't use Error_Pragma,
- -- so that we get multiple messages!
+ -- so that we get multiple messages.
Error_Msg_N
("dispatching subprogram# cannot use Stdcall convention!",
@@ -9620,7 +9831,7 @@ package body Sem_Prag is
-- Abstract_State --
--------------------
- -- pragma Abstract_State (ABSTRACT_STATE_LIST)
+ -- pragma Abstract_State (ABSTRACT_STATE_LIST);
-- ABSTRACT_STATE_LIST ::=
-- null
@@ -9697,6 +9908,9 @@ package body Sem_Prag is
ER_Val : Boolean := False;
EW_Val : Boolean := False;
+ State_Id : Entity_Id := Empty;
+ -- The entity to be generated for the current state declaration
+
procedure Analyze_External_Option (Opt : Node_Id);
-- Verify the legality of option External
@@ -9725,6 +9939,13 @@ package body Sem_Prag is
-- that Prop is not a duplicate property and sets flag Status.
-- Opt is not a duplicate property and sets the flag Status.
+ procedure Create_Abstract_State
+ (State_Nam : Name_Id;
+ Is_Null : Boolean := False);
+ -- Generate an abstract state entity with name State_Nam and
+ -- enter it into visibility. Flag Is_Null should be set when
+ -- the associated Abstract_State pragma defines a null state.
+
-----------------------------
-- Analyze_External_Option --
-----------------------------
@@ -9909,22 +10130,27 @@ package body Sem_Prag is
----------------------------
procedure Analyze_Part_Of_Option (Opt : Node_Id) is
- Par_State : constant Node_Id := Expression (Opt);
+ Encaps : constant Node_Id := Expression (Opt);
+ Encaps_Id : Entity_Id;
+ Legal : Boolean;
begin
Check_Duplicate_Option (Opt, Part_Of_Seen);
- Analyze (Par_State);
+ Analyze_Part_Of
+ (Item_Id => State_Id,
+ State => Encaps,
+ Indic => First (Choices (Opt)),
+ Legal => Legal);
- -- Expression of option Part_Of must denote abstract state
+ -- The Part_Of indicator turns an abstract state into a
+ -- constituent of the encapsulating state.
- if not Is_Entity_Name (Par_State)
- or else No (Entity (Par_State))
- or else Ekind (Entity (Par_State)) /= E_Abstract_State
- then
- Error_Msg_N
- ("option Part_Of must denote an abstract state",
- Par_State);
+ if Legal then
+ Encaps_Id := Entity (Encaps);
+
+ Append_Elmt (State_Id, Part_Of_Constituents (Encaps_Id));
+ Set_Encapsulating_State (State_Id, Encaps_Id);
end if;
end Analyze_Part_Of_Option;
@@ -9963,15 +10189,46 @@ package body Sem_Prag is
Status := True;
end Check_Duplicate_Property;
+ ---------------------------
+ -- Create_Abstract_State --
+ ---------------------------
+
+ procedure Create_Abstract_State
+ (State_Nam : Name_Id;
+ Is_Null : Boolean := False)
+ is
+ begin
+ -- The generated state abstraction reuses the same chars
+ -- from the original state declaration. Decorate the entity.
+
+ State_Id :=
+ Make_Defining_Identifier (Sloc (State),
+ Chars => New_External_Name (State_Nam));
+
+ -- Null states never come from source
+
+ Set_Comes_From_Source (State_Id, not Is_Null);
+ Set_Parent (State_Id, State);
+ Set_Ekind (State_Id, E_Abstract_State);
+ Set_Etype (State_Id, Standard_Void_Type);
+ Set_Encapsulating_State (State_Id, Empty);
+ Set_Refinement_Constituents (State_Id, New_Elmt_List);
+ Set_Part_Of_Constituents (State_Id, New_Elmt_List);
+
+ -- Every non-null state must be nameable and resolvable the
+ -- same way a constant is.
+
+ if not Is_Null then
+ Push_Scope (Pack_Id);
+ Enter_Name (State_Id);
+ Pop_Scope;
+ end if;
+ end Create_Abstract_State;
+
-- Local variables
- Errors : constant Nat := Serious_Errors_Detected;
- Loc : constant Source_Ptr := Sloc (State);
- Is_Null : Boolean := False;
- Opt : Node_Id;
- Opt_Nam : Node_Id;
- State_Id : Entity_Id;
- State_Nam : Name_Id;
+ Opt : Node_Id;
+ Opt_Nam : Node_Id;
-- Start of processing for Analyze_Abstract_State
@@ -9986,8 +10243,9 @@ package body Sem_Prag is
-- Null states appear as internally generated entities
elsif Nkind (State) = N_Null then
- State_Nam := New_Internal_Name ('S');
- Is_Null := True;
+ Create_Abstract_State
+ (State_Nam => New_Internal_Name ('S'),
+ Is_Null => True);
Null_Seen := True;
-- Catch a case where a null state appears in a list of
@@ -10002,7 +10260,7 @@ package body Sem_Prag is
-- Simple state declaration
elsif Nkind (State) = N_Identifier then
- State_Nam := Chars (State);
+ Create_Abstract_State (Chars (State));
Non_Null_Seen := True;
-- State declaration with various options. This construct
@@ -10010,7 +10268,7 @@ package body Sem_Prag is
elsif Nkind (State) = N_Extension_Aggregate then
if Nkind (Ancestor_Part (State)) = N_Identifier then
- State_Nam := Chars (Ancestor_Part (State));
+ Create_Abstract_State (Chars (Ancestor_Part (State)));
Non_Null_Seen := True;
else
Error_Msg_N
@@ -10035,7 +10293,7 @@ package body Sem_Prag is
elsif Chars (Opt) = Name_Part_Of then
Error_Msg_N
- ("option Part_Of must denote an abstract state "
+ ("indicator Part_Of must denote an abstract state "
& "(SPARK RM 7.1.4(9))", Opt);
else
@@ -10077,47 +10335,33 @@ package body Sem_Prag is
Error_Msg_N ("malformed abstract state declaration", State);
end if;
- -- Do not generate a state abstraction entity if it was not
- -- properly declared.
-
- if Serious_Errors_Detected > Errors then
- return;
- end if;
-
- -- The generated state abstraction reuses the same characters
- -- from the original state declaration. Decorate the entity.
+ -- Guard against a junk state. In such cases no entity is
+ -- generated and the subsequent checks cannot be applied.
- State_Id :=
- Make_Defining_Identifier (Loc, New_External_Name (State_Nam));
+ if Present (State_Id) then
- Set_Comes_From_Source (State_Id, not Is_Null);
- Set_Parent (State_Id, State);
- Set_Ekind (State_Id, E_Abstract_State);
- Set_Etype (State_Id, Standard_Void_Type);
- Set_Refined_State (State_Id, Empty);
- Set_Refinement_Constituents (State_Id, New_Elmt_List);
+ -- Verify whether the state does not introduce an illegal
+ -- hidden state within a package subject to a null abstract
+ -- state.
- -- Every non-null state must be nameable and resolvable the
- -- same way a constant is.
+ Check_No_Hidden_State (State_Id);
- if not Is_Null then
- Push_Scope (Pack_Id);
- Enter_Name (State_Id);
- Pop_Scope;
- end if;
+ -- Check whether the lack of option Part_Of agrees with the
+ -- placement of the abstract state with respect to the state
+ -- space.
- -- Verify whether the state introduces an illegal hidden state
- -- within a package subject to a null abstract state.
+ if not Part_Of_Seen then
+ Check_Missing_Part_Of (State_Id);
+ end if;
- Check_No_Hidden_State (State_Id);
+ -- Associate the state with its related package
- -- Associate the state with its related package
+ if No (Abstract_States (Pack_Id)) then
+ Set_Abstract_States (Pack_Id, New_Elmt_List);
+ end if;
- if No (Abstract_States (Pack_Id)) then
- Set_Abstract_States (Pack_Id, New_Elmt_List);
+ Append_Elmt (State_Id, Abstract_States (Pack_Id));
end if;
-
- Append_Elmt (State_Id, Abstract_States (Pack_Id));
end Analyze_Abstract_State;
-- Local variables
@@ -11242,7 +11486,7 @@ package body Sem_Prag is
-- If a giant value is given, Int'Last will do well enough.
-- If sometime someone complains that a record larger than
- -- two gigabytes is not copied, we will worry about it then!
+ -- two gigabytes is not copied, we will worry about it then.
else
Default_C_Record_Mechanism := Mechanism_Type'Last;
@@ -14269,7 +14513,7 @@ package body Sem_Prag is
D := Declaration_Node (E);
K := Nkind (D);
- -- Check duplicate before we chain ourselves!
+ -- Check duplicate before we chain ourselves
Check_Duplicate_Pragma (E);
@@ -14329,7 +14573,7 @@ package body Sem_Prag is
E := Entity (E_Id);
- -- Check duplicate before we chain ourselves!
+ -- Check duplicate before we chain ourselves
Check_Duplicate_Pragma (E);
@@ -16774,6 +17018,212 @@ package body Sem_Prag is
when Pragma_Page =>
null;
+ -------------
+ -- Part_Of --
+ -------------
+
+ -- pragma Part_Of (ABSTRACT_STATE);
+
+ -- ABSTRACT_STATE ::= name
+
+ when Pragma_Part_Of => Part_Of : declare
+ procedure Propagate_Part_Of
+ (Pack_Id : Entity_Id;
+ State_Id : Entity_Id;
+ Instance : Node_Id);
+ -- Propagate the Part_Of indicator to all abstract states and
+ -- variables declared in the visible state space of a package
+ -- denoted by Pack_Id. State_Id is the encapsulating state.
+ -- Instance is the package instantiation node.
+
+ -----------------------
+ -- Propagate_Part_Of --
+ -----------------------
+
+ procedure Propagate_Part_Of
+ (Pack_Id : Entity_Id;
+ State_Id : Entity_Id;
+ Instance : Node_Id)
+ is
+ Has_Item : Boolean := False;
+ -- Flag set when the visible state space contains at least one
+ -- abstract state or variable.
+
+ procedure Propagate_Part_Of (Pack_Id : Entity_Id);
+ -- Propagate the Part_Of indicator to all abstract states and
+ -- variables declared in the visible state space of a package
+ -- denoted by Pack_Id.
+
+ -----------------------
+ -- Propagate_Part_Of --
+ -----------------------
+
+ procedure Propagate_Part_Of (Pack_Id : Entity_Id) is
+ Item_Id : Entity_Id;
+
+ begin
+ -- Traverse the entity chain of the package and set relevant
+ -- attributes of abstract states and variables declared in
+ -- the visible state space of the package.
+
+ Item_Id := First_Entity (Pack_Id);
+ while Present (Item_Id)
+ and then not In_Private_Part (Item_Id)
+ loop
+ -- Do not consider internally generated items
+
+ if not Comes_From_Source (Item_Id) then
+ null;
+
+ -- The Part_Of indicator turns an abstract state or
+ -- variable into a constituent of the encapsulating
+ -- state.
+
+ elsif Ekind_In (Item_Id, E_Abstract_State,
+ E_Variable)
+ then
+ Has_Item := True;
+
+ Append_Elmt (Item_Id, Part_Of_Constituents (State_Id));
+ Set_Encapsulating_State (Item_Id, State_Id);
+
+ -- Recursively handle nested packages and instantiations
+
+ elsif Ekind (Item_Id) = E_Package then
+ Propagate_Part_Of (Item_Id);
+ end if;
+
+ Next_Entity (Item_Id);
+ end loop;
+ end Propagate_Part_Of;
+
+ -- Start of processing for Propagate_Part_Of
+
+ begin
+ Propagate_Part_Of (Pack_Id);
+
+ -- Detect a package instantiation that is subject to a Part_Of
+ -- indicator, but has no visible state.
+
+ if not Has_Item then
+ Error_Msg_NE
+ ("package instantiation & has Part_Of indicator but "
+ & "lacks visible state", Instance, Pack_Id);
+ end if;
+ end Propagate_Part_Of;
+
+ -- Local variables
+
+ Item_Id : Entity_Id;
+ Legal : Boolean;
+ State : Node_Id;
+ State_Id : Entity_Id;
+ Stmt : Node_Id;
+
+ -- Start of processing for Part_Of
+
+ begin
+ GNAT_Pragma;
+ Check_Arg_Count (1);
+
+ -- Ensure the proper placement of the pragma. Part_Of must appear
+ -- on a variable declaration or a package instantiation.
+
+ Stmt := Prev (N);
+ while Present (Stmt) loop
+
+ -- Skip prior pragmas, but check for duplicates
+
+ if Nkind (Stmt) = N_Pragma then
+ if Pragma_Name (Stmt) = Pname then
+ Error_Msg_Name_1 := Pname;
+ Error_Msg_Sloc := Sloc (Stmt);
+ Error_Msg_N ("pragma% duplicates pragma declared#", N);
+ end if;
+
+ -- Skip internally generated code
+
+ elsif not Comes_From_Source (Stmt) then
+ null;
+
+ -- The pragma applies to an object declaration (possibly a
+ -- variable) or a package instantiation. Stop the traversal
+ -- and continue the analysis.
+
+ elsif Nkind_In (Stmt, N_Object_Declaration,
+ N_Package_Instantiation)
+ then
+ exit;
+
+ -- The pragma does not apply to a legal construct, issue an
+ -- error and stop the analysis.
+
+ else
+ Pragma_Misplaced;
+ return;
+ end if;
+
+ Stmt := Prev (Stmt);
+ end loop;
+
+ -- When the context is an object declaration, ensure that we are
+ -- dealing with a variable.
+
+ if Nkind (Stmt) = N_Object_Declaration
+ and then Ekind (Defining_Entity (Stmt)) /= E_Variable
+ then
+ Error_Msg_N ("indicator Part_Of must apply to a variable", N);
+ return;
+ end if;
+
+ -- Extract the entity of the related object declaration or package
+ -- instantiation. In the case of the instantiation, use the entity
+ -- of the instance spec.
+
+ if Nkind (Stmt) = N_Package_Instantiation then
+ Stmt := Instance_Spec (Stmt);
+ end if;
+
+ Item_Id := Defining_Entity (Stmt);
+ State := Get_Pragma_Arg (Arg1);
+
+ -- Detect any discrepancies between the placement of the object
+ -- or package instantiation with respect to state space and the
+ -- encapsulating state.
+
+ Analyze_Part_Of
+ (Item_Id => Item_Id,
+ State => State,
+ Indic => N,
+ Legal => Legal);
+
+ if Legal then
+ State_Id := Entity (State);
+
+ -- Add the pragma to the contract of the item. This aids with
+ -- the detection of a missing but required Part_Of indicator.
+
+ Add_Contract_Item (N, Item_Id);
+
+ -- The Part_Of indicator turns a variable into a constituent
+ -- of the encapsulating state.
+
+ if Ekind (Item_Id) = E_Variable then
+ Append_Elmt (Item_Id, Part_Of_Constituents (State_Id));
+ Set_Encapsulating_State (Item_Id, State_Id);
+
+ -- Propagate the Part_Of indicator to the visible state space
+ -- of the package instantiation.
+
+ else
+ Propagate_Part_Of
+ (Pack_Id => Item_Id,
+ State_Id => State_Id,
+ Instance => Stmt);
+ end if;
+ end if;
+ end Part_Of;
+
----------------------------------
-- Partition_Elaboration_Policy --
----------------------------------
@@ -17441,7 +17891,7 @@ package body Sem_Prag is
else
-- Check overlapping in the priority ranges specified in other
-- Priority_Specific_Dispatching pragmas within the same
- -- partition. We can only check those we know about!
+ -- partition. We can only check those we know about.
for J in
Specific_Dispatching.First .. Specific_Dispatching.Last
@@ -18025,6 +18475,10 @@ package body Sem_Prag is
("pragma % does not mention function result?T?");
end if;
end if;
+
+ -- Chain the pragma on the contract for easy retrieval
+
+ Add_Contract_Item (N, Body_Id);
end if;
end Refined_Post;
@@ -18597,14 +19051,26 @@ package body Sem_Prag is
Spec_Id : Entity_Id;
Stmt : Node_Id;
- procedure Check_Pragma_Conformance (Old_Pragma : Node_Id);
- -- Verify the monotonicity of SPARK modes between the new pragma
- -- N, and the old pragma, Old_Pragma, that was inherited. If
- -- Old_Pragma is Empty, the call has no effect, otherwise we
- -- verify that the new mode is less restrictive than the old mode.
- -- For example, if the old mode is ON, then the new mode can be
- -- anything. But if the old mode is OFF, then the only allowed
- -- new mode is also OFF.
+ procedure Check_Pragma_Conformance
+ (Context_Pragma : Node_Id;
+ Entity_Pragma : Node_Id;
+ Entity : Entity_Id);
+ -- If Context_Pragma is not Empty, verify that the new pragma N
+ -- is compatible with the pragma Context_Pragma that was inherited
+ -- from the context:
+ -- . if Context_Pragma is ON, then the new mode can be anything
+ -- . if Context_Pragma is OFF, then the only allowed new mode is
+ -- also OFF.
+ --
+ -- If Entity is not Empty, verify that the new pragma N is
+ -- compatible with Entity_Pragma, the SPARK_Mode previously set
+ -- for Entity (which may be Empty):
+ -- . if Entity_Pragma is ON, then the new mode can be anything
+ -- . if Entity_Pragma is OFF, then the only allowed new mode is
+ -- also OFF.
+ -- . if Entity_Pragma is Empty, we always issue an error, as this
+ -- corresponds to a case where a previous section of Entity
+ -- had no SPARK_Mode set.
procedure Check_Library_Level_Entity (E : Entity_Id);
-- Verify that pragma is applied to library-level entity E
@@ -18613,20 +19079,47 @@ package body Sem_Prag is
-- Check_Pragma_Conformance --
------------------------------
- procedure Check_Pragma_Conformance (Old_Pragma : Node_Id) is
+ procedure Check_Pragma_Conformance
+ (Context_Pragma : Node_Id;
+ Entity_Pragma : Node_Id;
+ Entity : Entity_Id)
+ is
begin
- if Present (Old_Pragma) then
- pragma Assert (Nkind (Old_Pragma) = N_Pragma);
+ if Present (Context_Pragma) then
+ pragma Assert (Nkind (Context_Pragma) = N_Pragma);
-- New mode less restrictive than the established mode
- if Get_SPARK_Mode_From_Pragma (Old_Pragma) = Off
+ if Get_SPARK_Mode_From_Pragma (Context_Pragma) = Off
and then Mode_Id = On
then
Error_Msg_N
- ("cannot change 'S'P'A'R'K_Mode from Off to On", Arg1);
+ ("cannot change SPARK_Mode from Off to On", Arg1);
Error_Msg_Sloc := Sloc (SPARK_Mode_Pragma);
- Error_Msg_N ("\'S'P'A'R'K_Mode was set to Off#", Arg1);
+ Error_Msg_N ("\SPARK_Mode was set to Off#", Arg1);
+ raise Pragma_Exit;
+ end if;
+ end if;
+
+ if Present (Entity) then
+ if Present (Entity_Pragma) then
+ if Get_SPARK_Mode_From_Pragma (Entity_Pragma) = Off
+ and then Mode_Id = On
+ then
+ Error_Msg_N ("incorrect use of SPARK_Mode", Arg1);
+ Error_Msg_Sloc := Sloc (Entity_Pragma);
+ Error_Msg_NE
+ ("\value Off was set for SPARK_Mode on",
+ Arg1, Entity);
+ raise Pragma_Exit;
+ end if;
+
+ else
+ Error_Msg_N ("incorrect use of SPARK_Mode", Arg1);
+ Error_Msg_Sloc := Sloc (Entity);
+ Error_Msg_NE
+ ("\no value was set for SPARK_Mode on",
+ Arg1, Entity);
raise Pragma_Exit;
end if;
end if;
@@ -18733,7 +19226,10 @@ package body Sem_Prag is
then
Spec_Id := Defining_Entity (Stmt);
Check_Library_Level_Entity (Spec_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Spec_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Spec_Id),
+ Entity_Pragma => Empty,
+ Entity => Empty);
Set_SPARK_Pragma (Spec_Id, N);
Set_SPARK_Pragma_Inherited (Spec_Id, False);
@@ -18748,7 +19244,10 @@ package body Sem_Prag is
then
Spec_Id := Defining_Entity (Stmt);
Check_Library_Level_Entity (Spec_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Spec_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Spec_Id),
+ Entity_Pragma => Empty,
+ Entity => Empty);
Set_SPARK_Pragma (Spec_Id, N);
Set_SPARK_Pragma_Inherited (Spec_Id, False);
@@ -18804,7 +19303,10 @@ package body Sem_Prag is
if List_Containing (N) = Private_Declarations (Context) then
Check_Library_Level_Entity (Spec_Id);
- Check_Pragma_Conformance (SPARK_Aux_Pragma (Spec_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => Empty,
+ Entity_Pragma => SPARK_Pragma (Spec_Id),
+ Entity => Spec_Id);
SPARK_Mode_Pragma := N;
SPARK_Mode := Mode_Id;
@@ -18815,7 +19317,10 @@ package body Sem_Prag is
else
Check_Library_Level_Entity (Spec_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Spec_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Spec_Id),
+ Entity_Pragma => Empty,
+ Entity => Empty);
SPARK_Mode_Pragma := N;
SPARK_Mode := Mode_Id;
@@ -18834,8 +19339,10 @@ package body Sem_Prag is
then
Spec_Id := Defining_Entity (Context);
Check_Library_Level_Entity (Spec_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Spec_Id));
-
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Spec_Id),
+ Entity_Pragma => Empty,
+ Entity => Empty);
Set_SPARK_Pragma (Spec_Id, N);
Set_SPARK_Pragma_Inherited (Spec_Id, False);
@@ -18848,7 +19355,10 @@ package body Sem_Prag is
Spec_Id := Corresponding_Spec (Context);
Body_Id := Defining_Entity (Context);
Check_Library_Level_Entity (Body_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Body_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Body_Id),
+ Entity_Pragma => SPARK_Aux_Pragma (Spec_Id),
+ Entity => Spec_Id);
SPARK_Mode_Pragma := N;
SPARK_Mode := Mode_Id;
@@ -18867,7 +19377,19 @@ package body Sem_Prag is
Context := Specification (Context);
Body_Id := Defining_Entity (Context);
Check_Library_Level_Entity (Body_Id);
- Check_Pragma_Conformance (SPARK_Pragma (Body_Id));
+
+ if Present (Spec_Id) then
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Body_Id),
+ Entity_Pragma => SPARK_Pragma (Spec_Id),
+ Entity => Spec_Id);
+ else
+ Check_Pragma_Conformance
+ (Context_Pragma => SPARK_Pragma (Body_Id),
+ Entity_Pragma => Empty,
+ Entity => Empty);
+ end if;
+
SPARK_Mode_Pragma := N;
SPARK_Mode := Mode_Id;
@@ -18887,7 +19409,10 @@ package body Sem_Prag is
Spec_Id := Corresponding_Spec (Context);
Body_Id := Defining_Entity (Context);
Check_Library_Level_Entity (Body_Id);
- Check_Pragma_Conformance (SPARK_Aux_Pragma (Body_Id));
+ Check_Pragma_Conformance
+ (Context_Pragma => Empty,
+ Entity_Pragma => SPARK_Pragma (Body_Id),
+ Entity => Body_Id);
SPARK_Mode_Pragma := N;
SPARK_Mode := Mode_Id;
@@ -20840,8 +21365,8 @@ package body Sem_Prag is
if Ekind_In (Ref_Id, E_Abstract_State,
E_Variable)
- and then Present (Refined_State (Ref_Id))
- and then Refined_State (Ref_Id) = Dep_Id
+ and then Present (Encapsulating_State (Ref_Id))
+ and then Encapsulating_State (Ref_Id) = Dep_Id
then
Has_Constituent := True;
Remove (Ref_Input);
@@ -21140,8 +21665,8 @@ package body Sem_Prag is
-- per the example above.
if Ekind_In (Ref_Id, E_Abstract_State, E_Variable)
- and then Present (Refined_State (Ref_Id))
- and then Refined_State (Ref_Id) = Dep_Id
+ and then Present (Encapsulating_State (Ref_Id))
+ and then Encapsulating_State (Ref_Id) = Dep_Id
and then Inputs_Match
(Ref_Clause, Do_Checks => False)
then
@@ -21886,7 +22411,7 @@ package body Sem_Prag is
-- The state or variable acts as a constituent of a state, collect
-- it for the state completeness checks performed later on.
- if Present (Refined_State (Item_Id)) then
+ if Present (Encapsulating_State (Item_Id)) then
if Global_Mode = Name_Input then
Add_Item (Item_Id, In_Constits);
@@ -22174,40 +22699,41 @@ package body Sem_Prag is
----------------------------------------
procedure Analyze_Refined_State_In_Decl_Part (N : Node_Id) is
- Pack_Body : constant Node_Id := Parent (N);
- Spec_Id : constant Entity_Id := Corresponding_Spec (Pack_Body);
+ Available_States : Elist_Id := No_Elist;
+ -- A list of all abstract states defined in the package declaration that
+ -- are available for refinement. The list is used to report unrefined
+ -- states.
+
+ Body_Id : Entity_Id;
+ -- The body entity of the package subject to pragma Refined_State
- Abstr_States : Elist_Id := No_Elist;
- -- A list of all abstract states defined in the package declaration. The
- -- list is used to report unrefined states.
+ Body_States : Elist_Id := No_Elist;
+ -- A list of all hidden states that appear in the body of the related
+ -- package. The list is used to report unused hidden states.
Constituents_Seen : Elist_Id := No_Elist;
-- A list that contains all constituents processed so far. The list is
-- used to detect multiple uses of the same constituent.
- Hidden_States : Elist_Id := No_Elist;
- -- A list of all hidden states (abstract states and variables) that
- -- appear in the package spec and body. The list is used to report
- -- unused hidden states.
-
Refined_States_Seen : Elist_Id := No_Elist;
-- A list that contains all refined states processed so far. The list is
-- used to detect duplicate refinements.
+ Spec_Id : Entity_Id;
+ -- The spec entity of the package subject to pragma Refined_State
+
procedure Analyze_Refinement_Clause (Clause : Node_Id);
-- Perform full analysis of a single refinement clause
- procedure Collect_Hidden_States;
- -- Gather the entities of all hidden states that appear in the spec and
- -- body of the related package in Hidden_States.
+ function Collect_Body_States (Pack_Id : Entity_Id) return Elist_Id;
+ -- Gather the entities of all abstract states and variables declared in
+ -- the body state space of package Pack_Id.
- procedure Report_Unrefined_States;
- -- Emit errors for all abstract states that have not been refined by
- -- the pragma.
+ procedure Report_Unrefined_States (States : Elist_Id);
+ -- Emit errors for all unrefined abstract states found in list States
- procedure Report_Unused_Hidden_States;
- -- Emit errors for all hidden states of the related package that do not
- -- participate in a refinement.
+ procedure Report_Unused_States (States : Elist_Id);
+ -- Emit errors for all unused states found in list States
-------------------------------
-- Analyze_Refinement_Clause --
@@ -22231,9 +22757,13 @@ package body Sem_Prag is
-- Flags used to detect multiple uses of null in a single clause or a
-- mixture of null and non-null constituents.
+ Part_Of_Constits : Elist_Id := No_Elist;
+ -- A list of all candidate constituents subject to indicator Part_Of
+ -- where the encapsulating state is the current state.
+
State : Node_Id;
State_Id : Entity_Id;
- -- The state being refined in the current clause
+ -- The current state being refined
procedure Analyze_Constituent (Constit : Node_Id);
-- Perform full analysis of a single constituent
@@ -22248,10 +22778,13 @@ package body Sem_Prag is
-- this is not the case, emit an error message.
procedure Check_Matching_State;
- -- Determine whether the state being refined appears in Abstr_States.
- -- Emit an error when attempting to re-refine the state or when the
- -- state is not defined in the package declaration. Otherwise remove
- -- the state from Abstr_States.
+ -- Determine whether the state being refined appears in list
+ -- Available_States. Emit an error when attempting to re-refine the
+ -- state or when the state is not defined in the package declaration,
+ -- otherwise remove the state from Available_States.
+
+ procedure Report_Unused_Constituents (Constits : Elist_Id);
+ -- Emit errors for all unused Part_Of constituents in list Constits
-------------------------
-- Analyze_Constituent --
@@ -22279,17 +22812,17 @@ package body Sem_Prag is
procedure Collect_Constituent is
begin
- -- Add the constituent to the lis of processed items to aid
+ -- Add the constituent to the list of processed items to aid
-- with the detection of duplicates.
Add_Item (Constit_Id, Constituents_Seen);
- -- Collect the constituent in the list of refinement items.
- -- Establish a relation between the refined state and its
- -- constituent.
+ -- Collect the constituent in the list of refinement items
+ -- and establish a relation between the refined state and
+ -- the item.
Append_Elmt (Constit_Id, Refinement_Constituents (State_Id));
- Set_Refined_State (Constit_Id, State_Id);
+ Set_Encapsulating_State (Constit_Id, State_Id);
-- The state has at least one legal constituent, mark the
-- start of the refinement region. The region ends when the
@@ -22334,70 +22867,59 @@ package body Sem_Prag is
Error_Msg_NE
("duplicate use of constituent &", Constit, Constit_Id);
return;
+ end if;
- -- A state can act as a constituent only when it is part of
- -- another state. This relation is expressed by option Part_Of
- -- of pragma Abstract_State.
+ -- The constituent is subject to a Part_Of indicator
- elsif Ekind (Constit_Id) = E_Abstract_State then
- if not Is_Part_Of (Constit_Id, State_Id) then
- Error_Msg_Name_1 := Chars (State_Id);
- Error_Msg_NE
- ("state & is not a valid constituent of ancestor "
- & "state %", Constit, Constit_Id);
- return;
+ if Present (Encapsulating_State (Constit_Id)) then
+ if Encapsulating_State (Constit_Id) = State_Id then
+ Remove (Part_Of_Constits, Constit_Id);
+ Collect_Constituent;
- -- The constituent has the proper Part_Of option, but may
- -- not appear in the immediate hidden state of the related
- -- package. This case arises when the constituent appears
- -- in a private child or a private sibling. Recognize these
- -- scenarios and collect the constituent.
+ -- The constituent is part of another state and is used
+ -- incorrectly in the refinement of the current state.
- elsif Is_Child_Or_Sibling
- (Pack_1 => Scope (State_Id),
- Pack_2 => Scope (Constit_Id),
- Private_Child => True)
- then
- Collect_Constituent;
- return;
+ else
+ Error_Msg_Name_1 := Chars (State_Id);
+ Error_Msg_NE
+ ("& cannot act as constituent of state %",
+ Constit, Constit_Id);
+ Error_Msg_NE
+ ("\Part_Of indicator specifies & as encapsulating "
+ & "state", Constit, Encapsulating_State (Constit_Id));
end if;
- end if;
-
- -- Inspect the hidden states of the related package looking for
- -- a match.
- if Present (Hidden_States) then
- State_Elmt := First_Elmt (Hidden_States);
- while Present (State_Elmt) loop
+ -- The only other source of legal constituents is the body
+ -- state space of the related package.
- -- A valid hidden state or variable acts as a constituent
+ else
+ if Present (Body_States) then
+ State_Elmt := First_Elmt (Body_States);
+ while Present (State_Elmt) loop
- if Node (State_Elmt) = Constit_Id then
+ -- Consume a valid constituent to signal that it has
+ -- been encountered.
- -- Add the constituent to the lis of processed items
- -- to aid with the detection of duplicates. Remove the
- -- constituent from Hidden_States to signal that it
- -- has already been matched.
+ if Node (State_Elmt) = Constit_Id then
+ Remove_Elmt (Body_States, State_Elmt);
+ Collect_Constituent;
+ return;
+ end if;
- Add_Item (Constit_Id, Constituents_Seen);
- Remove_Elmt (Hidden_States, State_Elmt);
+ Next_Elmt (State_Elmt);
+ end loop;
+ end if;
- Collect_Constituent;
- return;
- end if;
+ -- If we get here, then the constituent is not a hidden
+ -- state of the related package and may not be used in a
+ -- refinement.
- Next_Elmt (State_Elmt);
- end loop;
+ Error_Msg_Name_1 := Chars (Spec_Id);
+ Error_Msg_NE
+ ("cannot use & in refinement, constituent is not a hidden "
+ & "state of package % (SPARK RM 7.2.2(9))",
+ Constit, Constit_Id);
end if;
-
- -- If we get here, we are refining a state that is not hidden
- -- with respect to the related package.
-
- Error_Msg_Name_1 := Chars (Spec_Id);
- Error_Msg_NE
- ("cannot use & in refinement, constituent is not a hidden "
- & "state of package % (SPARK RM 7.2.2(9))",
- Constit, Constit_Id);
end Check_Matching_Constituent;
-- Local variables
@@ -22522,18 +23044,18 @@ package body Sem_Prag is
-- Inspect the abstract states defined in the package declaration
-- looking for a match.
- State_Elmt := First_Elmt (Abstr_States);
+ State_Elmt := First_Elmt (Available_States);
while Present (State_Elmt) loop
-- A valid abstract state is being refined in the body. Add
-- the state to the list of processed refined states to aid
-- with the detection of duplicate refinements. Remove the
- -- state from Abstr_States to signal that it has already been
- -- refined.
+ -- state from Available_States to signal that it has already
+ -- been refined.
if Node (State_Elmt) = State_Id then
Add_Item (State_Id, Refined_States_Seen);
- Remove_Elmt (Abstr_States, State_Elmt);
+ Remove_Elmt (Available_States, State_Elmt);
return;
end if;
@@ -22549,6 +23071,49 @@ package body Sem_Prag is
State, State_Id);
end Check_Matching_State;
+ --------------------------------
+ -- Report_Unused_Constituents --
+ --------------------------------
+
+ procedure Report_Unused_Constituents (Constits : Elist_Id) is
+ Constit_Elmt : Elmt_Id;
+ Constit_Id : Entity_Id;
+ Posted : Boolean := False;
+
+ begin
+ if Present (Constits) then
+ Constit_Elmt := First_Elmt (Constits);
+ while Present (Constit_Elmt) loop
+ Constit_Id := Node (Constit_Elmt);
+
+ -- Generate an error message of the form:
+
+ -- state ... has unused Part_Of constituents
+ -- abstract state ... defined at ...
+ -- variable ... defined at ...
+
+ if not Posted then
+ Posted := True;
+ Error_Msg_NE
+ ("state & has unused Part_Of constituents",
+ State, State_Id);
+ end if;
+
+ Error_Msg_Sloc := Sloc (Constit_Id);
+
+ if Ekind (Constit_Id) = E_Abstract_State then
+ Error_Msg_NE
+ ("\\ abstract state & defined #", State, Constit_Id);
+ else
+ Error_Msg_NE
+ ("\\ variable & defined #", State, Constit_Id);
+ end if;
+
+ Next_Elmt (Constit_Elmt);
+ end loop;
+ end if;
+ end Report_Unused_Constituents;
+
-- Local declarations
Body_Ref : Node_Id;
@@ -22580,20 +23145,23 @@ package body Sem_Prag is
else
Error_Msg_NE
("& must denote an abstract state", State, State_Id);
+ return;
end if;
- -- A global item cannot denote a state abstraction whose
- -- refinement is visible, in other words a state abstraction
- -- cannot be named within its enclosing package's body other than
- -- in its refinement.
+ -- References to a state with visible refinement are illegal. In
+ -- the case where nested packages are involved, detecting such
+ -- references is tricky because pragma Refined_State is analyzed
+ -- later than the offending pragma Depends or Global. References
+ -- that occur in such nested context are stored in a list. Emit
+ -- errors for all references found in Body_References.
- if Has_Body_References (State_Id) then
+ if Present (Body_References (State_Id)) then
Body_Ref_Elmt := First_Elmt (Body_References (State_Id));
while Present (Body_Ref_Elmt) loop
Body_Ref := Node (Body_Ref_Elmt);
Error_Msg_N
- ("global reference to & not allowed (SPARK RM 6.1.4(8))",
+ ("reference to & not allowed (SPARK RM 6.1.4(8))",
Body_Ref);
Error_Msg_Sloc := Sloc (State);
Error_Msg_N ("\refinement of & is visible#", Body_Ref);
@@ -22602,10 +23170,11 @@ package body Sem_Prag is
end loop;
end if;
- -- The state name is illegal
+ -- The state name is illegal
else
Error_Msg_N ("malformed state name in refinement clause", State);
+ return;
end if;
-- A refinement clause may only refine one state at a time
@@ -22617,6 +23186,11 @@ package body Sem_Prag is
("refinement clause cannot cover multiple states", Extra_State);
end if;
+ -- Replicate the Part_Of constituents of the refined state because
+ -- the algorithm will consume items.
+
+ Part_Of_Constits := New_Copy_Elist (Part_Of_Constituents (State_Id));
+
-- Analyze all constituents of the refinement. Multiple constituents
-- appear as an aggregate.
@@ -22697,98 +23271,112 @@ package body Sem_Prag is
("non-external state & cannot contain external constituents in "
& "refinement (SPARK RM 7.2.8(1))", State, State_Id);
end if;
- end Analyze_Refinement_Clause;
- ---------------------------
- -- Collect_Hidden_States --
- ---------------------------
-
- procedure Collect_Hidden_States is
- procedure Collect_Hidden_States_In_Decls (Decls : List_Id);
- -- Find all hidden states that appear in declarative list Decls and
- -- append their entities to Result.
-
- ------------------------------------
- -- Collect_Hidden_States_In_Decls --
- ------------------------------------
+ -- Ensure that all Part_Of candidate constituents have been mentioned
+ -- in the refinement clause.
- procedure Collect_Hidden_States_In_Decls (Decls : List_Id) is
- procedure Collect_Abstract_States (States : Elist_Id);
- -- Copy the abstract states defined in list States to list Result
+ Report_Unused_Constituents (Part_Of_Constits);
+ end Analyze_Refinement_Clause;
- -----------------------------
- -- Collect_Abstract_States --
- -----------------------------
+ -------------------------
+ -- Collect_Body_States --
+ -------------------------
- procedure Collect_Abstract_States (States : Elist_Id) is
- State_Elmt : Elmt_Id;
- begin
- if Present (States) then
- State_Elmt := First_Elmt (States);
- while Present (State_Elmt) loop
- Add_Item (Node (State_Elmt), Hidden_States);
- Next_Elmt (State_Elmt);
- end loop;
- end if;
- end Collect_Abstract_States;
+ function Collect_Body_States (Pack_Id : Entity_Id) return Elist_Id is
+ Result : Elist_Id := No_Elist;
+ -- A list containing all body states of Pack_Id
- -- Local variables
+ procedure Collect_Visible_States (Pack_Id : Entity_Id);
+ -- Gather the entities of all abstract states and variables declared
+ -- in the visible state space of package Pack_Id.
- Decl : Node_Id;
+ ----------------------------
+ -- Collect_Visible_States --
+ ----------------------------
- -- Start of processing for Collect_Hidden_States_In_Decls
+ procedure Collect_Visible_States (Pack_Id : Entity_Id) is
+ Item_Id : Entity_Id;
begin
- Decl := First (Decls);
- while Present (Decl) loop
+ -- Traverse the entity chain of the package and inspect all
+ -- visible items.
- -- Source objects (non-constants) are valid hidden states
+ Item_Id := First_Entity (Pack_Id);
+ while Present (Item_Id) and then not In_Private_Part (Item_Id) loop
- if Nkind (Decl) = N_Object_Declaration
- and then Ekind (Defining_Entity (Decl)) = E_Variable
- and then Comes_From_Source (Decl)
- then
- Add_Item (Defining_Entity (Decl), Hidden_States);
+ -- Do not consider internally generated items as those cannot
+ -- be named and participate in refinement.
+
+ if not Comes_From_Source (Item_Id) then
+ null;
- -- Gather the abstract states of a package along with all
- -- hidden states in its visible declarations.
+ elsif Ekind_In (Item_Id, E_Abstract_State, E_Variable) then
+ Add_Item (Item_Id, Result);
- elsif Nkind (Decl) = N_Package_Declaration then
- Collect_Abstract_States
- (Abstract_States (Defining_Entity (Decl)));
+ -- Recursively gather the visible states of a nested package
- Collect_Hidden_States_In_Decls
- (Visible_Declarations (Specification (Decl)));
+ elsif Ekind (Item_Id) = E_Package then
+ Collect_Visible_States (Item_Id);
end if;
- Next (Decl);
+ Next_Entity (Item_Id);
end loop;
- end Collect_Hidden_States_In_Decls;
+ end Collect_Visible_States;
-- Local variables
- Pack_Spec : constant Node_Id := Package_Specification (Spec_Id);
+ Pack_Body : constant Node_Id :=
+ Declaration_Node (Body_Entity (Pack_Id));
+ Decl : Node_Id;
+ Item_Id : Entity_Id;
- -- Start of processing for Collect_Hidden_States
+ -- Start of processing for Collect_Body_States
begin
- -- Process the private declarations of the package spec and the
- -- declarations of the body.
+ -- Inspect the declarations of the body looking for source variables,
+ -- packages and package instantiations.
+
+ Decl := First (Declarations (Pack_Body));
+ while Present (Decl) loop
+ if Nkind (Decl) = N_Object_Declaration then
+ Item_Id := Defining_Entity (Decl);
+
+ -- Capture source variables only as internally generated
+ -- temporaries cannot be named and participate in refinement.
- Collect_Hidden_States_In_Decls (Private_Declarations (Pack_Spec));
- Collect_Hidden_States_In_Decls (Declarations (Pack_Body));
- end Collect_Hidden_States;
+ if Ekind (Item_Id) = E_Variable
+ and then Comes_From_Source (Item_Id)
+ then
+ Add_Item (Item_Id, Result);
+ end if;
+
+ elsif Nkind (Decl) = N_Package_Declaration then
+ Item_Id := Defining_Entity (Decl);
+
+ -- Capture the visible abstract states and variables of a
+ -- source package [instantiation].
+
+ if Comes_From_Source (Item_Id) then
+ Collect_Visible_States (Item_Id);
+ end if;
+ end if;
+
+ Next (Decl);
+ end loop;
+
+ return Result;
+ end Collect_Body_States;
-----------------------------
-- Report_Unrefined_States --
-----------------------------
- procedure Report_Unrefined_States is
+ procedure Report_Unrefined_States (States : Elist_Id) is
State_Elmt : Elmt_Id;
begin
- if Present (Abstr_States) then
- State_Elmt := First_Elmt (Abstr_States);
+ if Present (States) then
+ State_Elmt := First_Elmt (States);
while Present (State_Elmt) loop
Error_Msg_N
("abstract state & must be refined", Node (State_Elmt));
@@ -22798,61 +23386,73 @@ package body Sem_Prag is
end if;
end Report_Unrefined_States;
- ---------------------------------
- -- Report_Unused_Hidden_States --
- ---------------------------------
+ --------------------------
+ -- Report_Unused_States --
+ --------------------------
- procedure Report_Unused_Hidden_States is
+ procedure Report_Unused_States (States : Elist_Id) is
Posted : Boolean := False;
State_Elmt : Elmt_Id;
State_Id : Entity_Id;
begin
- if Present (Hidden_States) then
- State_Elmt := First_Elmt (Hidden_States);
+ if Present (States) then
+ State_Elmt := First_Elmt (States);
while Present (State_Elmt) loop
State_Id := Node (State_Elmt);
-- Generate an error message of the form:
- -- package ... has unused hidden states
+ -- body of package ... has unused hidden states
-- abstract state ... defined at ...
-- variable ... defined at ...
if not Posted then
Posted := True;
- Error_Msg_NE
- ("package & has unused hidden states", N, Spec_Id);
+ Error_Msg_N
+ ("body of package & has unused hidden states", Body_Id);
end if;
Error_Msg_Sloc := Sloc (State_Id);
if Ekind (State_Id) = E_Abstract_State then
- Error_Msg_NE ("\ abstract state & defined #", N, State_Id);
+ Error_Msg_NE
+ ("\\ abstract state & defined #", Body_Id, State_Id);
else
- Error_Msg_NE ("\ variable & defined #", N, State_Id);
+ Error_Msg_NE
+ ("\\ variable & defined #", Body_Id, State_Id);
end if;
Next_Elmt (State_Elmt);
end loop;
end if;
- end Report_Unused_Hidden_States;
+ end Report_Unused_States;
-- Local declarations
- Clauses : constant Node_Id :=
- Get_Pragma_Arg (First (Pragma_Argument_Associations (N)));
- Clause : Node_Id;
+ Body_Decl : constant Node_Id := Parent (N);
+ Clauses : constant Node_Id :=
+ Get_Pragma_Arg (First (Pragma_Argument_Associations (N)));
+ Clause : Node_Id;
-- Start of processing for Analyze_Refined_State_In_Decl_Part
begin
Set_Analyzed (N);
- -- Initialize the various lists used during analysis
+ Body_Id := Defining_Entity (Body_Decl);
+ Spec_Id := Corresponding_Spec (Body_Decl);
+
+ -- Replicate the abstract states declared by the package because the
+ -- matching algorithm will consume states.
+
+ Available_States := New_Copy_Elist (Abstract_States (Spec_Id));
- Abstr_States := New_Copy_Elist (Abstract_States (Spec_Id));
- Collect_Hidden_States;
+ -- Gather all abstract states and variables declared in the visible
+ -- state space of the package body. These items must be utilized as
+ -- constituents in a state refinement.
+
+ Body_States := Collect_Body_States (Spec_Id);
-- Multiple non-null state refinements appear as an aggregate
@@ -22878,11 +23478,14 @@ package body Sem_Prag is
Analyze_Refinement_Clause (Clauses);
end if;
- -- Ensure that all abstract states have been refined and all hidden
- -- states of the related package unilized in refinements.
+ -- List all abstract states that were left unrefined
+
+ Report_Unrefined_States (Available_States);
+
+ -- Ensure that all abstract states and variables declared in the body
+ -- state space of the related package are utilized as constituents.
- Report_Unrefined_States;
- Report_Unused_Hidden_States;
+ Report_Unused_States (Body_States);
end Analyze_Refined_State_In_Decl_Part;
------------------------------------
@@ -22942,6 +23545,85 @@ package body Sem_Prag is
return False;
end Appears_In;
+ -----------------------------
+ -- Check_Applicable_Policy --
+ -----------------------------
+
+ procedure Check_Applicable_Policy (N : Node_Id) is
+ PP : Node_Id;
+ Policy : Name_Id;
+
+ Ename : constant Name_Id := Original_Aspect_Name (N);
+
+ begin
+ -- No effect if not valid assertion kind name
+
+ if not Is_Valid_Assertion_Kind (Ename) then
+ return;
+ end if;
+
+ -- Loop through entries in check policy list
+
+ PP := Opt.Check_Policy_List;
+ while Present (PP) loop
+ declare
+ PPA : constant List_Id := Pragma_Argument_Associations (PP);
+ Pnm : constant Name_Id := Chars (Get_Pragma_Arg (First (PPA)));
+
+ begin
+ if Ename = Pnm
+ or else Pnm = Name_Assertion
+ or else (Pnm = Name_Statement_Assertions
+ and then Nam_In (Ename, Name_Assert,
+ Name_Assert_And_Cut,
+ Name_Assume,
+ Name_Loop_Invariant,
+ Name_Loop_Variant))
+ then
+ Policy := Chars (Get_Pragma_Arg (Last (PPA)));
+
+ case Policy is
+ when Name_Off | Name_Ignore =>
+ Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
+
+ when Name_On | Name_Check =>
+ Set_Is_Checked (N, True);
+ Set_Is_Ignored (N, False);
+
+ when Name_Disable =>
+ Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
+ Set_Is_Disabled (N, True);
+
+ -- That should be exhaustive, the null here is a defence
+ -- against a malformed tree from previous errors.
+
+ when others =>
+ null;
+ end case;
+
+ return;
+ end if;
+
+ PP := Next_Pragma (PP);
+ end;
+ end loop;
+
+ -- If there are no specific entries that matched, then we let the
+ -- setting of assertions govern. Note that this provides the needed
+ -- compatibility with the RM for the cases of assertion, invariant,
+ -- precondition, predicate, and postcondition.
+
+ if Assertions_Enabled then
+ Set_Is_Checked (N, True);
+ Set_Is_Ignored (N, False);
+ else
+ Set_Is_Checked (N, False);
+ Set_Is_Ignored (N, True);
+ end if;
+ end Check_Applicable_Policy;
+
-------------------------------
-- Check_External_Properties --
-------------------------------
@@ -23049,84 +23731,241 @@ package body Sem_Prag is
end if;
end Check_Kind;
- -----------------------------
- -- Check_Applicable_Policy --
- -----------------------------
+ ---------------------------
+ -- Check_Missing_Part_Of --
+ ---------------------------
- procedure Check_Applicable_Policy (N : Node_Id) is
- PP : Node_Id;
- Policy : Name_Id;
+ procedure Check_Missing_Part_Of (Item_Id : Entity_Id) is
+ function Has_Visible_State (Pack_Id : Entity_Id) return Boolean;
+ -- Determine whether a package denoted by Pack_Id declares at least one
+ -- visible state.
- Ename : constant Name_Id := Original_Aspect_Name (N);
+ -----------------------
+ -- Has_Visible_State --
+ -----------------------
+
+ function Has_Visible_State (Pack_Id : Entity_Id) return Boolean is
+ Item_Id : Entity_Id;
+
+ begin
+ -- Traverse the entity chain of the package trying to find at least
+ -- one visible abstract state, variable or a package [instantiation]
+ -- that declares a visible state.
+
+ Item_Id := First_Entity (Pack_Id);
+ while Present (Item_Id)
+ and then not In_Private_Part (Item_Id)
+ loop
+ -- Do not consider internally generated items
+
+ if not Comes_From_Source (Item_Id) then
+ null;
+
+ -- A visible state has been found
+
+ elsif Ekind_In (Item_Id, E_Abstract_State, E_Variable) then
+ return True;
+
+ -- Recursively peek into nested packages and instantiations
+
+ elsif Ekind (Item_Id) = E_Package
+ and then Has_Visible_State (Item_Id)
+ then
+ return True;
+ end if;
+
+ Next_Entity (Item_Id);
+ end loop;
+
+ return False;
+ end Has_Visible_State;
+
+ -- Local variables
+
+ Pack_Id : Entity_Id;
+ Placement : State_Space_Kind;
+
+ -- Start of processing for Check_Missing_Part_Of
begin
- -- No effect if not valid assertion kind name
+ -- Do not consider internally generated entities as these can never
+ -- have a Part_Of indicator.
- if not Is_Valid_Assertion_Kind (Ename) then
+ if not Comes_From_Source (Item_Id) then
+ return;
+
+ -- Perform these checks only when SPARK_Mode is enabled as they will
+ -- interfere with standard Ada rules and produce false positives.
+
+ elsif SPARK_Mode /= On then
return;
end if;
- -- Loop through entries in check policy list
+ -- Find where the abstract state, variable or package instantiation
+ -- lives with respect to the state space.
- PP := Opt.Check_Policy_List;
- while Present (PP) loop
- declare
- PPA : constant List_Id := Pragma_Argument_Associations (PP);
- Pnm : constant Name_Id := Chars (Get_Pragma_Arg (First (PPA)));
+ Find_Placement_In_State_Space
+ (Item_Id => Item_Id,
+ Placement => Placement,
+ Pack_Id => Pack_Id);
- begin
- if Ename = Pnm
- or else Pnm = Name_Assertion
- or else (Pnm = Name_Statement_Assertions
- and then Nam_In (Ename, Name_Assert,
- Name_Assert_And_Cut,
- Name_Assume,
- Name_Loop_Invariant,
- Name_Loop_Variant))
+ -- Items that appear in a non-package construct (subprogram, block, etc)
+ -- do not require a Part_Of indicator because they can never act as a
+ -- hidden state.
+
+ if Placement = Not_In_Package then
+ null;
+
+ -- An item declared in the body state space of a package always act as a
+ -- constituent and does not need explicit Part_Of indicator.
+
+ elsif Placement = Body_State_Space then
+ null;
+
+ -- In general an item declared in the visible state space of a package
+ -- does not require a Part_Of indicator. The only exception is when the
+ -- related package is a private child unit in which case Part_Of must
+ -- denote a state in the parent unit or in one of its descendants.
+
+ elsif Placement = Visible_State_Space then
+ if Is_Child_Unit (Pack_Id)
+ and then Is_Private_Descendant (Pack_Id)
+ then
+ -- A package instantiation does not need a Part_Of indicator when
+ -- the related generic template has no visible state.
+
+ if Ekind (Item_Id) = E_Package
+ and then Is_Generic_Instance (Item_Id)
+ and then not Has_Visible_State (Item_Id)
then
- Policy := Chars (Get_Pragma_Arg (Last (PPA)));
+ null;
- case Policy is
- when Name_Off | Name_Ignore =>
- Set_Is_Ignored (N, True);
- Set_Is_Checked (N, False);
+ -- All other cases require Part_Of
- when Name_On | Name_Check =>
- Set_Is_Checked (N, True);
- Set_Is_Ignored (N, False);
+ else
+ Error_Msg_N
+ ("indicator Part_Of is required in this context (SPARK RM "
+ & "7.2.6(3))", Item_Id);
+ Error_Msg_Name_1 := Chars (Pack_Id);
+ Error_Msg_N
+ ("\& is declared in the visible part of private child unit %",
+ Item_Id);
+ end if;
+ end if;
- when Name_Disable =>
- Set_Is_Ignored (N, True);
- Set_Is_Checked (N, False);
- Set_Is_Disabled (N, True);
+ -- When the item appears in the private state space of a packge, it must
+ -- be a part of some state declared by the said package.
- -- That should be exhaustive, the null here is a defence
- -- against a malformed tree from previous errors.
+ else pragma Assert (Placement = Private_State_Space);
- when others =>
- null;
- end case;
+ -- The related package does not declare a state, the item cannot act
+ -- as a Part_Of constituent.
- return;
+ if No (Get_Pragma (Pack_Id, Pragma_Abstract_State)) then
+ null;
+
+ -- A package instantiation does not need a Part_Of indicator when the
+ -- related generic template has no visible state.
+
+ elsif Ekind (Pack_Id) = E_Package
+ and then Is_Generic_Instance (Pack_Id)
+ and then not Has_Visible_State (Pack_Id)
+ then
+ null;
+
+ -- All other cases require Part_Of
+
+ else
+ Error_Msg_N
+ ("indicator Part_Of is required in this context (SPARK RM "
+ & "7.2.6(2))", Item_Id);
+ Error_Msg_Name_1 := Chars (Pack_Id);
+ Error_Msg_N
+ ("\& is declared in the private part of package %", Item_Id);
+ end if;
+ end if;
+ end Check_Missing_Part_Of;
+
+ -------------------------------------
+ -- Check_State_And_Constituent_Use --
+ -------------------------------------
+
+ procedure Check_State_And_Constituent_Use
+ (States : Elist_Id;
+ Constits : Elist_Id;
+ Context : Node_Id)
+ is
+ function Find_Encapsulating_State
+ (Constit_Id : Entity_Id) return Entity_Id;
+ -- Given the entity of a constituent, try to find a corresponding
+ -- encapsulating state that appears in the same context. The routine
+ -- returns Empty is no such state is found.
+
+ ------------------------------
+ -- Find_Encapsulating_State --
+ ------------------------------
+
+ function Find_Encapsulating_State
+ (Constit_Id : Entity_Id) return Entity_Id
+ is
+ State_Id : Entity_Id;
+
+ begin
+ -- Since a constituent may be part of a larger constituent set, climb
+ -- the encapsulated state chain looking for a state that appears in
+ -- the same context.
+
+ State_Id := Encapsulating_State (Constit_Id);
+ while Present (State_Id) loop
+ if Contains (States, State_Id) then
+ return State_Id;
end if;
- PP := Next_Pragma (PP);
- end;
- end loop;
+ State_Id := Encapsulating_State (State_Id);
+ end loop;
- -- If there are no specific entries that matched, then we let the
- -- setting of assertions govern. Note that this provides the needed
- -- compatibility with the RM for the cases of assertion, invariant,
- -- precondition, predicate, and postcondition.
+ return Empty;
+ end Find_Encapsulating_State;
- if Assertions_Enabled then
- Set_Is_Checked (N, True);
- Set_Is_Ignored (N, False);
- else
- Set_Is_Checked (N, False);
- Set_Is_Ignored (N, True);
+ -- Local variables
+
+ Constit_Elmt : Elmt_Id;
+ Constit_Id : Entity_Id;
+ State_Id : Entity_Id;
+
+ -- Start of processing for Check_State_And_Constituent_Use
+
+ begin
+ -- Nothing to do if there are no states or constituents
+
+ if No (States) or else No (Constits) then
+ return;
end if;
- end Check_Applicable_Policy;
+
+ -- Inspect the list of constituents and try to determine whether its
+ -- encapsulating state is in list States.
+
+ Constit_Elmt := First_Elmt (Constits);
+ while Present (Constit_Elmt) loop
+ Constit_Id := Node (Constit_Elmt);
+
+ -- Determine whether the constituent is part of an encapsulating
+ -- state that appears in the same context and if this is the case,
+ -- emit an error.
+
+ State_Id := Find_Encapsulating_State (Constit_Id);
+
+ if Present (State_Id) then
+ Error_Msg_Name_1 := Chars (Constit_Id);
+ Error_Msg_NE
+ ("cannot mention state & and its constituent % in the same "
+ & "context (SPARK RM 7.2.6(7))", Context, State_Id);
+ exit;
+ end if;
+
+ Next_Elmt (Constit_Elmt);
+ end loop;
+ end Check_State_And_Constituent_Use;
--------------------------
-- Collect_Global_Items --
@@ -23878,6 +24717,7 @@ package body Sem_Prag is
Pragma_Ordered => 0,
Pragma_Pack => 0,
Pragma_Page => -1,
+ Pragma_Part_Of => -1,
Pragma_Partition_Elaboration_Policy => -1,
Pragma_Passive => -1,
Pragma_Persistent_BSS => 0,
@@ -24020,40 +24860,6 @@ package body Sem_Prag is
end if;
end Is_Non_Significant_Pragma_Reference;
- ----------------
- -- Is_Part_Of --
- ----------------
-
- function Is_Part_Of
- (State : Entity_Id;
- Ancestor : Entity_Id) return Boolean
- is
- Options : constant Node_Id := Parent (State);
- Name : Node_Id;
- Option : Node_Id;
- Value : Node_Id;
-
- begin
- -- A state declaration with option Part_Of appears as an extension
- -- aggregate with component associations.
-
- if Nkind (Options) = N_Extension_Aggregate then
- Option := First (Component_Associations (Options));
- while Present (Option) loop
- Name := First (Choices (Option));
- Value := Expression (Option);
-
- if Chars (Name) = Name_Part_Of then
- return Entity (Value) = Ancestor;
- end if;
-
- Next (Option);
- end loop;
- end if;
-
- return False;
- end Is_Part_Of;
-
------------------------------
-- Is_Pragma_String_Literal --
------------------------------
@@ -24373,7 +25179,7 @@ package body Sem_Prag is
Expression => Make_Identifier (Sloc (N), Name_All_Checks)))));
end if;
- -- Nothing else to do at the current time!
+ -- Nothing else to do at the current time
end Process_Compilation_Unit_Pragmas;
@@ -24382,20 +25188,43 @@ package body Sem_Prag is
------------------------------------
procedure Record_Possible_Body_Reference
- (Item : Node_Id;
- Item_Id : Entity_Id)
+ (State_Id : Entity_Id;
+ Ref : Node_Id)
is
+ Context : Node_Id;
+ Spec_Id : Entity_Id;
+
begin
- if Is_Body_Name (Unit_Name (Get_Source_Unit (Item)))
- and then Ekind (Item_Id) = E_Abstract_State
- then
- if not Has_Body_References (Item_Id) then
- Set_Has_Body_References (Item_Id, True);
- Set_Body_References (Item_Id, New_Elmt_List);
+ -- Ensure that we are dealing with a reference to a state
+
+ pragma Assert (Ekind (State_Id) = E_Abstract_State);
+
+ -- Climb the tree starting from the reference looking for a package body
+ -- whose spec declares the referenced state. This criteria automatically
+ -- excludes references in package specs which are legal. Note that it is
+ -- not wise to emit an error now as the package body may lack pragma
+ -- Refined_State or the referenced state may not be mentioned in the
+ -- refinement. This approach avoids the generation of misleading errors.
+
+ Context := Ref;
+ while Present (Context) loop
+ if Nkind (Context) = N_Package_Body then
+ Spec_Id := Corresponding_Spec (Context);
+
+ if Present (Abstract_States (Spec_Id))
+ and then Contains (Abstract_States (Spec_Id), State_Id)
+ then
+ if No (Body_References (State_Id)) then
+ Set_Body_References (State_Id, New_Elmt_List);
+ end if;
+
+ Append_Elmt (Ref, Body_References (State_Id));
+ exit;
+ end if;
end if;
- Append_Elmt (Item, Body_References (Item_Id));
- end if;
+ Context := Parent (Context);
+ end loop;
end Record_Possible_Body_Reference;
------------------------------
diff --git a/main/gcc/ada/sem_prag.ads b/main/gcc/ada/sem_prag.ads
index 730643a1c51..9e1d8b397b8 100644
--- a/main/gcc/ada/sem_prag.ads
+++ b/main/gcc/ada/sem_prag.ads
@@ -139,6 +139,11 @@ package Sem_Prag is
-- is the related variable or state. Ensure legality of the combination and
-- issue an error for an illegal combination.
+ procedure Check_Missing_Part_Of (Item_Id : Entity_Id);
+ -- Determine whether the placement within the state space of an abstract
+ -- state, variable or package instantiation denoted by Item_Id requires the
+ -- use of indicator/option Part_Of. If this is the case, emit an error.
+
function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean;
-- N is a pragma appearing in a configuration pragma file. Most such
-- pragmas are analyzed when the file is read, before parsing and analyzing
diff --git a/main/gcc/ada/sem_res.adb b/main/gcc/ada/sem_res.adb
index aff4b47926a..8e08367047c 100644
--- a/main/gcc/ada/sem_res.adb
+++ b/main/gcc/ada/sem_res.adb
@@ -2474,7 +2474,7 @@ package body Sem_Res is
-- If type we are looking for is Void, then this is the procedure
-- call case, and the error is simply that what we gave is not a
-- procedure name (we think of procedure calls as expressions with
- -- types internally, but the user doesn't think of them this way!)
+ -- types internally, but the user doesn't think of them this way).
if Typ = Standard_Void_Type then
@@ -2489,7 +2489,7 @@ package body Sem_Res is
Name (N), Entity (Name (N)));
-- Otherwise give general message (not clear what cases this
- -- covers, but no harm in providing for them!)
+ -- covers, but no harm in providing for them).
else
Error_Msg_N ("expect procedure name in procedure call", N);
@@ -3236,7 +3236,7 @@ package body Sem_Res is
else
-- Note that we do a full New_Copy_Tree, so that any associated
-- Itypes are properly copied. This may not be needed any more,
- -- but it does no harm as a safety measure! Defaults of a generic
+ -- but it does no harm as a safety measure. Defaults of a generic
-- formal may be out of bounds of the corresponding actual (see
-- cc1311b) and an additional check may be required.
@@ -3951,7 +3951,7 @@ package body Sem_Res is
-- Note: call Warn_On_Useless_Assignment before doing the check
-- below for Is_OK_Variable_For_Out_Formal so that the setting
-- of Referenced_As_LHS/Referenced_As_Out_Formal properly
- -- reflects the last assignment, not this one!
+ -- reflects the last assignment, not this one.
if Ekind (F) = E_Out_Parameter then
if Warn_On_Modified_As_Out_Parameter (F)
@@ -6170,7 +6170,7 @@ package body Sem_Res is
end if;
-- For Standard.Wide_Wide_Character or a type derived from it, we
- -- know the literal is in range, since the parser checked!
+ -- know the literal is in range, since the parser checked.
elsif Root_Type (B_Typ) = Standard_Wide_Wide_Character then
return;
@@ -6513,6 +6513,7 @@ package body Sem_Res is
-- standard Ada legality rules.
if SPARK_Mode = On
+ and then Ekind_In (E, E_Abstract_State, E_Variable)
and then Is_SPARK_Volatile_Object (E)
and then
(Async_Writers_Enabled (E)
@@ -9669,7 +9670,7 @@ package body Sem_Res is
-- very few places that we place the flag in the middle of
-- a token, right under the offending wide character. Not
-- quite clear if this is right wrt wide character encoding
- -- sequences, but it's only an error message!
+ -- sequences, but it's only an error message.
Error_Msg
("literal out of range of type Standard.Character",
@@ -11267,7 +11268,7 @@ package body Sem_Res is
-- Deal with conversion of integer type to address if the pragma
-- Allow_Integer_Address is in effect. We convert the conversion to
- -- an unchecked conversion in this case and we are all done!
+ -- an unchecked conversion in this case and we are all done.
if Address_Integer_Convert_OK (Opnd_Type, Target_Type) then
Rewrite (N, Unchecked_Convert_To (Target_Type, Expression (N)));
diff --git a/main/gcc/ada/sem_type.adb b/main/gcc/ada/sem_type.adb
index f0fea637a38..86789ce20f4 100644
--- a/main/gcc/ada/sem_type.adb
+++ b/main/gcc/ada/sem_type.adb
@@ -1255,7 +1255,7 @@ package body Sem_Type is
then
return True;
- -- Otherwise, types are not compatible!
+ -- Otherwise, types are not compatible
else
return False;
diff --git a/main/gcc/ada/sem_util.adb b/main/gcc/ada/sem_util.adb
index 8fc28ef4be8..85c8592959f 100644
--- a/main/gcc/ada/sem_util.adb
+++ b/main/gcc/ada/sem_util.adb
@@ -233,11 +233,12 @@ package body Sem_Util is
Nam := Original_Aspect_Name (Prag);
- -- Contract items related to [generic] packages. The applicable pragmas
- -- are:
+ -- Contract items related to [generic] packages or instantiations. The
+ -- applicable pragmas are:
-- Abstract_States
-- Initial_Condition
-- Initializes
+ -- Part_Of (instantiation only)
if Ekind_In (Id, E_Generic_Package, E_Package) then
if Nam_In (Nam, Name_Abstract_State,
@@ -247,6 +248,12 @@ package body Sem_Util is
Set_Next_Pragma (Prag, Classifications (Items));
Set_Classifications (Items, Prag);
+ -- Indicator Part_Of must be associated with a package instantiation
+
+ elsif Nam = Name_Part_Of and then Is_Generic_Instance (Id) then
+ Set_Next_Pragma (Prag, Classifications (Items));
+ Set_Classifications (Items, Prag);
+
-- The pragma is not a proper contract item
else
@@ -338,9 +345,14 @@ package body Sem_Util is
-- are:
-- Refined_Depends
-- Refined_Global
+ -- Refined_Post
elsif Ekind (Id) = E_Subprogram_Body then
- if Nam_In (Nam, Name_Refined_Depends, Name_Refined_Global) then
+ if Nam = Name_Refined_Post then
+ Set_Next_Pragma (Prag, Pre_Post_Conditions (Items));
+ Set_Pre_Post_Conditions (Items, Prag);
+
+ elsif Nam_In (Nam, Name_Refined_Depends, Name_Refined_Global) then
Set_Next_Pragma (Prag, Classifications (Items));
Set_Classifications (Items, Prag);
@@ -355,12 +367,14 @@ package body Sem_Util is
-- Async_Writers
-- Effective_Reads
-- Effective_Writes
+ -- Part_Of
elsif Ekind (Id) = E_Variable then
if Nam_In (Nam, Name_Async_Readers,
Name_Async_Writers,
Name_Effective_Reads,
- Name_Effective_Writes)
+ Name_Effective_Writes,
+ Name_Part_Of)
then
Set_Next_Pragma (Prag, Classifications (Items));
Set_Classifications (Items, Prag);
@@ -4201,6 +4215,7 @@ package body Sem_Util is
Set_Defining_Unit_Name (N, Err);
return Err;
+
-- If not an entity, get defining identifier
else
@@ -5304,13 +5319,13 @@ package body Sem_Util is
-- If entity is in standard, then we are in trouble, because it
-- means that we have a library package with a duplicated name.
- -- That's hard to recover from, so abort!
+ -- That's hard to recover from, so abort.
if S = Standard_Standard then
raise Unrecoverable_Error;
-- Otherwise we continue with the declaration. Having two
- -- identical declarations should not cause us too much trouble!
+ -- identical declarations should not cause us too much trouble.
else
null;
@@ -5827,6 +5842,74 @@ package body Sem_Util is
end if;
end Find_Parameter_Type;
+ -----------------------------------
+ -- Find_Placement_In_State_Space --
+ -----------------------------------
+
+ procedure Find_Placement_In_State_Space
+ (Item_Id : Entity_Id;
+ Placement : out State_Space_Kind;
+ Pack_Id : out Entity_Id)
+ is
+ Context : Entity_Id;
+
+ begin
+ -- Assume that the item does not appear in the state space of a package
+
+ Placement := Not_In_Package;
+ Pack_Id := Empty;
+
+ -- Climb the scope stack and examine the enclosing context
+
+ Context := Scope (Item_Id);
+ while Present (Context) and then Context /= Standard_Standard loop
+ if Ekind (Context) = E_Package then
+ Pack_Id := Context;
+
+ -- A package body is a cut off point for the traversal as the item
+ -- cannot be visible to the outside from this point on. Note that
+ -- this test must be done first as a body is also classified as a
+ -- private part.
+
+ if In_Package_Body (Context) then
+ Placement := Body_State_Space;
+ return;
+
+ -- The private part of a package is a cut off point for the
+ -- traversal as the item cannot be visible to the outside from
+ -- this point on.
+
+ elsif In_Private_Part (Context) then
+ Placement := Private_State_Space;
+ return;
+
+ -- When the item appears in the visible state space of a package,
+ -- continue to climb the scope stack as this may not be the final
+ -- state space.
+
+ else
+ Placement := Visible_State_Space;
+
+ -- The visible state space of a child unit acts as the proper
+ -- placement of an item.
+
+ if Is_Child_Unit (Context) then
+ return;
+ end if;
+ end if;
+
+ -- The item or its enclosing package appear in a construct that has
+ -- no state space.
+
+ else
+ Placement := Not_In_Package;
+ return;
+ end if;
+
+ Context := Scope (Context);
+ end loop;
+ end Find_Placement_In_State_Space;
+
-----------------------------
-- Find_Static_Alternative --
-----------------------------
@@ -7242,7 +7325,7 @@ package body Sem_Util is
-- Single property
else
- return Chars (Prop) = Prop_Nam;
+ return Chars (Props) = Prop_Nam;
end if;
end if;
@@ -8370,6 +8453,25 @@ package body Sem_Util is
return False;
end In_Parameter_Specification;
+ --------------------------
+ -- In_Pragma_Expression --
+ --------------------------
+
+ function In_Pragma_Expression (N : Node_Id; Nam : Name_Id) return Boolean is
+ P : Node_Id;
+ begin
+ P := Parent (N);
+ loop
+ if No (P) then
+ return False;
+ elsif Nkind (P) = N_Pragma and then Pragma_Name (P) = Nam then
+ return True;
+ else
+ P := Parent (P);
+ end if;
+ end loop;
+ end In_Pragma_Expression;
+
-------------------------------------
-- In_Reverse_Storage_Order_Object --
-------------------------------------
@@ -8948,9 +9050,8 @@ package body Sem_Util is
-------------------------
function Is_Child_Or_Sibling
- (Pack_1 : Entity_Id;
- Pack_2 : Entity_Id;
- Private_Child : Boolean) return Boolean
+ (Pack_1 : Entity_Id;
+ Pack_2 : Entity_Id) return Boolean
is
function Distance_From_Standard (Pack : Entity_Id) return Nat;
-- Given an arbitrary package, return the number of "climbs" necessary
@@ -8964,10 +9065,6 @@ package body Sem_Util is
-- climb the scope chain until the said depth is reached. The pointer
-- to the package and its depth a modified during the climb.
- function Is_Child (Pack : Entity_Id) return Boolean;
- -- Given a package Pack, determine whether it is a child package that
- -- satisfies the privacy requirement (if set).
-
----------------------------
-- Distance_From_Standard --
----------------------------
@@ -9011,26 +9108,6 @@ package body Sem_Util is
end loop;
end Equalize_Depths;
- --------------
- -- Is_Child --
- --------------
-
- function Is_Child (Pack : Entity_Id) return Boolean is
- begin
- if Is_Child_Unit (Pack) then
- if Private_Child then
- return Is_Private_Descendant (Pack);
- else
- return True;
- end if;
-
- -- The package is nested, it cannot act a child or a sibling
-
- else
- return False;
- end if;
- end Is_Child;
-
-- Local variables
P_1 : Entity_Id := Pack_1;
@@ -9062,7 +9139,10 @@ package body Sem_Util is
-- P_1 P_1
elsif P_1_Depth > P_2_Depth then
- Equalize_Depths (P_1, P_1_Depth, P_2_Depth);
+ Equalize_Depths
+ (Pack => P_1,
+ Depth => P_1_Depth,
+ Depth_To_Reach => P_2_Depth);
P_1_Child := True;
-- (root) P_1
@@ -9072,7 +9152,10 @@ package body Sem_Util is
-- P_2 P_2
elsif P_2_Depth > P_1_Depth then
- Equalize_Depths (P_2, P_2_Depth, P_1_Depth);
+ Equalize_Depths
+ (Pack => P_2,
+ Depth => P_2_Depth,
+ Depth_To_Reach => P_1_Depth);
P_2_Child := True;
end if;
@@ -9088,9 +9171,10 @@ package body Sem_Util is
if P_1 = P_2 then
if P_1_Child then
- return Is_Child (Pack_1);
+ return Is_Child_Unit (Pack_1);
+
else pragma Assert (P_2_Child);
- return Is_Child (Pack_2);
+ return Is_Child_Unit (Pack_2);
end if;
-- The packages may come from the same package chain or from entirely
@@ -9107,7 +9191,7 @@ package body Sem_Util is
-- The two packages may be siblings
if P_1 = P_2 then
- return Is_Child (Pack_1) and then Is_Child (Pack_2);
+ return Is_Child_Unit (Pack_1) and then Is_Child_Unit (Pack_2);
end if;
P_1 := Scope (P_1);
@@ -9563,7 +9647,7 @@ package body Sem_Util is
-- An interesting case, if we have a constrained type one of whose
-- bounds is known to be null, then there are no elements to be
- -- initialized, so all the elements are initialized!
+ -- initialized, so all the elements are initialized.
if Is_Constrained (Typ) then
declare
@@ -9916,7 +10000,7 @@ package body Sem_Util is
-- If P is an LHS, then N is also effectively an LHS, but there
-- is an important exception. If N is of an access type, then
-- what we really have is N.all.Q (or N.all(Q .. R)). In either
- -- case this makes N.all a left hand side but not N itself!
+ -- case this makes N.all a left hand side but not N itself.
-- Here follows a worrisome kludge. If Etype (N) is not set, which
-- for sure happens in the call from Find_Direct_Name, that means we
@@ -13257,7 +13341,7 @@ package body Sem_Util is
-- need Report to be True, and also we do not report errors caused
-- by calls to init procs that occur within other init procs. Such
-- errors must always be cascaded errors, since if all the types are
- -- declared correctly, the compiler will certainly build decent calls!
+ -- declared correctly, the compiler will certainly build decent calls.
-----------
-- Chain --
@@ -14554,6 +14638,81 @@ package body Sem_Util is
end if;
end Require_Entity;
+ -------------------------------
+ -- Requires_State_Refinement --
+ -------------------------------
+
+ function Requires_State_Refinement
+ (Spec_Id : Entity_Id;
+ Body_Id : Entity_Id) return Boolean
+ is
+ function Mode_Is_Off (Prag : Node_Id) return Boolean;
+ -- Given pragma SPARK_Mode, determine whether the mode is Off
+
+ -----------------
+ -- Mode_Is_Off --
+ -----------------
+
+ function Mode_Is_Off (Prag : Node_Id) return Boolean is
+ Mode : Node_Id;
+
+ begin
+ -- The default SPARK mode is On
+
+ if No (Prag) then
+ return False;
+ end if;
+
+ Mode := Get_Pragma_Arg (First (Pragma_Argument_Associations (Prag)));
+
+ -- Then the pragma lacks an argument, the default mode is On
+
+ if No (Mode) then
+ return False;
+ else
+ return Chars (Mode) = Name_Off;
+ end if;
+ end Mode_Is_Off;
+
+ -- Start of processing for Requires_State_Refinement
+
+ begin
+ -- A package that does not define at least one abstract state cannot
+ -- possibly require refinement.
+
+ if No (Abstract_States (Spec_Id)) then
+ return False;
+
+ -- The package instroduces a single null state which does not merit
+ -- refinement.
+
+ elsif Has_Null_Abstract_State (Spec_Id) then
+ return False;
+
+ -- Check whether the package body is subject to pragma SPARK_Mode. If
+ -- it is and the mode is Off, the package body is considered to be in
+ -- regular Ada and does not require refinement.
+
+ elsif Mode_Is_Off (SPARK_Pragma (Body_Id)) then
+ return False;
+
+ -- The body's SPARK_Mode may be inherited from a similar pragma that
+ -- appears in the private declarations of the spec. The pragma we are
+ -- interested appears as the second entry in SPARK_Pragma.
+
+ elsif Present (SPARK_Pragma (Spec_Id))
+ and then Mode_Is_Off (Next_Pragma (SPARK_Pragma (Spec_Id)))
+ then
+ return False;
+
+ -- The spec defines at least one abstract state and the body has no way
+ -- of circumventing the refinement.
+
+ else
+ return True;
+ end if;
+ end Requires_State_Refinement;
+
------------------------------
-- Requires_Transient_Scope --
------------------------------
diff --git a/main/gcc/ada/sem_util.ads b/main/gcc/ada/sem_util.ads
index 3c512df64fc..5d32cfa64fb 100644
--- a/main/gcc/ada/sem_util.ads
+++ b/main/gcc/ada/sem_util.ads
@@ -44,8 +44,9 @@ package Sem_Util is
-- freeze node of E.
procedure Add_Contract_Item (Prag : Node_Id; Id : Entity_Id);
- -- Add pragma Prag to the contract of an entry, a package [body] or a
- -- subprogram [body] denoted by Id. The following are valid pragmas:
+ -- Add pragma Prag to the contract of an entry, a package [body], a
+ -- subprogram [body] or variable denoted by Id. The following are valid
+ -- pragmas:
-- Abstract_States
-- Async_Readers
-- Async_Writers
@@ -56,6 +57,7 @@ package Sem_Util is
-- Global
-- Initial_Condition
-- Initializes
+ -- Part_Of
-- Postcondition
-- Precondition
-- Refined_Depends
@@ -571,6 +573,12 @@ package Sem_Util is
-- Call is set to the node for the corresponding call. If the node N is not
-- an actual parameter then Formal and Call are set to Empty.
+ function Find_Body_Discriminal
+ (Spec_Discriminant : Entity_Id) return Entity_Id;
+ -- Given a discriminant of the record type that implements a task or
+ -- protected type, return the discriminal of the corresponding discriminant
+ -- of the actual concurrent type.
+
function Find_Corresponding_Discriminant
(Id : Node_Id;
Typ : Entity_Id) return Entity_Id;
@@ -600,17 +608,93 @@ package Sem_Util is
-- Return the type of formal parameter Param as determined by its
-- specification.
+ -- The following type describes the placement of an arbitrary entity with
+ -- respect to SPARK visible / hidden state space.
+
+ type State_Space_Kind is
+ (Not_In_Package,
+ -- An entity is not in the visible, private or body state space when
+ -- the immediate enclosing construct is not a package.
+
+ Visible_State_Space,
+ -- An entity is in the visible state space when it appears immediately
+ -- within the visible declarations of a package or when it appears in
+ -- the visible state space of a nested package which in turn is declared
+ -- in the visible declarations of an enclosing package:
+
+ -- package Pack is
+ -- Visible_Variable : ...
+ -- package Nested
+ -- with Abstract_State => Visible_State
+ -- is
+ -- Visible_Nested_Variable : ...
+ -- end Nested;
+ -- end Pack;
+
+ -- Entities associated with a package instantiation inherit the state
+ -- space from the instance placement:
+
+ -- generic
+ -- package Gen is
+ -- Generic_Variable : ...
+ -- end Gen;
+
+ -- with Gen;
+ -- package Pack is
+ -- package Inst is new Gen;
+ -- -- Generic_Variable is in the visible state space of Pack
+ -- end Pack;
+
+ Private_State_Space,
+ -- An entity is in the private state space when it appears immediately
+ -- within the private declarations of a package or when it appears in
+ -- the visible state space of a nested package which in turn is declared
+ -- in the private declarations of an enclosing package:
+
+ -- package Pack is
+ -- private
+ -- Private_Variable : ...
+ -- package Nested
+ -- with Abstract_State => Private_State
+ -- is
+ -- Private_Nested_Variable : ...
+ -- end Nested;
+ -- end Pack;
+
+ -- The same placement principle applies to package instantiations
+
+ Body_State_Space);
+ -- An entity is in the body state space when it appears immediately
+ -- within the declarations of a package body or when it appears in the
+ -- visible state space of a nested package which in turn is declared in
+ -- the declarations of an enclosing package body:
+
+ -- package body Pack is
+ -- Body_Variable : ...
+ -- package Nested
+ -- with Abstract_State => Body_State
+ -- is
+ -- Body_Nested_Variable : ...
+ -- end Nested;
+ -- end Pack;
+
+ -- The same placement principle applies to package instantiations
+
+ procedure Find_Placement_In_State_Space
+ (Item_Id : Entity_Id;
+ Placement : out State_Space_Kind;
+ Pack_Id : out Entity_Id);
+ -- Determine the state space placement of an item. Item_Id denotes the
+ -- entity of an abstract state, variable or package instantiation.
+ -- Placement captures the precise placement of the item in the enclosing
+ -- state space. If the state space is that of a package, Pack_Id denotes
+ -- its entity, otherwise Pack_Id is Empty.
+
function Find_Static_Alternative (N : Node_Id) return Node_Id;
-- N is a case statement whose expression is a compile-time value.
-- Determine the alternative chosen, so that the code of non-selected
-- alternatives, and the warnings that may apply to them, are removed.
- function Find_Body_Discriminal
- (Spec_Discriminant : Entity_Id) return Entity_Id;
- -- Given a discriminant of the record type that implements a task or
- -- protected type, return the discriminal of the corresponding discriminant
- -- of the actual concurrent type.
-
function First_Actual (Node : Node_Id) return Node_Id;
-- Node is an N_Function_Call or N_Procedure_Call_Statement node. The
-- result returned is the first actual parameter in declaration order
@@ -922,15 +1006,18 @@ package Sem_Util is
function In_Parameter_Specification (N : Node_Id) return Boolean;
-- Returns True if node N belongs to a parameter specification
+ function In_Pragma_Expression (N : Node_Id; Nam : Name_Id) return Boolean;
+ -- Returns true if the expression N occurs within a pragma with name Nam
+
function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
-- Returns True if N denotes a component or subcomponent in a record or
-- array that has Reverse_Storage_Order.
function In_Subprogram_Or_Concurrent_Unit return Boolean;
-- Determines if the current scope is within a subprogram compilation unit
- -- (inside a subprogram declaration, subprogram body, or generic
- -- subprogram declaration) or within a task or protected body. The test is
- -- for appearing anywhere within such a construct (that is it does not need
+ -- (inside a subprogram declaration, subprogram body, or generic subprogram
+ -- declaration) or within a task or protected body. The test is for
+ -- appearing anywhere within such a construct (that is it does not need
-- to be directly within).
function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
@@ -1006,14 +1093,11 @@ package Sem_Util is
-- Returns True if N is a call to a CPP constructor
function Is_Child_Or_Sibling
- (Pack_1 : Entity_Id;
- Pack_2 : Entity_Id;
- Private_Child : Boolean) return Boolean;
+ (Pack_1 : Entity_Id;
+ Pack_2 : Entity_Id) return Boolean;
-- Determine the following relations between two arbitrary packages:
-- 1) One package is the parent of a child package
-- 2) Both packages are siblings and share a common parent
- -- If flag Private_Child is set, then the child in case 1) or both siblings
- -- in case 2) must be private.
function Is_Concurrent_Interface (T : Entity_Id) return Boolean;
-- First determine whether type T is an interface and then check whether
@@ -1540,6 +1624,12 @@ package Sem_Util is
-- This is used as a defense mechanism against ill-formed trees caused by
-- previous errors (particularly in -gnatq mode).
+ function Requires_State_Refinement
+ (Spec_Id : Entity_Id;
+ Body_Id : Entity_Id) return Boolean;
+ -- Determine whether a package denoted by its spec and body entities
+ -- requires refinement of abstract states.
+
function Requires_Transient_Scope (Id : Entity_Id) return Boolean;
-- Id is a type entity. The result is True when temporaries of this type
-- need to be wrapped in a transient scope to be reclaimed properly when a
diff --git a/main/gcc/ada/sem_warn.adb b/main/gcc/ada/sem_warn.adb
index c2bef7add10..3c12676c52d 100644
--- a/main/gcc/ada/sem_warn.adb
+++ b/main/gcc/ada/sem_warn.adb
@@ -307,7 +307,7 @@ package body Sem_Warn is
return;
-- Forget it if function name is suspicious. A strange test
- -- but warning generation is in the heuristics business!
+ -- but warning generation is in the heuristics business.
elsif Is_Suspicious_Function_Name (Entity (Name (N))) then
return;
@@ -495,7 +495,7 @@ package body Sem_Warn is
-- going on (perhaps a node with no parent that should
-- have one but does not?) As always, for a warning we
-- prefer to just abandon the warning than get into the
- -- business of complaining about the tree structure here!
+ -- business of complaining about the tree structure here.
if No (P)
or else Nkind (P) = N_Procedure_Call_Statement
@@ -1144,7 +1144,7 @@ package body Sem_Warn is
-- No warning if fully initialized type, except that for
-- this purpose we do not consider access types to qualify
-- as fully initialized types (relying on an access type
- -- variable being null when it is never set is a bit odd!)
+ -- variable being null when it is never set is a bit odd).
-- Also we generate warning for an out parameter that is
-- never referenced, since again it seems odd to rely on
@@ -1315,6 +1315,14 @@ package body Sem_Warn is
UR := Expression (UR);
end loop;
+ -- Don't issue warning if appearing inside Initial_Condition
+ -- pragma or aspect, since that expression is not evaluated
+ -- at the point where it occurs in the source.
+
+ if In_Pragma_Expression (UR, Name_Initial_Condition) then
+ goto Continue;
+ end if;
+
-- Here we issue the warning, all checks completed
-- If we have a return statement, this was a case of an OUT
@@ -1380,7 +1388,6 @@ package body Sem_Warn is
end if;
end if;
end if;
-
-- All other cases of unset reference active
elsif not Warnings_Off_E1 then
@@ -1507,7 +1514,7 @@ package body Sem_Warn is
and then Ekind (E1) /= E_Class_Wide_Type
-- Objects other than parameters of task types are allowed to
- -- be non-referenced, since they start up tasks!
+ -- be non-referenced, since they start up tasks.
and then ((Ekind (E1) /= E_Variable
and then Ekind (E1) /= E_Constant
@@ -1768,7 +1775,7 @@ package body Sem_Warn is
-- allow the reference to appear in a loop, block, or
-- package spec that is nested within the declaring scope.
-- As always, it is possible to construct cases where the
- -- warning is wrong, that is why it is a warning!
+ -- warning is wrong, that is why it is a warning.
Potential_Unset_Reference : declare
SR : Entity_Id;
@@ -2341,7 +2348,7 @@ package body Sem_Warn is
end if;
-- If main unit is a renaming of this unit, then we consider
- -- the with to be OK (obviously it is needed in this case!)
+ -- the with to be OK (obviously it is needed in this case).
-- This may be transitive: the unit in the with_clause may
-- itself be a renaming, in which case both it and the main
-- unit rename the same ultimate package.
@@ -3004,7 +3011,7 @@ package body Sem_Warn is
E : Node_Id renames Wentry.E;
begin
- -- Turn off Warnings_Off, or we won't get the warning!
+ -- Turn off Warnings_Off, or we won't get the warning
Set_Warnings_Off (E, False);
@@ -3632,7 +3639,7 @@ package body Sem_Warn is
-- Nothing to do if subscript does not come from source (we don't
-- want to give garbage warnings on compiler expanded code, e.g. the
-- loops generated for slice assignments. Such junk warnings would
- -- be placed on source constructs with no subscript in sight!)
+ -- be placed on source constructs with no subscript in sight).
if not Comes_From_Source (Original_Node (X)) then
return;
@@ -3730,7 +3737,7 @@ package body Sem_Warn is
end if;
-- If we have a 'Range reference, then this is a case
- -- where we cannot easily give a replacement. Don't try!
+ -- where we cannot easily give a replacement. Don't try.
if Tref (Sref .. Sref + 4) = "range"
and then Tref (Sref - 1) < 'A'
diff --git a/main/gcc/ada/sem_warn.ads b/main/gcc/ada/sem_warn.ads
index 22a3c6c42ef..131b7b80399 100644
--- a/main/gcc/ada/sem_warn.ads
+++ b/main/gcc/ada/sem_warn.ads
@@ -127,7 +127,7 @@ package Sem_Warn is
-- the end of the compilation process (see body of this routine for a
-- discussion of why this is done). This procedure outputs the warnings.
-- Note: this should be called before Output_Unreferenced_Messages, since
- -- if we have an IN OUT warning, that's the one we want to see!
+ -- if we have an IN OUT warning, that's the one we want to see.
procedure Output_Obsolescent_Entity_Warnings (N : Node_Id; E : Entity_Id);
-- N is a reference to obsolescent entity E, for which appropriate warning
diff --git a/main/gcc/ada/set_targ.adb b/main/gcc/ada/set_targ.adb
index 83ba3313483..a4a811d6bdb 100755
--- a/main/gcc/ada/set_targ.adb
+++ b/main/gcc/ada/set_targ.adb
@@ -607,7 +607,7 @@ begin
Buffer : String (1 .. 2000);
Buflen : Natural;
- -- File information and length (2000 easily enough!)
+ -- File information and length (2000 easily enough)
Nam_Buf : String (1 .. 40);
Nam_Len : Natural;
diff --git a/main/gcc/ada/sinfo.ads b/main/gcc/ada/sinfo.ads
index 61c7da4c7c4..6aa28f2153a 100644
--- a/main/gcc/ada/sinfo.ads
+++ b/main/gcc/ada/sinfo.ads
@@ -1491,7 +1491,7 @@ package Sinfo is
-- that the reference occurs within a discriminant check. The
-- significance is that optimizations based on assuming that the
-- discriminant check has a correct value cannot be performed in this
- -- case (or the discriminant check may be optimized away!)
+ -- case (or the discriminant check may be optimized away).
-- Is_Machine_Number (Flag11-Sem)
-- This flag is set in an N_Real_Literal node to indicate that the value
@@ -2655,7 +2655,7 @@ package Sinfo is
-- appears directly in the tree as an attribute reference.
-- Note: the field name for a reference to a range is Range_Expression
- -- rather than Range, because range is a reserved keyword in Ada!
+ -- rather than Range, because range is a reserved keyword in Ada.
-- Note: the reason that this node has expression fields is that a
-- range can appear as an operand of a membership test. The Etype
@@ -4942,7 +4942,7 @@ package Sinfo is
-------------------------
-- This is an Ada 2012 extension, we put it here for now, to be labeled
- -- and put in its proper section when we know exactly where that is!
+ -- and put in its proper section when we know exactly where that is.
-- EXPRESSION_FUNCTION ::=
-- FUNCTION SPECIFICATION IS (EXPRESSION)
@@ -4965,7 +4965,7 @@ package Sinfo is
-- that it semantically resembles an expression, e.g. overloading is
-- allowed and a type is concocted for semantic processing purposes.
-- Certain of these fields, such as Parens are not relevant, but it
- -- is easier to just supply all of them together!
+ -- is easier to just supply all of them together.
-- N_Procedure_Call_Statement
-- Sloc points to first token of name or prefix
@@ -7260,6 +7260,7 @@ package Sinfo is
-- Postcondition
-- Pre
-- Precondition
+ -- Refined_Post
-- The ordering in the list is in LIFO fashion.
-- Note that there might be multiple preconditions or postconditions
@@ -7283,6 +7284,7 @@ package Sinfo is
-- Global
-- Initial_Condition
-- Initializes
+ -- Part_Of
-- Refined_Depends
-- Refined_Global
-- Refined_States
@@ -8231,7 +8233,7 @@ package Sinfo is
N_Unused_At_End);
for Node_Kind'Size use 8;
- -- The data structures in Atree assume this!
+ -- The data structures in Atree assume this
----------------------------
-- Node Class Definitions --
diff --git a/main/gcc/ada/sinput-c.adb b/main/gcc/ada/sinput-c.adb
index 83dadaf408c..06c501bef25 100644
--- a/main/gcc/ada/sinput-c.adb
+++ b/main/gcc/ada/sinput-c.adb
@@ -50,7 +50,7 @@ package body Sinput.C is
-- indicates failure to open the specified source file.
Len : Integer;
- -- Length of file. Assume no more than 2 gigabytes of source!
+ -- Length of file (assume no more than 2 gigabytes of source)
Actual_Len : Integer;
@@ -147,7 +147,7 @@ package body Sinput.C is
end;
-- Read is complete, close the file and we are done (no need to test
- -- status from close, since we have successfully read the file!)
+ -- status from close, since we have successfully read the file).
Close (Source_File_FD);
diff --git a/main/gcc/ada/snames.ads-tmpl b/main/gcc/ada/snames.ads-tmpl
index a018dc9aaa0..ecbf42cb099 100644
--- a/main/gcc/ada/snames.ads-tmpl
+++ b/main/gcc/ada/snames.ads-tmpl
@@ -52,7 +52,7 @@ package Snames is
-- cause a duplicate, then list it only once in this table, and adjust the
-- definition of the functions for testing for pragma names and attribute
-- names, and returning their ID values. Of course everything is simpler if
- -- no such duplications occur!
+ -- no such duplications occur.
-- First we have the one character names used to optimize the lookup
-- process for one character identifiers (to avoid the hashing in this
@@ -565,6 +565,7 @@ package Snames is
Name_Ordered : constant Name_Id := N + $; -- GNAT
Name_Pack : constant Name_Id := N + $;
Name_Page : constant Name_Id := N + $;
+ Name_Part_Of : constant Name_Id := N + $; -- GNAT
Name_Passive : constant Name_Id := N + $; -- GNAT
Name_Post : constant Name_Id := N + $; -- GNAT
Name_Postcondition : constant Name_Id := N + $; -- GNAT
@@ -761,7 +762,6 @@ package Snames is
Name_Optional : constant Name_Id := N + $;
Name_Policy : constant Name_Id := N + $;
Name_Parameter_Types : constant Name_Id := N + $;
- Name_Part_Of : constant Name_Id := N + $;
Name_Proof_In : constant Name_Id := N + $;
Name_Reason : constant Name_Id := N + $;
Name_Reference : constant Name_Id := N + $;
@@ -1870,6 +1870,7 @@ package Snames is
Pragma_Ordered,
Pragma_Pack,
Pragma_Page,
+ Pragma_Part_Of,
Pragma_Passive,
Pragma_Post,
Pragma_Postcondition,
diff --git a/main/gcc/ada/sprint.adb b/main/gcc/ada/sprint.adb
index 9e8362fa223..1f88158ea64 100644
--- a/main/gcc/ada/sprint.adb
+++ b/main/gcc/ada/sprint.adb
@@ -2009,7 +2009,7 @@ package body Sprint is
Sprint_Node (Condition);
Write_Str_With_Col_Check (" then ");
- -- Defense against junk here!
+ -- Defense against junk here
if Present (Then_Expr) then
Sprint_Node (Then_Expr);
@@ -4007,7 +4007,7 @@ package body Sprint is
and then Defining_Entity (P) = Typ
then
-- We must set Itype_Printed true before the recursive call to
- -- print the node, otherwise we get an infinite recursion!
+ -- print the node, otherwise we get an infinite recursion.
Set_Itype_Printed (Typ, True);
diff --git a/main/gcc/ada/stand.ads b/main/gcc/ada/stand.ads
index 0f6b876937e..db43c59742d 100644
--- a/main/gcc/ada/stand.ads
+++ b/main/gcc/ada/stand.ads
@@ -153,7 +153,7 @@ package Stand is
S_RS, -- 16#1E#
S_US, -- 16#1F#
- -- Here are the ones for Colonel Whitaker's O26 keypunch!
+ -- Here are the ones for Colonel Whitaker's O26 keypunch
S_Exclam, -- 16#21#
S_Quotation, -- 16#22#
diff --git a/main/gcc/ada/system-vms-ia64.ads b/main/gcc/ada/system-vms-ia64.ads
index 2f1c27c9ff1..0b7f9475150 100644
--- a/main/gcc/ada/system-vms-ia64.ads
+++ b/main/gcc/ada/system-vms-ia64.ads
@@ -249,7 +249,7 @@ private
ADA_GNAT : constant Boolean := True;
pragma Export_Object (ADA_GNAT, "ADA$GNAT");
-- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug.
- -- Do not remove!
+ -- Do not remove.
pragma Ident ("GNAT"); -- Gnat_Static_Version_String
-- Default ident for all VMS images.
diff --git a/main/gcc/ada/system-vms_64.ads b/main/gcc/ada/system-vms_64.ads
index b8c57de9991..cc03c165968 100644
--- a/main/gcc/ada/system-vms_64.ads
+++ b/main/gcc/ada/system-vms_64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS 64bit GCC_ZCX DEC Threads Version) --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -144,6 +144,7 @@ private
Machine_Overflows : constant Boolean := False;
Machine_Rounds : constant Boolean := True;
OpenVMS : constant Boolean := True;
+ VAX_Float : constant Boolean := False;
Preallocated_Stacks : constant Boolean := False;
Signed_Zeros : constant Boolean := True;
Stack_Check_Default : constant Boolean := True;
@@ -248,7 +249,7 @@ private
ADA_GNAT : constant Boolean := True;
pragma Export_Object (ADA_GNAT, "ADA$GNAT");
-- Ubiquitous global symbol identifying a GNAT compiled image to VMS Debug.
- -- Do not remove!
+ -- Do not remove.
pragma Ident ("GNAT"); -- Gnat_Static_Version_String
-- Default ident for all VMS images.
diff --git a/main/gcc/ada/system.ads b/main/gcc/ada/system.ads
index d38a53337ae..7f6f13b1a1e 100644
--- a/main/gcc/ada/system.ads
+++ b/main/gcc/ada/system.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Compiler Version) --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -163,7 +163,7 @@ private
Use_Ada_Main_Program_Name : constant Boolean := False;
ZCX_By_Default : constant Boolean := False;
- -- Obsolete entries, to be removed eventually (bootstrap issues!)
+ -- Obsolete entries, to be removed eventually (bootstrap issues)
Front_End_ZCX_Support : constant Boolean := False;
High_Integrity_Mode : constant Boolean := False;
diff --git a/main/gcc/ada/treepr.adb b/main/gcc/ada/treepr.adb
index f14813013b1..0bfc6e3dab3 100644
--- a/main/gcc/ada/treepr.adb
+++ b/main/gcc/ada/treepr.adb
@@ -51,7 +51,7 @@ package body Treepr is
use Atree.Unchecked_Access;
-- This module uses the unchecked access functions in package Atree
-- since it does an untyped traversal of the tree (we do not want to
- -- count on the structure of the tree being correct in this routine!)
+ -- count on the structure of the tree being correct in this routine).
----------------------------------
-- Approach Used for Tree Print --
@@ -100,7 +100,7 @@ package body Treepr is
-- set proper node numbers in the hash table, and during the printing
-- phase to make sure that a given node is not printed more than once.
-- (nodes are printed in order during the printing phase, that's the
- -- point of numbering them in the first place!)
+ -- point of numbering them in the first place).
Printing_Descendants : Boolean;
-- True if descendants are being printed, False if not. In the false case,
@@ -1935,7 +1935,7 @@ package body Treepr is
-- If we successfully fall through all the above tests (which
-- execute a return if the node is not to be visited), we can
- -- go ahead and visit the node!
+ -- go ahead and visit the node.
if No_Indent then
Visit_Node (Nod, Prefix_Str, Prefix_Char);
diff --git a/main/gcc/ada/treepr.ads b/main/gcc/ada/treepr.ads
index d33e93bb21e..2d1fb93e8e0 100644
--- a/main/gcc/ada/treepr.ads
+++ b/main/gcc/ada/treepr.ads
@@ -82,7 +82,7 @@ package Treepr is
-- Same as Print_Node_Subtree
-- The following are no longer really needed, now that pn will print
- -- anything you throw at it!
+ -- anything you throw at it.
procedure pe (E : Elist_Id);
pragma Export (Ada, pe);
diff --git a/main/gcc/ada/types.ads b/main/gcc/ada/types.ads
index 6ab03820fd5..58b343860f7 100644
--- a/main/gcc/ada/types.ads
+++ b/main/gcc/ada/types.ads
@@ -43,7 +43,7 @@
-- Note: the declarations in this package reflect an expectation that the host
-- machine has an efficient integer base type with a range at least 32 bits
-- 2s-complement. If there are any machines for which this is not a correct
--- assumption, a significant number of changes will be required!
+-- assumption, a significant number of changes will be required.
with System;
with Unchecked_Conversion;
diff --git a/main/gcc/ada/uintp.adb b/main/gcc/ada/uintp.adb
index bc014666224..f418b56ce9e 100644
--- a/main/gcc/ada/uintp.adb
+++ b/main/gcc/ada/uintp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1517,7 +1517,7 @@ package body Uintp is
-- possible, substituting Int arithmetic instead. See Knuth volume II,
-- Algorithm L (page 329).
- -- We use the same notation as Knuth (U_Hat standing for the obvious!)
+ -- We use the same notation as Knuth (U_Hat standing for the obvious)
function UI_GCD (Uin, Vin : Uint) return Uint is
U, V : Uint;
diff --git a/main/gcc/ada/uname.adb b/main/gcc/ada/uname.adb
index 5f2026f2231..e0a1e724db5 100644
--- a/main/gcc/ada/uname.adb
+++ b/main/gcc/ada/uname.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -241,7 +241,7 @@ package body Uname is
-- Note: it is of course an error to have a defining
-- operator symbol at this point, but this is not where
- -- the error is signalled, so we handle it nicely here!
+ -- the error is signalled, so we handle it nicely here.
Add_Name (Chars (Node));
diff --git a/main/gcc/ada/urealp.adb b/main/gcc/ada/urealp.adb
index 029789938f1..83bdff6cd5d 100644
--- a/main/gcc/ada/urealp.adb
+++ b/main/gcc/ada/urealp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,7 +38,7 @@ package body Urealp is
Ureal_First_Entry : constant Ureal := Ureal'Succ (No_Ureal);
-- First subscript allocated in Ureal table (note that we can't just
- -- add 1 to No_Ureal, since "+" means something different for Ureals!
+ -- add 1 to No_Ureal, since "+" means something different for Ureals).
type Ureal_Entry is record
Num : Uint;
diff --git a/main/gcc/ada/usage.adb b/main/gcc/ada/usage.adb
index 4f68440fb1d..af8fd7793d8 100644
--- a/main/gcc/ada/usage.adb
+++ b/main/gcc/ada/usage.adb
@@ -122,8 +122,7 @@ begin
-- Individual lines for switches. Write_Switch_Char outputs fourteen
-- characters, so the remaining message is allowed to be a maximum
- -- of 65 characters to be comfortable on an 80 character device.
- -- If the Write_Str fits on one line, it is short enough!
+ -- of 65 characters to be comfortable in an 80 character window.
-- Line for -gnata switch
diff --git a/main/gcc/ada/vms_conv.adb b/main/gcc/ada/vms_conv.adb
index a499b9dd2d6..36322350faa 100644
--- a/main/gcc/ada/vms_conv.adb
+++ b/main/gcc/ada/vms_conv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1737,7 +1737,7 @@ package body VMS_Conv is
Sw : Item_Ptr;
SwP : Natural;
P2 : Natural;
- Endp : Natural := 0; -- avoid warning!
+ Endp : Natural := 0; -- avoid warning
Opt : Item_Ptr;
begin
diff --git a/main/gcc/ada/vxaddr2line.adb b/main/gcc/ada/vxaddr2line.adb
index 028de5e5fbf..b65ebc6acd6 100644
--- a/main/gcc/ada/vxaddr2line.adb
+++ b/main/gcc/ada/vxaddr2line.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2011, AdaCore --
+-- Copyright (C) 2002-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -425,7 +425,7 @@ begin
Usage;
end if;
- -- ??? HARD LIMIT! There should be at most 501 arguments
+ -- Enforce HARD LIMIT There should be at most 501 arguments. Why 501???
if Argument_Count > 501 then
Error ("Too many backtrace frames");
diff --git a/main/gcc/builtins.c b/main/gcc/builtins.c
index 3e34c83858b..a45380ce877 100644
--- a/main/gcc/builtins.c
+++ b/main/gcc/builtins.c
@@ -6205,20 +6205,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
}
break;
- case BUILT_IN_SETJMP_DISPATCHER:
- /* __builtin_setjmp_dispatcher is passed the dispatcher label. */
- if (validate_arglist (exp, POINTER_TYPE, VOID_TYPE))
- {
- tree label = TREE_OPERAND (CALL_EXPR_ARG (exp, 0), 0);
- rtx label_r = label_rtx (label);
-
- /* Remove the dispatcher label from the list of non-local labels
- since the receiver labels have been added to it above. */
- remove_node_from_expr_list (label_r, &nonlocal_goto_handler_labels);
- return const0_rtx;
- }
- break;
-
case BUILT_IN_SETJMP_RECEIVER:
/* __builtin_setjmp_receiver is passed the receiver label. */
if (validate_arglist (exp, POINTER_TYPE, VOID_TYPE))
diff --git a/main/gcc/builtins.def b/main/gcc/builtins.def
index 524153f22a5..2443a45751b 100644
--- a/main/gcc/builtins.def
+++ b/main/gcc/builtins.def
@@ -783,7 +783,6 @@ DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto")
/* Implementing __builtin_setjmp. */
DEF_BUILTIN_STUB (BUILT_IN_SETJMP_SETUP, "__builtin_setjmp_setup")
-DEF_BUILTIN_STUB (BUILT_IN_SETJMP_DISPATCHER, "__builtin_setjmp_dispatcher")
DEF_BUILTIN_STUB (BUILT_IN_SETJMP_RECEIVER, "__builtin_setjmp_receiver")
/* Implementing variable sized local variables. */
diff --git a/main/gcc/c-family/c-common.c b/main/gcc/c-family/c-common.c
index f8015035143..d891e5ca5c3 100644
--- a/main/gcc/c-family/c-common.c
+++ b/main/gcc/c-family/c-common.c
@@ -11726,6 +11726,10 @@ check_for_self_assign (location_t location, tree lhs, tree rhs)
/* Only emit a warning if RHS is not a folded expression so that we don't
warn on something like x = x / 1. */
if (!EXPR_FOLDED (rhs)
+ /* TODO -- check the correctness of the fix to avoid ICE
+ of Wself-assign-non-pod-1.C. */
+ /* During parsing of template, type can be null */
+ && TREE_TYPE (rhs) && TREE_TYPE (lhs)
&& operand_equal_p (lhs, rhs,
OEP_PURE_SAME | OEP_ALLOW_NULL | OEP_ALLOW_NO_TYPE))
warning_at (location, OPT_Wself_assign, G_("%qE is assigned to itself"),
diff --git a/main/gcc/config/aarch64/aarch64.c b/main/gcc/config/aarch64/aarch64.c
index 57b66455dc3..d3c5cbc7ace 100644
--- a/main/gcc/config/aarch64/aarch64.c
+++ b/main/gcc/config/aarch64/aarch64.c
@@ -916,7 +916,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
if (offset != const0_rtx
&& targetm.cannot_force_const_mem (mode, imm))
{
- gcc_assert(can_create_pseudo_p ());
+ gcc_assert (can_create_pseudo_p ());
base = aarch64_force_temporary (mode, dest, base);
base = aarch64_add_offset (mode, NULL, base, INTVAL (offset));
aarch64_emit_move (dest, base);
@@ -3249,7 +3249,7 @@ aarch64_legitimate_address_hook_p (enum machine_mode mode, rtx x, bool strict_p)
pair operation. */
bool
aarch64_legitimate_address_p (enum machine_mode mode, rtx x,
- RTX_CODE outer_code, bool strict_p)
+ RTX_CODE outer_code, bool strict_p)
{
struct aarch64_address_info addr;
@@ -4256,7 +4256,7 @@ aarch64_class_max_nregs (reg_class_t regclass, enum machine_mode mode)
case FP_LO_REGS:
return
aarch64_vector_mode_p (mode) ? (GET_MODE_SIZE (mode) + 15) / 16 :
- (GET_MODE_SIZE (mode) + 7) / 8;
+ (GET_MODE_SIZE (mode) + 7) / 8;
case STACK_REG:
return 1;
diff --git a/main/gcc/config/arm/arm-arches.def b/main/gcc/config/arm/arm-arches.def
index ac543ee62ad..9adb791db60 100644
--- a/main/gcc/config/arm/arm-arches.def
+++ b/main/gcc/config/arm/arm-arches.def
@@ -50,6 +50,7 @@ ARM_ARCH("armv6-m", cortexm1, 6M, FL_FOR_ARCH6M)
ARM_ARCH("armv6s-m", cortexm1, 6M, FL_FOR_ARCH6M)
ARM_ARCH("armv7", cortexa8, 7, FL_CO_PROC | FL_FOR_ARCH7)
ARM_ARCH("armv7-a", cortexa8, 7A, FL_CO_PROC | FL_FOR_ARCH7A)
+ARM_ARCH("armv7ve", cortexa8, 7A, FL_CO_PROC | FL_FOR_ARCH7VE)
ARM_ARCH("armv7-r", cortexr4, 7R, FL_CO_PROC | FL_FOR_ARCH7R)
ARM_ARCH("armv7-m", cortexm3, 7M, FL_CO_PROC | FL_FOR_ARCH7M)
ARM_ARCH("armv7e-m", cortexm4, 7EM, FL_CO_PROC | FL_FOR_ARCH7EM)
diff --git a/main/gcc/config/arm/arm.c b/main/gcc/config/arm/arm.c
index fc81bf68407..825407feae3 100644
--- a/main/gcc/config/arm/arm.c
+++ b/main/gcc/config/arm/arm.c
@@ -764,11 +764,11 @@ static int thumb_call_reg_needed;
#define FL_FOR_ARCH6M (FL_FOR_ARCH6 & ~FL_NOTM)
#define FL_FOR_ARCH7 ((FL_FOR_ARCH6T2 & ~FL_NOTM) | FL_ARCH7)
#define FL_FOR_ARCH7A (FL_FOR_ARCH7 | FL_NOTM | FL_ARCH6K)
+#define FL_FOR_ARCH7VE (FL_FOR_ARCH7A | FL_THUMB_DIV | FL_ARM_DIV)
#define FL_FOR_ARCH7R (FL_FOR_ARCH7A | FL_THUMB_DIV)
#define FL_FOR_ARCH7M (FL_FOR_ARCH7 | FL_THUMB_DIV)
#define FL_FOR_ARCH7EM (FL_FOR_ARCH7M | FL_ARCH7EM)
-#define FL_FOR_ARCH8A (FL_FOR_ARCH7 | FL_ARCH6K | FL_ARCH8 | FL_THUMB_DIV \
- | FL_ARM_DIV | FL_NOTM)
+#define FL_FOR_ARCH8A (FL_FOR_ARCH7VE | FL_ARCH8)
/* The bits in this mask specify which
instructions we are allowed to generate. */
@@ -10390,7 +10390,6 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
const_int_cost:
if (mode == SImode)
{
- *cost += 0;
*cost += COSTS_N_INSNS (arm_gen_constant (outer_code, SImode, NULL,
INTVAL (x), NULL, NULL,
0, 0));
@@ -27860,20 +27859,34 @@ arm_file_start (void)
const char *fpu_name;
if (arm_selected_arch)
{
- const char* pos = strchr (arm_selected_arch->name, '+');
- if (pos)
+ /* armv7ve doesn't support any extensions. */
+ if (strcmp (arm_selected_arch->name, "armv7ve") == 0)
{
- char buf[15];
- gcc_assert (strlen (arm_selected_arch->name)
- <= sizeof (buf) / sizeof (*pos));
- strncpy (buf, arm_selected_arch->name,
- (pos - arm_selected_arch->name) * sizeof (*pos));
- buf[pos - arm_selected_arch->name] = '\0';
- asm_fprintf (asm_out_file, "\t.arch %s\n", buf);
- asm_fprintf (asm_out_file, "\t.arch_extension %s\n", pos + 1);
+ /* Keep backward compatability for assemblers
+ which don't support armv7ve. */
+ asm_fprintf (asm_out_file, "\t.arch armv7-a\n");
+ asm_fprintf (asm_out_file, "\t.arch_extension virt\n");
+ asm_fprintf (asm_out_file, "\t.arch_extension idiv\n");
+ asm_fprintf (asm_out_file, "\t.arch_extension sec\n");
+ asm_fprintf (asm_out_file, "\t.arch_extension mp\n");
}
else
- asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_arch->name);
+ {
+ const char* pos = strchr (arm_selected_arch->name, '+');
+ if (pos)
+ {
+ char buf[15];
+ gcc_assert (strlen (arm_selected_arch->name)
+ <= sizeof (buf) / sizeof (*pos));
+ strncpy (buf, arm_selected_arch->name,
+ (pos - arm_selected_arch->name) * sizeof (*pos));
+ buf[pos - arm_selected_arch->name] = '\0';
+ asm_fprintf (asm_out_file, "\t.arch %s\n", buf);
+ asm_fprintf (asm_out_file, "\t.arch_extension %s\n", pos + 1);
+ }
+ else
+ asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_arch->name);
+ }
}
else if (strncmp (arm_selected_cpu->name, "generic", 7) == 0)
asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_cpu->name + 8);
diff --git a/main/gcc/config/arm/bpabi.h b/main/gcc/config/arm/bpabi.h
index 0c0be67fb3f..bc223f8e300 100644
--- a/main/gcc/config/arm/bpabi.h
+++ b/main/gcc/config/arm/bpabi.h
@@ -66,6 +66,7 @@
|mcpu=cortex-a57 \
|mcpu=cortex-a57.cortex-a53 \
|mcpu=generic-armv7-a \
+ |march=armv7ve \
|march=armv7-m|mcpu=cortex-m3 \
|march=armv7e-m|mcpu=cortex-m4 \
|march=armv6-m|mcpu=cortex-m0 \
@@ -83,6 +84,7 @@
|mcpu=cortex-a57.cortex-a53 \
|mcpu=marvell-pj4 \
|mcpu=generic-armv7-a \
+ |march=armv7ve \
|march=armv7-m|mcpu=cortex-m3 \
|march=armv7e-m|mcpu=cortex-m4 \
|march=armv6-m|mcpu=cortex-m0 \
diff --git a/main/gcc/config/arm/driver-arm.c b/main/gcc/config/arm/driver-arm.c
index 7460aee438d..6d9c4174c96 100644
--- a/main/gcc/config/arm/driver-arm.c
+++ b/main/gcc/config/arm/driver-arm.c
@@ -37,11 +37,11 @@ static struct vendor_cpu arm_cpu_table[] = {
{"0xb56", "armv6t2", "arm1156t2-s"},
{"0xb76", "armv6zk", "arm1176jz-s"},
{"0xc05", "armv7-a", "cortex-a5"},
- {"0xc07", "armv7-a", "cortex-a7"},
+ {"0xc07", "armv7ve", "cortex-a7"},
{"0xc08", "armv7-a", "cortex-a8"},
{"0xc09", "armv7-a", "cortex-a9"},
- {"0xc0d", "armv7-a", "cortex-a12"},
- {"0xc0f", "armv7-a", "cortex-a15"},
+ {"0xc0d", "armv7ve", "cortex-a12"},
+ {"0xc0f", "armv7ve", "cortex-a15"},
{"0xc14", "armv7-r", "cortex-r4"},
{"0xc15", "armv7-r", "cortex-r5"},
{"0xc20", "armv6-m", "cortex-m0"},
diff --git a/main/gcc/config/arm/t-aprofile b/main/gcc/config/arm/t-aprofile
index ad7ccd187be..b968711c16c 100644
--- a/main/gcc/config/arm/t-aprofile
+++ b/main/gcc/config/arm/t-aprofile
@@ -37,12 +37,10 @@ MULTILIB_REUSE =
# NEON-VFPV4 (simdvfpv4), NEON for ARMv8 (simdv8), or None (.).
# Float-abi: Soft (.), softfp (softfp), or hard (hardfp).
-# We use the option -mcpu=cortex-a7 because we do not yet have march=armv7ve
-# or march=armv7a+virt as a command line option for the compiler.
MULTILIB_OPTIONS += mthumb
MULTILIB_DIRNAMES += thumb
-MULTILIB_OPTIONS += march=armv7-a/mcpu=cortex-a7/march=armv8-a
+MULTILIB_OPTIONS += march=armv7-a/march=armv7ve/march=armv8-a
MULTILIB_DIRNAMES += v7-a v7ve v8-a
MULTILIB_OPTIONS += mfpu=vfpv3-d16/mfpu=neon/mfpu=vfpv4-d16/mfpu=neon-vfpv4/mfpu=neon-fp-armv8
@@ -64,12 +62,12 @@ MULTILIB_EXCEPTIONS += mfpu=*
MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=*
MULTILIB_EXCEPTIONS += mthumb/mfpu=*
MULTILIB_EXCEPTIONS += *march=armv7-a/mfloat-abi=*
-MULTILIB_EXCEPTIONS += *mcpu=cortex-a7/mfloat-abi=*
+MULTILIB_EXCEPTIONS += *march=armv7ve/mfloat-abi=*
MULTILIB_EXCEPTIONS += *march=armv8-a/mfloat-abi=*
# Ensure the correct FPU variants apply to the correct base architectures.
-MULTILIB_EXCEPTIONS += *mcpu=cortex-a7/*mfpu=vfpv3-d16*
-MULTILIB_EXCEPTIONS += *mcpu=cortex-a7/*mfpu=neon/*
+MULTILIB_EXCEPTIONS += *march=armv7ve/*mfpu=vfpv3-d16*
+MULTILIB_EXCEPTIONS += *march=armv7ve/*mfpu=neon/*
MULTILIB_EXCEPTIONS += *march=armv8-a/*mfpu=vfpv3-d16*
MULTILIB_EXCEPTIONS += *march=armv8-a/*mfpu=neon/*
MULTILIB_EXCEPTIONS += *march=armv7-a/*mfpu=vfpv4-d16*
@@ -77,14 +75,14 @@ MULTILIB_EXCEPTIONS += *march=armv7-a/*mfpu=neon-vfpv4*
MULTILIB_EXCEPTIONS += *march=armv8-a/*mfpu=vfpv4-d16*
MULTILIB_EXCEPTIONS += *march=armv8-a/*mfpu=neon-vfpv4*
MULTILIB_EXCEPTIONS += *march=armv7-a/*mfpu=neon-fp-armv8*
-MULTILIB_EXCEPTIONS += *mcpu=cortex-a7/*mfpu=neon-fp-armv8*
+MULTILIB_EXCEPTIONS += *march=armv7ve/*mfpu=neon-fp-armv8*
# CPU Matches
MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a8
MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a9
MULTILIB_MATCHES += march?armv7-a=mcpu?cortex-a5
-MULTILIB_MATCHES += mcpu?cortex-a7=mcpu?cortex-a15=mcpu?cortex-a12
-MULTILIB_MATCHES += mcpu?cortex-a7=mcpu?cortex-a15.cortex-a7
+MULTILIB_MATCHES += march?armv7ve=mcpu?cortex-a15=mcpu?cortex-a12
+MULTILIB_MATCHES += march?armv7ve=mcpu?cortex-a15.cortex-a7
MULTILIB_MATCHES += march?armv8-a=mcpu?cortex-a53
MULTILIB_MATCHES += march?armv8-a=mcpu?cortex-a57
MULTILIB_MATCHES += march?armv8-a=mcpu?cortex-a57.cortex-a53
@@ -105,8 +103,8 @@ MULTILIB_MATCHES += mfpu?neon-fp-armv8=mfpu?crypto-neon-fp-armv8
# This applies to any similar combination at the v7ve and v8-a arch
# levels.
-MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mcpu.cortex-a7/mfpu.vfpv3-d16/mfloat-abi.hard
-MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=mcpu.cortex-a7/mfpu.vfpv3-d16/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7ve/mfpu.vfpv3-d16/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=march.armv7ve/mfpu.vfpv3-d16/mfloat-abi.softfp
MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv8-a/mfpu.vfpv3-d16/mfloat-abi.hard
MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=march.armv8-a/mfpu.vfpv3-d16/mfloat-abi.softfp
MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7-a/mfpu.vfpv4-d16/mfloat-abi.hard
@@ -117,8 +115,8 @@ MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=march.armv7
MULTILIB_REUSE += march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=march.armv7-a/mfpu.vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.hard=mcpu.cortex-a7/mfpu.neon/mfloat-abi.hard
-MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.softfp=mcpu.cortex-a7/mfpu.neon/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.hard=march.armv7ve/mfpu.neon/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.softfp=march.armv7ve/mfpu.neon/mfloat-abi.softfp
MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.hard=march.armv8-a/mfpu.neon/mfloat-abi.hard
MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.softfp=march.armv8-a/mfpu.neon/mfloat-abi.softfp
MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.hard=march.armv7-a/mfpu.neon-vfpv4/mfloat-abi.hard
@@ -127,25 +125,25 @@ MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.hard=march.armv7-a/mf
MULTILIB_REUSE += march.armv7-a/mfpu.neon/mfloat-abi.softfp=march.armv7-a/mfpu.neon-fp-armv8/mfloat-abi.softfp
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=mcpu.cortex-a7/mfpu.fp-armv8/mfloat-abi.hard
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=mcpu.cortex-a7/mfpu.fp-armv8/mfloat-abi.softfp
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=march.armv8-a/mfpu.vfpv4/mfloat-abi.hard
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=march.armv8-a/mfpu.vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.hard
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=march.armv7ve/mfpu.fp-armv8/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=march.armv7ve/mfpu.fp-armv8/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=march.armv8-a/mfpu.vfpv4/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=march.armv8-a/mfpu.vfpv4/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.softfp
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.hard=march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.hard
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.softfp=march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.hard=mcpu.cortex-a7/mfpu.neon-fp-armv8/mfloat-abi.hard
-MULTILIB_REUSE += mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.softfp=mcpu.cortex-a7/mfpu.neon-fp-armv8/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.hard=march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.softfp=march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.softfp
+MULTILIB_REUSE += march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.hard=march.armv7ve/mfpu.neon-fp-armv8/mfloat-abi.hard
+MULTILIB_REUSE += march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.softfp=march.armv7ve/mfpu.neon-fp-armv8/mfloat-abi.softfp
# And again for mthumb.
-MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mthumb/mcpu.cortex-a7/mfpu.vfpv3-d16/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/mcpu.cortex-a7/mfpu.vfpv3-d16/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mthumb/march.armv7ve/mfpu.vfpv3-d16/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/march.armv7ve/mfpu.vfpv3-d16/mfloat-abi.softfp
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.vfpv3-d16/mfloat-abi.hard
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.vfpv3-d16/mfloat-abi.softfp
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mthumb/march.armv7-a/mfpu.vfpv4-d16/mfloat-abi.hard
@@ -156,8 +154,8 @@ MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.hard=mthu
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.vfpv3-d16/mfloat-abi.softfp=mthumb/march.armv7-a/mfpu.vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.hard=mthumb/mcpu.cortex-a7/mfpu.neon/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.softfp=mthumb/mcpu.cortex-a7/mfpu.neon/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.hard=mthumb/march.armv7ve/mfpu.neon/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.softfp=mthumb/march.armv7ve/mfpu.neon/mfloat-abi.softfp
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.neon/mfloat-abi.hard
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.neon/mfloat-abi.softfp
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.hard=mthumb/march.armv7-a/mfpu.neon-vfpv4/mfloat-abi.hard
@@ -166,15 +164,15 @@ MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.hard=mthumb/ma
MULTILIB_REUSE += mthumb/march.armv7-a/mfpu.neon/mfloat-abi.softfp=mthumb/march.armv7-a/mfpu.neon-fp-armv8/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/mcpu.cortex-a7/mfpu.fp-armv8/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/mcpu.cortex-a7/mfpu.fp-armv8/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.vfpv4/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/march.armv7ve/mfpu.fp-armv8/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/march.armv7ve/mfpu.fp-armv8/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.vfpv4/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.vfpv4/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.vfpv4-d16/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.vfpv4-d16/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.softfp
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.hard=mthumb/mcpu.cortex-a7/mfpu.neon-fp-armv8/mfloat-abi.hard
-MULTILIB_REUSE += mthumb/mcpu.cortex-a7/mfpu.neon-vfpv4/mfloat-abi.softfp=mthumb/mcpu.cortex-a7/mfpu.neon-fp-armv8/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.hard=mthumb/march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.softfp=mthumb/march.armv8-a/mfpu.neon-vfpv4/mfloat-abi.softfp
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.hard=mthumb/march.armv7ve/mfpu.neon-fp-armv8/mfloat-abi.hard
+MULTILIB_REUSE += mthumb/march.armv7ve/mfpu.neon-vfpv4/mfloat-abi.softfp=mthumb/march.armv7ve/mfpu.neon-fp-armv8/mfloat-abi.softfp
diff --git a/main/gcc/config/i386/gnu-user64.h b/main/gcc/config/i386/gnu-user64.h
index 8d3348368a7..1c72b41e43e 100644
--- a/main/gcc/config/i386/gnu-user64.h
+++ b/main/gcc/config/i386/gnu-user64.h
@@ -32,12 +32,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
done. */
#if TARGET_64BIT_DEFAULT
-#define SPEC_32 "m32"
+#define SPEC_32 "m16|m32"
#if TARGET_BI_ARCH == 2
#define SPEC_64 "m64"
-#define SPEC_X32 "m32|m64:;"
+#define SPEC_X32 "m16|m32|m64:;"
#else
-#define SPEC_64 "m32|mx32:;"
+#define SPEC_64 "m16|m32|mx32:;"
#define SPEC_X32 "mx32"
#endif
#else
diff --git a/main/gcc/config/i386/i386.c b/main/gcc/config/i386/i386.c
index 83cd3bcbddc..b515b06564b 100644
--- a/main/gcc/config/i386/i386.c
+++ b/main/gcc/config/i386/i386.c
@@ -3343,6 +3343,10 @@ ix86_option_override_internal (bool main_args_p,
opts->x_ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_64;
}
+ else if (TARGET_16BIT_P (opts->x_ix86_isa_flags))
+ opts->x_ix86_isa_flags &= ~(OPTION_MASK_ISA_64BIT
+ | OPTION_MASK_ABI_X32
+ | OPTION_MASK_ABI_64);
else if (TARGET_LP64_P (opts->x_ix86_isa_flags))
{
/* Always turn on OPTION_MASK_ISA_64BIT and turn off
@@ -39143,6 +39147,8 @@ static void
x86_file_start (void)
{
default_file_start ();
+ if (TARGET_16BIT)
+ fputs ("\t.code16gcc\n", asm_out_file);
#if TARGET_MACHO
darwin_file_start ();
#endif
diff --git a/main/gcc/config/i386/i386.h b/main/gcc/config/i386/i386.h
index 580a3196b27..bfb6dc6436f 100644
--- a/main/gcc/config/i386/i386.h
+++ b/main/gcc/config/i386/i386.h
@@ -135,6 +135,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_LP64_P(x) TARGET_ABI_64_P(x)
#define TARGET_X32 TARGET_ABI_X32
#define TARGET_X32_P(x) TARGET_ABI_X32_P(x)
+#define TARGET_16BIT TARGET_CODE16
+#define TARGET_16BIT_P(x) TARGET_CODE16_P(x)
/* SSE4.1 defines round instructions */
#define OPTION_MASK_ISA_ROUND OPTION_MASK_ISA_SSE4_1
diff --git a/main/gcc/config/i386/i386.opt b/main/gcc/config/i386/i386.opt
index 954ef65acdd..e51ca3135b6 100644
--- a/main/gcc/config/i386/i386.opt
+++ b/main/gcc/config/i386/i386.opt
@@ -558,9 +558,13 @@ Target RejectNegative Negative(mx32) Report Mask(ABI_64) Var(ix86_isa_flags) Sav
Generate 64bit x86-64 code
mx32
-Target RejectNegative Negative(m32) Report Mask(ABI_X32) Var(ix86_isa_flags) Save
+Target RejectNegative Negative(m16) Report Mask(ABI_X32) Var(ix86_isa_flags) Save
Generate 32bit x86-64 code
+m16
+Target RejectNegative Negative(m32) Report Mask(CODE16) InverseMask(ISA_64BIT) Var(ix86_isa_flags) Save
+Generate 16bit i386 code
+
mmmx
Target Report Mask(ISA_MMX) Var(ix86_isa_flags) Save
Support MMX built-in functions
diff --git a/main/gcc/config/rs6000/altivec.md b/main/gcc/config/rs6000/altivec.md
index 46f8acb2b33..57e8adae950 100644
--- a/main/gcc/config/rs6000/altivec.md
+++ b/main/gcc/config/rs6000/altivec.md
@@ -129,6 +129,9 @@
UNSPEC_VUPKHU_V4SF
UNSPEC_VUPKLU_V4SF
UNSPEC_VGBBD
+ UNSPEC_VMRGH_DIRECT
+ UNSPEC_VMRGL_DIRECT
+ UNSPEC_VSPLT_DIRECT
])
(define_c_enum "unspecv"
@@ -677,16 +680,16 @@
{
emit_insn (gen_altivec_vmulesh (even, operands[1], operands[2]));
emit_insn (gen_altivec_vmulosh (odd, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (high, even, odd));
- emit_insn (gen_altivec_vmrglw (low, even, odd));
+ emit_insn (gen_altivec_vmrghw_direct (high, even, odd));
+ emit_insn (gen_altivec_vmrglw_direct (low, even, odd));
emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
}
else
{
emit_insn (gen_altivec_vmulosh (even, operands[1], operands[2]));
emit_insn (gen_altivec_vmulesh (odd, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (high, odd, even));
- emit_insn (gen_altivec_vmrglw (low, odd, even));
+ emit_insn (gen_altivec_vmrghw_direct (high, odd, even));
+ emit_insn (gen_altivec_vmrglw_direct (low, odd, even));
emit_insn (gen_altivec_vpkuwum (operands[0], low, high));
}
@@ -839,9 +842,40 @@
"vmladduhm %0,%1,%2,%3"
[(set_attr "type" "veccomplex")])
-(define_insn "altivec_vmrghb"
+(define_expand "altivec_vmrghb"
+ [(use (match_operand:V16QI 0 "register_operand" ""))
+ (use (match_operand:V16QI 1 "register_operand" ""))
+ (use (match_operand:V16QI 2 "register_operand" ""))]
+ "TARGET_ALTIVEC"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (16, GEN_INT (8), GEN_INT (24), GEN_INT (9), GEN_INT (25),
+ GEN_INT (10), GEN_INT (26), GEN_INT (11), GEN_INT (27),
+ GEN_INT (12), GEN_INT (28), GEN_INT (13), GEN_INT (29),
+ GEN_INT (14), GEN_INT (30), GEN_INT (15), GEN_INT (31));
+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (16, GEN_INT (0), GEN_INT (16), GEN_INT (1), GEN_INT (17),
+ GEN_INT (2), GEN_INT (18), GEN_INT (3), GEN_INT (19),
+ GEN_INT (4), GEN_INT (20), GEN_INT (5), GEN_INT (21),
+ GEN_INT (6), GEN_INT (22), GEN_INT (7), GEN_INT (23));
+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V16QImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrghb_internal"
[(set (match_operand:V16QI 0 "register_operand" "=v")
- (vec_select:V16QI
+ (vec_select:V16QI
(vec_concat:V32QI
(match_operand:V16QI 1 "register_operand" "v")
(match_operand:V16QI 2 "register_operand" "v"))
@@ -854,12 +888,53 @@
(const_int 6) (const_int 22)
(const_int 7) (const_int 23)])))]
"TARGET_ALTIVEC"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrghb %0,%1,%2";
+ else
+ return "vmrglb %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrghb_direct"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
+ (match_operand:V16QI 2 "register_operand" "v")]
+ UNSPEC_VMRGH_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrghb %0,%1,%2"
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vmrghh"
+(define_expand "altivec_vmrghh"
+ [(use (match_operand:V8HI 0 "register_operand" ""))
+ (use (match_operand:V8HI 1 "register_operand" ""))
+ (use (match_operand:V8HI 2 "register_operand" ""))]
+ "TARGET_ALTIVEC"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (8, GEN_INT (4), GEN_INT (12), GEN_INT (5), GEN_INT (13),
+ GEN_INT (6), GEN_INT (14), GEN_INT (7), GEN_INT (15));
+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (8, GEN_INT (0), GEN_INT (8), GEN_INT (1), GEN_INT (9),
+ GEN_INT (2), GEN_INT (10), GEN_INT (3), GEN_INT (11));
+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V8HImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrghh_internal"
[(set (match_operand:V8HI 0 "register_operand" "=v")
- (vec_select:V8HI
+ (vec_select:V8HI
(vec_concat:V16HI
(match_operand:V8HI 1 "register_operand" "v")
(match_operand:V8HI 2 "register_operand" "v"))
@@ -868,10 +943,49 @@
(const_int 2) (const_int 10)
(const_int 3) (const_int 11)])))]
"TARGET_ALTIVEC"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrghh %0,%1,%2";
+ else
+ return "vmrglh %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrghh_direct"
+ [(set (match_operand:V8HI 0 "register_operand" "=v")
+ (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
+ (match_operand:V8HI 2 "register_operand" "v")]
+ UNSPEC_VMRGH_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrghh %0,%1,%2"
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vmrghw"
+(define_expand "altivec_vmrghw"
+ [(use (match_operand:V4SI 0 "register_operand" ""))
+ (use (match_operand:V4SI 1 "register_operand" ""))
+ (use (match_operand:V4SI 2 "register_operand" ""))]
+ "VECTOR_MEM_ALTIVEC_P (V4SImode)"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (4, GEN_INT (2), GEN_INT (6), GEN_INT (3), GEN_INT (7));
+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (4, GEN_INT (0), GEN_INT (4), GEN_INT (1), GEN_INT (5));
+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V4SImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrghw_internal"
[(set (match_operand:V4SI 0 "register_operand" "=v")
(vec_select:V4SI
(vec_concat:V8SI
@@ -880,6 +994,20 @@
(parallel [(const_int 0) (const_int 4)
(const_int 1) (const_int 5)])))]
"VECTOR_MEM_ALTIVEC_P (V4SImode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrghw %0,%1,%2";
+ else
+ return "vmrglw %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrghw_direct"
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
+ (match_operand:V4SI 2 "register_operand" "v")]
+ UNSPEC_VMRGH_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrghw %0,%1,%2"
[(set_attr "type" "vecperm")])
@@ -892,10 +1020,46 @@
(parallel [(const_int 0) (const_int 4)
(const_int 1) (const_int 5)])))]
"VECTOR_MEM_ALTIVEC_P (V4SFmode)"
- "vmrghw %0,%1,%2"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrghw %0,%1,%2";
+ else
+ return "vmrglw %0,%2,%1";
+}
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vmrglb"
+(define_expand "altivec_vmrglb"
+ [(use (match_operand:V16QI 0 "register_operand" ""))
+ (use (match_operand:V16QI 1 "register_operand" ""))
+ (use (match_operand:V16QI 2 "register_operand" ""))]
+ "TARGET_ALTIVEC"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (16, GEN_INT (0), GEN_INT (16), GEN_INT (1), GEN_INT (17),
+ GEN_INT (2), GEN_INT (18), GEN_INT (3), GEN_INT (19),
+ GEN_INT (4), GEN_INT (20), GEN_INT (5), GEN_INT (21),
+ GEN_INT (6), GEN_INT (22), GEN_INT (7), GEN_INT (23));
+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (16, GEN_INT (8), GEN_INT (24), GEN_INT (9), GEN_INT (25),
+ GEN_INT (10), GEN_INT (26), GEN_INT (11), GEN_INT (27),
+ GEN_INT (12), GEN_INT (28), GEN_INT (13), GEN_INT (29),
+ GEN_INT (14), GEN_INT (30), GEN_INT (15), GEN_INT (31));
+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V16QImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrglb_internal"
[(set (match_operand:V16QI 0 "register_operand" "=v")
(vec_select:V16QI
(vec_concat:V32QI
@@ -910,10 +1074,51 @@
(const_int 14) (const_int 30)
(const_int 15) (const_int 31)])))]
"TARGET_ALTIVEC"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrglb %0,%1,%2";
+ else
+ return "vmrghb %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrglb_direct"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
+ (match_operand:V16QI 2 "register_operand" "v")]
+ UNSPEC_VMRGL_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrglb %0,%1,%2"
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vmrglh"
+(define_expand "altivec_vmrglh"
+ [(use (match_operand:V8HI 0 "register_operand" ""))
+ (use (match_operand:V8HI 1 "register_operand" ""))
+ (use (match_operand:V8HI 2 "register_operand" ""))]
+ "TARGET_ALTIVEC"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (8, GEN_INT (0), GEN_INT (8), GEN_INT (1), GEN_INT (9),
+ GEN_INT (2), GEN_INT (10), GEN_INT (3), GEN_INT (11));
+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (8, GEN_INT (4), GEN_INT (12), GEN_INT (5), GEN_INT (13),
+ GEN_INT (6), GEN_INT (14), GEN_INT (7), GEN_INT (15));
+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V8HImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrglh_internal"
[(set (match_operand:V8HI 0 "register_operand" "=v")
(vec_select:V8HI
(vec_concat:V16HI
@@ -924,10 +1129,49 @@
(const_int 6) (const_int 14)
(const_int 7) (const_int 15)])))]
"TARGET_ALTIVEC"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrglh %0,%1,%2";
+ else
+ return "vmrghh %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrglh_direct"
+ [(set (match_operand:V8HI 0 "register_operand" "=v")
+ (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v")
+ (match_operand:V8HI 2 "register_operand" "v")]
+ UNSPEC_VMRGL_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrglh %0,%1,%2"
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vmrglw"
+(define_expand "altivec_vmrglw"
+ [(use (match_operand:V4SI 0 "register_operand" ""))
+ (use (match_operand:V4SI 1 "register_operand" ""))
+ (use (match_operand:V4SI 2 "register_operand" ""))]
+ "VECTOR_MEM_ALTIVEC_P (V4SImode)"
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (4, GEN_INT (0), GEN_INT (4), GEN_INT (1), GEN_INT (5));
+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (4, GEN_INT (2), GEN_INT (6), GEN_INT (3), GEN_INT (7));
+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (V4SImode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
+
+(define_insn "*altivec_vmrglw_internal"
[(set (match_operand:V4SI 0 "register_operand" "=v")
(vec_select:V4SI
(vec_concat:V8SI
@@ -936,6 +1180,20 @@
(parallel [(const_int 2) (const_int 6)
(const_int 3) (const_int 7)])))]
"VECTOR_MEM_ALTIVEC_P (V4SImode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrglw %0,%1,%2";
+ else
+ return "vmrghw %0,%2,%1";
+}
+ [(set_attr "type" "vecperm")])
+
+(define_insn "altivec_vmrglw_direct"
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
+ (match_operand:V4SI 2 "register_operand" "v")]
+ UNSPEC_VMRGL_DIRECT))]
+ "TARGET_ALTIVEC"
"vmrglw %0,%1,%2"
[(set_attr "type" "vecperm")])
@@ -948,7 +1206,12 @@
(parallel [(const_int 2) (const_int 6)
(const_int 3) (const_int 7)])))]
"VECTOR_MEM_ALTIVEC_P (V4SFmode)"
- "vmrglw %0,%1,%2"
+{
+ if (BYTES_BIG_ENDIAN)
+ return "vmrglw %0,%1,%2";
+ else
+ return "vmrghw %0,%2,%1";
+}
[(set_attr "type" "vecperm")])
;; Power8 vector merge even/odd
@@ -2225,13 +2488,13 @@
{
emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrghh_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrghh_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2251,13 +2514,13 @@
{
emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrglh_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrglh_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2277,13 +2540,13 @@
{
emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrghh_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrghh_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2303,13 +2566,13 @@
{
emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrglh_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrglh_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2329,13 +2592,13 @@
{
emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrghw_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrghw_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2355,13 +2618,13 @@
{
emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrglw_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrglw_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2381,13 +2644,13 @@
{
emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrghw_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrghw_direct (operands[0], vo, ve));
}
DONE;
}")
@@ -2407,13 +2670,13 @@
{
emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
+ emit_insn (gen_altivec_vmrglw_direct (operands[0], ve, vo));
}
else
{
emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2]));
emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2]));
- emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
+ emit_insn (gen_altivec_vmrglw_direct (operands[0], vo, ve));
}
DONE;
}")
diff --git a/main/gcc/config/rs6000/rs6000.c b/main/gcc/config/rs6000/rs6000.c
index 801b9dc04cf..8753e16030b 100644
--- a/main/gcc/config/rs6000/rs6000.c
+++ b/main/gcc/config/rs6000/rs6000.c
@@ -29895,22 +29895,28 @@ altivec_expand_vec_perm_const (rtx operands[4])
{ OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuwum,
{ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghb : CODE_FOR_altivec_vmrglb,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghb_direct
+ : CODE_FOR_altivec_vmrglb_direct),
{ 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghh : CODE_FOR_altivec_vmrglh,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghh_direct
+ : CODE_FOR_altivec_vmrglh_direct),
{ 0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghw : CODE_FOR_altivec_vmrglw,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghw_direct
+ : CODE_FOR_altivec_vmrglw_direct),
{ 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglb : CODE_FOR_altivec_vmrghb,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglb_direct
+ : CODE_FOR_altivec_vmrghb_direct),
{ 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglh : CODE_FOR_altivec_vmrghh,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglh_direct
+ : CODE_FOR_altivec_vmrghh_direct),
{ 8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 } },
{ OPTION_MASK_ALTIVEC,
- BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglw : CODE_FOR_altivec_vmrghw,
+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglw_direct
+ : CODE_FOR_altivec_vmrghw_direct),
{ 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } },
{ OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgew,
{ 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 24, 25, 26, 27 } },
diff --git a/main/gcc/config/rs6000/vsx.md b/main/gcc/config/rs6000/vsx.md
index a63e34e0ff5..5a80fe4ccd1 100644
--- a/main/gcc/config/rs6000/vsx.md
+++ b/main/gcc/config/rs6000/vsx.md
@@ -1678,24 +1678,54 @@
;; Expanders for builtins
(define_expand "vsx_mergel_"
- [(set (match_operand:VSX_D 0 "vsx_register_operand" "")
- (vec_select:VSX_D
- (vec_concat:
- (match_operand:VSX_D 1 "vsx_register_operand" "")
- (match_operand:VSX_D 2 "vsx_register_operand" ""))
- (parallel [(const_int 1) (const_int 3)])))]
+ [(use (match_operand:VSX_D 0 "vsx_register_operand" ""))
+ (use (match_operand:VSX_D 1 "vsx_register_operand" ""))
+ (use (match_operand:VSX_D 2 "vsx_register_operand" ""))]
"VECTOR_MEM_VSX_P (mode)"
- "")
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (2, GEN_INT (0), GEN_INT (2));
+ x = gen_rtx_VEC_CONCAT (mode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (2, GEN_INT (1), GEN_INT (3));
+ x = gen_rtx_VEC_CONCAT (mode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (mode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
(define_expand "vsx_mergeh_"
- [(set (match_operand:VSX_D 0 "vsx_register_operand" "")
- (vec_select:VSX_D
- (vec_concat:
- (match_operand:VSX_D 1 "vsx_register_operand" "")
- (match_operand:VSX_D 2 "vsx_register_operand" ""))
- (parallel [(const_int 0) (const_int 2)])))]
+ [(use (match_operand:VSX_D 0 "vsx_register_operand" ""))
+ (use (match_operand:VSX_D 1 "vsx_register_operand" ""))
+ (use (match_operand:VSX_D 2 "vsx_register_operand" ""))]
"VECTOR_MEM_VSX_P (mode)"
- "")
+{
+ rtvec v;
+ rtx x;
+
+ /* Special handling for LE with -maltivec=be. */
+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG)
+ {
+ v = gen_rtvec (2, GEN_INT (1), GEN_INT (3));
+ x = gen_rtx_VEC_CONCAT (mode, operands[2], operands[1]);
+ }
+ else
+ {
+ v = gen_rtvec (2, GEN_INT (0), GEN_INT (2));
+ x = gen_rtx_VEC_CONCAT (mode, operands[1], operands[2]);
+ }
+
+ x = gen_rtx_VEC_SELECT (mode, x, gen_rtx_PARALLEL (VOIDmode, v));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
+})
;; V2DF/V2DI splat
(define_insn "vsx_splat_"
diff --git a/main/gcc/configure b/main/gcc/configure
index 829ebfe8639..36653ad35fd 100755
--- a/main/gcc/configure
+++ b/main/gcc/configure
@@ -11316,8 +11316,13 @@ else
/* | A-Za-z:\\/* ) realsrcdir=${srcdir};;
*) realsrcdir=../${srcdir};;
esac
+ # Clearing GMPINC is necessary to prevent host headers being
+ # used by the build compiler. Defining GENERATOR_FILE stops
+ # system.h from including gmp.h.
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
- LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+ CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+ LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+ GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
diff --git a/main/gcc/configure.ac b/main/gcc/configure.ac
index a6e2cb433de..0ee6eeb85dc 100644
--- a/main/gcc/configure.ac
+++ b/main/gcc/configure.ac
@@ -1544,8 +1544,13 @@ else
/* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
*) realsrcdir=../${srcdir};;
esac
+ # Clearing GMPINC is necessary to prevent host headers being
+ # used by the build compiler. Defining GENERATOR_FILE stops
+ # system.h from including gmp.h.
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
- LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+ CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+ LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+ GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
diff --git a/main/gcc/cp/ChangeLog b/main/gcc/cp/ChangeLog
index 635fb053e2c..858272ffc8d 100644
--- a/main/gcc/cp/ChangeLog
+++ b/main/gcc/cp/ChangeLog
@@ -1,3 +1,115 @@
+2014-01-29 Jason Merrill
+
+ PR c++/59989
+ * pt.c (expand_template_argument_pack): Correct
+ non_default_args_count calculation.
+
+ PR c++/58466
+ * pt.c (unify_pack_expansion): Call expand_template_argument_pack.
+
+ PR c++/59956
+ * friend.c (do_friend): Pass the TEMPLATE_DECL to add_friend if we
+ have a friend template in a class template.
+ * pt.c (tsubst_friend_function): Look through it.
+ (push_template_decl_real): A friend member template is
+ primary.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58846
+ * decl.c (get_dso_handle_node): Don't crash if dso_handle_node
+ == error_mark_node.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58674
+ * pt.c (instantiate_template_1): Check for error_mark_node the second
+ argument too.
+
+2014-01-29 Jason Merrill
+
+ PR c++/59916
+ * optimize.c (maybe_thunk_body): Build a RETURN_EXPR for
+ cdtor_returns_this case.
+
+ PR c++/59315
+ * decl.c (cxx_maybe_build_cleanup): Call mark_used.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58702
+ * semantics.c (finish_omp_reduction_clause): Check type for
+ error_mark_node.
+
+2014-01-28 Jason Merrill
+
+ PR c++/59791
+ * pt.c (tsubst_decl) [VAR_DECL]: Allow in unevaluated context.
+ (tsubst_copy): Use it if lookup fails.
+
+ PR c++/59818
+ * pt.c (tsubst_function_type): Make sure we keep the same function
+ quals.
+
+ PR c++/58701
+ * semantics.c (build_anon_member_initialization): Stop walking
+ when we run out of COMPONENT_REFs.
+
+ PR c++/58632
+ * decl.c (lookup_and_check_tag): Ignore template parameters if
+ scope == ts_current.
+ * pt.c (check_template_shadow): Don't complain about the injected
+ class name.
+
+ * decl.c (duplicate_decls): Tweak.
+
+ PR c++/53756
+ * mangle.c (write_unqualified_name): Handle operator auto.
+
+2014-01-27 Jason Merrill
+
+ PR c++/59823
+ Core DR 1138
+ * call.c (reference_binding): Pass LOOKUP_NO_TEMP_BIND for
+ list-initialization. A conversion to rvalue ref that involves
+ an lvalue-rvalue conversion is bad.
+ (convert_like_real): Give helpful error message.
+
+ PR c++/54652
+ * decl.c (duplicate_decls): Always use oldtype for TYPE_DECL.
+
+ PR c++/58504
+ * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Use tsubst for
+ types.
+
+ PR c++/58606
+ * pt.c (template_parm_to_arg): Call convert_from_reference.
+ (tsubst_template_arg): Don't strip reference refs.
+
+ PR c++/58639
+ * call.c (build_aggr_conv): Reject value-initialization of reference.
+
+ PR c++/58812
+ PR c++/58651
+ * call.c (convert_like_real): Give helpful error about excess braces
+ for ck_rvalue of scalar type.
+
+ Core DR 1288
+ * call.c (reference_binding): Only elide braces if the single
+ element is reference-related.
+
+ PR c++/58814
+ * typeck.c (cp_build_modify_expr): Make the RHS an rvalue before
+ stabilizing.
+
+ PR c++/58837
+ * typeck.c (cp_truthvalue_conversion): Use explicit comparison for
+ FUNCTION_DECL.
+
+ PR c++/59097
+ * decl.c (compute_array_index_type): Don't call
+ maybe_constant_value for a non-integral expression.
+
2014-01-24 Balaji V. Iyer
* call.c (magic_varargs_p): Replaced flag_enable_cilkplus with
diff --git a/main/gcc/cp/call.c b/main/gcc/cp/call.c
index 4bb0d281d19..c7a68946e3f 100644
--- a/main/gcc/cp/call.c
+++ b/main/gcc/cp/call.c
@@ -894,6 +894,9 @@ build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
if (i < CONSTRUCTOR_NELTS (ctor))
val = CONSTRUCTOR_ELT (ctor, i)->value;
+ else if (TREE_CODE (ftype) == REFERENCE_TYPE)
+ /* Value-initialization of reference is ill-formed. */
+ return NULL;
else
{
if (empty_ctor == NULL_TREE)
@@ -1460,16 +1463,29 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr))
{
maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
- conv = implicit_conversion (to, from, expr, c_cast_p,
- flags, complain);
- if (!CLASS_TYPE_P (to)
- && CONSTRUCTOR_NELTS (expr) == 1)
+ /* DR 1288: Otherwise, if the initializer list has a single element
+ of type E and ... [T's] referenced type is reference-related to E,
+ the object or reference is initialized from that element... */
+ if (CONSTRUCTOR_NELTS (expr) == 1)
{
- expr = CONSTRUCTOR_ELT (expr, 0)->value;
- if (error_operand_p (expr))
+ tree elt = CONSTRUCTOR_ELT (expr, 0)->value;
+ if (error_operand_p (elt))
return NULL;
- from = TREE_TYPE (expr);
+ tree etype = TREE_TYPE (elt);
+ if (reference_related_p (to, etype))
+ {
+ expr = elt;
+ from = etype;
+ goto skip;
+ }
}
+ /* Otherwise, if T is a reference type, a prvalue temporary of the
+ type referenced by T is copy-list-initialized or
+ direct-list-initialized, depending on the kind of initialization
+ for the reference, and the reference is bound to that temporary. */
+ conv = implicit_conversion (to, from, expr, c_cast_p,
+ flags|LOOKUP_NO_TEMP_BIND, complain);
+ skip:;
}
if (TREE_CODE (from) == REFERENCE_TYPE)
@@ -1621,9 +1637,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
/* [dcl.init.ref]
- Otherwise, the reference shall be to a non-volatile const type.
-
- Under C++0x, [8.5.3/5 dcl.init.ref] it may also be an rvalue reference */
+ Otherwise, the reference shall be an lvalue reference to a
+ non-volatile const type, or the reference shall be an rvalue
+ reference. */
if (!CP_TYPE_CONST_NON_VOLATILE_P (to) && !TYPE_REF_IS_RVALUE (rto))
return NULL;
@@ -1661,7 +1677,16 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
/* This reference binding, unlike those above, requires the
creation of a temporary. */
conv->need_temporary_p = true;
- conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto);
+ if (TYPE_REF_IS_RVALUE (rto))
+ {
+ conv->rvaluedness_matches_p = 1;
+ /* In the second case, if the reference is an rvalue reference and
+ the second standard conversion sequence of the user-defined
+ conversion sequence includes an lvalue-to-rvalue conversion, the
+ program is ill-formed. */
+ if (conv->user_conv_p && next_conversion (conv)->kind == ck_rvalue)
+ conv->bad_p = 1;
+ }
return conv;
}
@@ -5879,10 +5904,12 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& convs->kind != ck_list
&& convs->kind != ck_ambig
&& (convs->kind != ck_ref_bind
- || convs->user_conv_p)
- && convs->kind != ck_rvalue
+ || (convs->user_conv_p && next_conversion (convs)->bad_p))
+ && (convs->kind != ck_rvalue
+ || SCALAR_TYPE_P (totype))
&& convs->kind != ck_base)
{
+ bool complained = false;
conversion *t = convs;
/* Give a helpful error if this is bad because of excess braces. */
@@ -5890,7 +5917,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& SCALAR_TYPE_P (totype)
&& CONSTRUCTOR_NELTS (expr) > 0
&& BRACE_ENCLOSED_INITIALIZER_P (CONSTRUCTOR_ELT (expr, 0)->value))
- permerror (loc, "too many braces around initializer for %qT", totype);
+ {
+ complained = permerror (loc, "too many braces around initializer "
+ "for %qT", totype);
+ while (BRACE_ENCLOSED_INITIALIZER_P (expr)
+ && CONSTRUCTOR_NELTS (expr) == 1)
+ expr = CONSTRUCTOR_ELT (expr, 0)->value;
+ }
for (; t ; t = next_conversion (t))
{
@@ -5926,9 +5959,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
else if (t->kind == ck_identity)
break;
}
- if (permerror (loc, "invalid conversion from %qT to %qT",
- TREE_TYPE (expr), totype)
- && fn)
+ if (!complained)
+ complained = permerror (loc, "invalid conversion from %qT to %qT",
+ TREE_TYPE (expr), totype);
+ if (complained && fn)
inform (DECL_SOURCE_LOCATION (fn),
"initializing argument %P of %qD", argnum, fn);
@@ -6162,7 +6196,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (convs->bad_p && !next_conversion (convs)->bad_p)
{
gcc_assert (TYPE_REF_IS_RVALUE (ref_type)
- && real_lvalue_p (expr));
+ && (real_lvalue_p (expr)
+ || next_conversion(convs)->kind == ck_rvalue));
error_at (loc, "cannot bind %qT lvalue to %qT",
TREE_TYPE (expr), totype);
diff --git a/main/gcc/cp/decl.c b/main/gcc/cp/decl.c
index 6366571b101..5bb826f5679 100644
--- a/main/gcc/cp/decl.c
+++ b/main/gcc/cp/decl.c
@@ -1925,13 +1925,13 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (TREE_CODE (newdecl) == FUNCTION_DECL)
maybe_instantiate_noexcept (olddecl);
- /* Merge the data types specified in the two decls. */
- newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
-
- /* If merge_types produces a non-typedef type, just use the old type. */
- if (TREE_CODE (newdecl) == TYPE_DECL
- && newtype == DECL_ORIGINAL_TYPE (newdecl))
+ /* For typedefs use the old type, as the new type's DECL_NAME points
+ at newdecl, which will be ggc_freed. */
+ if (TREE_CODE (newdecl) == TYPE_DECL)
newtype = oldtype;
+ else
+ /* Merge the data types specified in the two decls. */
+ newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
if (VAR_P (newdecl))
{
@@ -6743,8 +6743,11 @@ get_dso_handle_node (void)
ptr_type_node);
#ifdef HAVE_GAS_HIDDEN
- DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
- DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+ if (dso_handle_node != error_mark_node)
+ {
+ DECL_VISIBILITY (dso_handle_node) = VISIBILITY_HIDDEN;
+ DECL_VISIBILITY_SPECIFIED (dso_handle_node) = 1;
+ }
#endif
return dso_handle_node;
@@ -8305,7 +8308,9 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
abi_1_itype = error_mark_node;
}
- size = maybe_constant_value (size);
+ if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
+ size = maybe_constant_value (size);
+
if (!TREE_CONSTANT (size))
size = osize;
}
@@ -12023,7 +12028,10 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
if (decl
&& (DECL_CLASS_TEMPLATE_P (decl)
- || DECL_TEMPLATE_TEMPLATE_PARM_P (decl)))
+ /* If scope is ts_current we're defining a class, so ignore a
+ template template parameter. */
+ || (scope != ts_current
+ && DECL_TEMPLATE_TEMPLATE_PARM_P (decl))))
decl = DECL_TEMPLATE_RESULT (decl);
if (decl && TREE_CODE (decl) == TYPE_DECL)
@@ -14391,6 +14399,13 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
destructor call instead. */
if (cleanup != NULL && EXPR_P (cleanup))
SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
+
+ if (cleanup
+ && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))))
+ /* Treat objects with destructors as used; the destructor may do
+ something substantive. */
+ mark_used (decl);
+
return cleanup;
}
diff --git a/main/gcc/cp/friend.c b/main/gcc/cp/friend.c
index e54914b5d76..1a7462a60de 100644
--- a/main/gcc/cp/friend.c
+++ b/main/gcc/cp/friend.c
@@ -502,7 +502,13 @@ do_friend (tree ctype, tree declarator, tree decl,
? current_template_parms
: NULL_TREE);
- if (template_member_p && decl && TREE_CODE (decl) == FUNCTION_DECL)
+ if ((template_member_p
+ /* Always pull out the TEMPLATE_DECL if we have a friend
+ template in a class template so that it gets tsubsted
+ properly later on (59956). tsubst_friend_function knows
+ how to tell this apart from a member template. */
+ || (class_template_depth && friend_depth))
+ && decl && TREE_CODE (decl) == FUNCTION_DECL)
decl = DECL_TI_TEMPLATE (decl);
if (decl)
diff --git a/main/gcc/cp/mangle.c b/main/gcc/cp/mangle.c
index 0a0e530ff06..4d95b5cf448 100644
--- a/main/gcc/cp/mangle.c
+++ b/main/gcc/cp/mangle.c
@@ -1231,6 +1231,9 @@ write_unqualified_name (const tree decl)
fn_type = get_mostly_instantiated_function_type (decl);
type = TREE_TYPE (fn_type);
}
+ else if (FNDECL_USED_AUTO (decl))
+ type = (DECL_STRUCT_FUNCTION (decl)->language
+ ->x_auto_return_pattern);
else
type = DECL_CONV_FN_TYPE (decl);
write_conversion_operator_name (type);
diff --git a/main/gcc/cp/optimize.c b/main/gcc/cp/optimize.c
index 1b3f10a11c5..b089432a305 100644
--- a/main/gcc/cp/optimize.c
+++ b/main/gcc/cp/optimize.c
@@ -405,8 +405,8 @@ maybe_thunk_body (tree fn, bool force)
clone_result = DECL_RESULT (clone);
modify = build2 (MODIFY_EXPR, TREE_TYPE (clone_result),
clone_result, call);
+ modify = build1 (RETURN_EXPR, void_type_node, modify);
add_stmt (modify);
- BLOCK_VARS (block) = clone_result;
}
else
{
diff --git a/main/gcc/cp/pt.c b/main/gcc/cp/pt.c
index 6aa2a9f37ea..1d255b17269 100644
--- a/main/gcc/cp/pt.c
+++ b/main/gcc/cp/pt.c
@@ -3480,7 +3480,7 @@ expand_template_argument_pack (tree args)
for (i = 0; i < num_packed; ++i, ++out_arg)
TREE_VEC_ELT (result_args, out_arg) = TREE_VEC_ELT(packed, i);
if (non_default_args_count > 0)
- non_default_args_count += num_packed;
+ non_default_args_count += num_packed - 1;
}
else
{
@@ -3536,6 +3536,11 @@ check_template_shadow (tree decl)
&& TEMPLATE_PARMS_FOR_INLINE (current_template_parms)))
return true;
+ /* Don't complain about the injected class name, as we've already
+ complained about the class itself. */
+ if (DECL_SELF_REFERENCE_P (decl))
+ return false;
+
error ("declaration of %q+#D", decl);
error (" shadows template parm %q+#D", olddecl);
return false;
@@ -3863,6 +3868,7 @@ template_parm_to_arg (tree t)
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
(vec, TREE_VEC_LENGTH (vec));
#endif
+ t = convert_from_reference (t);
TREE_VEC_ELT (vec, 0) = make_pack_expansion (t);
t = make_node (NONTYPE_ARGUMENT_PACK);
@@ -4618,7 +4624,8 @@ push_template_decl_real (tree decl, bool is_friend)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
/* See if this is a primary template. */
- if (is_friend && ctx)
+ if (is_friend && ctx
+ && uses_template_parms_level (ctx, processing_template_decl))
/* A friend template that specifies a class context, i.e.
template friend void A::f();
is not primary. */
@@ -8427,10 +8434,17 @@ tsubst_friend_function (tree decl, tree args)
if (COMPLETE_TYPE_P (context))
{
+ tree fn = new_friend;
+ /* do_friend adds the TEMPLATE_DECL for any member friend
+ template even if it isn't a member template, i.e.
+ template friend A::f();
+ Look through it in that case. */
+ if (TREE_CODE (fn) == TEMPLATE_DECL
+ && !PRIMARY_TEMPLATE_P (fn))
+ fn = DECL_TEMPLATE_RESULT (fn);
/* Check to see that the declaration is really present, and,
possibly obtain an improved declaration. */
- tree fn = check_classfn (context,
- new_friend, NULL_TREE);
+ fn = check_classfn (context, fn, NULL_TREE);
if (fn)
new_friend = fn;
@@ -9290,10 +9304,6 @@ tsubst_template_arg (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/*integral_constant_expression_p=*/true);
if (!(complain & tf_warning))
--c_inhibit_evaluation_warnings;
- /* Preserve the raw-reference nature of T. */
- if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
- && REFERENCE_REF_P (r))
- r = TREE_OPERAND (r, 0);
}
return r;
}
@@ -10997,9 +11007,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
}
- else if (cp_unevaluated_operand)
- gcc_unreachable ();
- else
+ else if (!cp_unevaluated_operand)
register_local_specialization (r, t);
DECL_CHAIN (r) = NULL_TREE;
@@ -11196,6 +11204,8 @@ tsubst_function_type (tree t,
else
{
tree r = TREE_TYPE (TREE_VALUE (arg_types));
+ /* Don't pick up extra function qualifiers from the basetype. */
+ r = cp_build_qualified_type_real (r, type_memfn_quals (t), complain);
if (! MAYBE_CLASS_TYPE_P (r))
{
/* [temp.deduct]
@@ -12486,6 +12496,11 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
else
{
+ /* This can happen for a variable used in a late-specified
+ return type of a local lambda. Just make a dummy decl
+ since it's only used for its type. */
+ if (cp_unevaluated_operand)
+ return tsubst_decl (t, args, complain);
gcc_assert (errorcount || sorrycount);
return error_mark_node;
}
@@ -14982,12 +14997,12 @@ tsubst_copy_and_build (tree t,
case TRAIT_EXPR:
{
- tree type1 = tsubst_copy (TRAIT_EXPR_TYPE1 (t), args,
- complain, in_decl);
+ tree type1 = tsubst (TRAIT_EXPR_TYPE1 (t), args,
+ complain, in_decl);
tree type2 = TRAIT_EXPR_TYPE2 (t);
if (type2)
- type2 = tsubst_copy (type2, args, complain, in_decl);
+ type2 = tsubst (type2, args, complain, in_decl);
RETURN (finish_trait_expr (TRAIT_EXPR_KIND (t), type1, type2));
}
@@ -15256,6 +15271,9 @@ instantiate_template_1 (tree tmpl, tree orig_args, tsubst_flags_t complain)
return NULL_TREE;
}
+ if (targ_ptr == error_mark_node)
+ return error_mark_node;
+
/* Check to see if we already have this specialization. */
gen_tmpl = most_general_template (tmpl);
if (tmpl != gen_tmpl)
@@ -16884,6 +16902,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
tree pattern = PACK_EXPANSION_PATTERN (parm);
tree pack, packs = NULL_TREE;
int i, start = TREE_VEC_LENGTH (packed_parms) - 1;
+
+ packed_args = expand_template_argument_pack (packed_args);
+
int len = TREE_VEC_LENGTH (packed_args);
/* Determine the parameter packs we will be deducing from the
diff --git a/main/gcc/cp/semantics.c b/main/gcc/cp/semantics.c
index e5d69e64c0c..ba4e045c08f 100644
--- a/main/gcc/cp/semantics.c
+++ b/main/gcc/cp/semantics.c
@@ -5039,7 +5039,9 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
tree type = TREE_TYPE (t);
if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
- if (ARITHMETIC_TYPE_P (type))
+ if (type == error_mark_node)
+ return true;
+ else if (ARITHMETIC_TYPE_P (type))
switch (OMP_CLAUSE_REDUCTION_CODE (c))
{
case PLUS_EXPR:
@@ -7533,7 +7535,8 @@ build_anon_member_initialization (tree member, tree init,
fields.safe_push (TREE_OPERAND (member, 1));
member = TREE_OPERAND (member, 0);
}
- while (ANON_AGGR_TYPE_P (TREE_TYPE (member)));
+ while (ANON_AGGR_TYPE_P (TREE_TYPE (member))
+ && TREE_CODE (member) == COMPONENT_REF);
/* VEC has the constructor elements vector for the context of FIELD.
If FIELD is an anonymous aggregate, we will push inside it. */
diff --git a/main/gcc/cp/typeck.c b/main/gcc/cp/typeck.c
index 78090a735ce..6268f7bfbba 100644
--- a/main/gcc/cp/typeck.c
+++ b/main/gcc/cp/typeck.c
@@ -5182,7 +5182,9 @@ tree
cp_truthvalue_conversion (tree expr)
{
tree type = TREE_TYPE (expr);
- if (TYPE_PTRDATAMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type)
+ /* Avoid ICE on invalid use of non-static member function. */
+ || TREE_CODE (expr) == FUNCTION_DECL)
return build_binary_op (EXPR_LOCATION (expr),
NE_EXPR, expr, nullptr_node, 1);
else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type))
@@ -7397,8 +7399,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
side effect associated with any single compound assignment
operator. -- end note ] */
lhs = stabilize_reference (lhs);
- if (TREE_SIDE_EFFECTS (rhs))
- rhs = mark_rvalue_use (rhs);
+ rhs = rvalue (rhs);
rhs = stabilize_expr (rhs, &init);
newrhs = cp_build_binary_op (input_location,
modifycode, lhs, rhs,
diff --git a/main/gcc/doc/invoke.texi b/main/gcc/doc/invoke.texi
index dcb7fa0a8d0..6ff1225d49a 100644
--- a/main/gcc/doc/invoke.texi
+++ b/main/gcc/doc/invoke.texi
@@ -689,7 +689,7 @@ Objective-C and Objective-C++ Dialects}.
-mpc32 -mpc64 -mpc80 -mstackrealign @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
--m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol
+-m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
-msse2avx -mfentry -m8bit-idiv @gol
-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
-mstack-protector-guard=@var{guard}}
@@ -12547,10 +12547,13 @@ of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
@samp{armv6}, @samp{armv6j},
@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
-@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
+@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7ve},
@samp{armv8-a}, @samp{armv8-a+crc},
@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
+@option{-march=armv7ve} is the armv7-a architecture with virtualization
+extensions.
+
@option{-march=armv8-a+crc} enables code generation for the ARMv8-A
architecture together with the optional CRC32 extensions.
@@ -15881,10 +15884,12 @@ on x86-64 processors in 64-bit environments.
@item -m32
@itemx -m64
@itemx -mx32
+@itemx -m16
@opindex m32
@opindex m64
@opindex mx32
-Generate code for a 32-bit or 64-bit environment.
+@opindex m16
+Generate code for a 16-bit, 32-bit or 64-bit environment.
The @option{-m32} option sets @code{int}, @code{long}, and pointer types
to 32 bits, and
generates code that runs on any i386 system.
@@ -15898,6 +15903,10 @@ The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
to 32 bits, and
generates code for the x86-64 architecture.
+The @option{-m16} option is the same as @option{-m32}, except for that
+it outputs the @code{.code16gcc} assembly directive at the beginning of
+the assembly output so that the binary can run in 16-bit mode.
+
@item -mno-red-zone
@opindex mno-red-zone
Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
diff --git a/main/gcc/doc/md.texi b/main/gcc/doc/md.texi
index dddff7fedce..746acc2bce7 100644
--- a/main/gcc/doc/md.texi
+++ b/main/gcc/doc/md.texi
@@ -4918,7 +4918,8 @@ the output vector (operand 0).
Signed/Unsigned widening multiplication. The two inputs (operands 1 and 2)
are vectors with N signed/unsigned elements of size S@. Multiply the high/low
or even/odd elements of the two vectors, and put the N/2 products of size 2*S
-in the output vector (operand 0).
+in the output vector (operand 0). A target shouldn't implement even/odd pattern
+pair if it is less efficient than lo/hi one.
@cindex @code{vec_widen_ushiftl_hi_@var{m}} instruction pattern
@cindex @code{vec_widen_ushiftl_lo_@var{m}} instruction pattern
diff --git a/main/gcc/dwarf2out.c b/main/gcc/dwarf2out.c
index ddea5df5428..1c57944d544 100644
--- a/main/gcc/dwarf2out.c
+++ b/main/gcc/dwarf2out.c
@@ -248,6 +248,9 @@ static GTY(()) bool cold_text_section_used = false;
/* The default cold text section. */
static GTY(()) section *cold_text_section;
+/* The DIE for C++1y 'auto' in a function return type. */
+static GTY(()) dw_die_ref auto_die;
+
/* Forward declarations for functions defined in this file. */
static char *stripattributes (const char *);
@@ -10217,6 +10220,23 @@ base_type_die (tree type)
return base_type_result;
}
+/* A C++ function with deduced return type can have a TEMPLATE_TYPE_PARM
+ named 'auto' in its type: return true for it, false otherwise. */
+
+static inline bool
+is_cxx_auto (tree type)
+{
+ if (is_cxx ())
+ {
+ tree name = TYPE_NAME (type);
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+ if (name == get_identifier ("auto"))
+ return true;
+ }
+ return false;
+}
+
/* Given a pointer to an arbitrary ..._TYPE tree node, return nonzero if the
given input type is a Dwarf "fundamental" type. Otherwise return null. */
@@ -10250,6 +10270,8 @@ is_base_type (tree type)
return 0;
default:
+ if (is_cxx_auto (type))
+ return 0;
gcc_unreachable ();
}
@@ -18000,6 +18022,13 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
add_AT_file (subr_die, DW_AT_decl_file, file_index);
if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
add_AT_unsigned (subr_die, DW_AT_decl_line, s.line);
+
+ /* If the prototype had an 'auto' return type, emit the real
+ type on the definition die. */
+ if (is_cxx() && debug_info_level > DINFO_LEVEL_TERSE
+ && get_AT_ref (old_die, DW_AT_type) == auto_die)
+ add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)),
+ 0, 0, context_die);
}
}
else
@@ -19821,6 +19850,17 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
break;
default:
+ if (is_cxx_auto (type))
+ {
+ if (!auto_die)
+ {
+ auto_die = new_die (DW_TAG_unspecified_type,
+ comp_unit_die (), NULL_TREE);
+ add_name_attribute (auto_die, "auto");
+ }
+ equate_type_number_to_die (type, auto_die);
+ break;
+ }
gcc_unreachable ();
}
diff --git a/main/gcc/fortran/ChangeLog b/main/gcc/fortran/ChangeLog
index aacf31b3c6b..577d7784d2c 100644
--- a/main/gcc/fortran/ChangeLog
+++ b/main/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2014-01-28 Paul Thomas
+
+ PR fortran/59414
+ * trans-stmt.c (gfc_trans_allocate): Before the pointer
+ assignment to transfer the source _vptr to a class allocate
+ expression, the final class reference should be exposed. The
+ tail that includes the _data and array references is stored.
+ This reduced expression is transferred to 'lhs' and the _vptr
+ added. Then the tail is restored to the allocate expression.
+
2014-01-26 Mikael Morin
PR fortran/58007
diff --git a/main/gcc/fortran/trans-stmt.c b/main/gcc/fortran/trans-stmt.c
index 5dd7bafe452..50e9a1a2abf 100644
--- a/main/gcc/fortran/trans-stmt.c
+++ b/main/gcc/fortran/trans-stmt.c
@@ -5102,10 +5102,49 @@ gfc_trans_allocate (gfc_code * code)
{
gfc_expr *lhs, *rhs;
gfc_se lse;
+ gfc_ref *ref, *class_ref, *tail;
+
+ /* Find the last class reference. */
+ class_ref = NULL;
+ for (ref = e->ref; ref; ref = ref->next)
+ {
+ if (ref->type == REF_COMPONENT
+ && ref->u.c.component->ts.type == BT_CLASS)
+ class_ref = ref;
+
+ if (ref->next == NULL)
+ break;
+ }
+
+ /* Remove and store all subsequent references after the
+ CLASS reference. */
+ if (class_ref)
+ {
+ tail = class_ref->next;
+ class_ref->next = NULL;
+ }
+ else
+ {
+ tail = e->ref;
+ e->ref = NULL;
+ }
lhs = gfc_expr_to_initialize (e);
gfc_add_vptr_component (lhs);
+ /* Remove the _vptr component and restore the original tail
+ references. */
+ if (class_ref)
+ {
+ gfc_free_ref_list (class_ref->next);
+ class_ref->next = tail;
+ }
+ else
+ {
+ gfc_free_ref_list (e->ref);
+ e->ref = tail;
+ }
+
if (class_expr != NULL_TREE)
{
/* Polymorphic SOURCE: VPTR must be determined at run time. */
diff --git a/main/gcc/gimple-low.c b/main/gcc/gimple-low.c
index 8d2e71103a4..c60e8177d38 100644
--- a/main/gcc/gimple-low.c
+++ b/main/gcc/gimple-low.c
@@ -76,9 +76,6 @@ struct lower_data
/* True if the current statement cannot fall through. */
bool cannot_fallthru;
-
- /* True if the function calls __builtin_setjmp. */
- bool calls_builtin_setjmp;
};
static void lower_stmt (gimple_stmt_iterator *, struct lower_data *);
@@ -99,7 +96,6 @@ lower_function_body (void)
gimple_seq lowered_body;
gimple_stmt_iterator i;
gimple bind;
- tree t;
gimple x;
/* The gimplifier should've left a body of exactly one statement,
@@ -146,34 +142,6 @@ lower_function_body (void)
gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
}
- /* If the function calls __builtin_setjmp, we need to emit the computed
- goto that will serve as the unique dispatcher for all the receivers. */
- if (data.calls_builtin_setjmp)
- {
- tree disp_label, disp_var, arg;
-
- /* Build 'DISP_LABEL:' and insert. */
- disp_label = create_artificial_label (cfun->function_end_locus);
- /* This mark will create forward edges from every call site. */
- DECL_NONLOCAL (disp_label) = 1;
- cfun->has_nonlocal_label = 1;
- x = gimple_build_label (disp_label);
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
-
- /* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
- and insert. */
- disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
- arg = build_addr (disp_label, current_function_decl);
- t = builtin_decl_implicit (BUILT_IN_SETJMP_DISPATCHER);
- x = gimple_build_call (t, 1, arg);
- gimple_call_set_lhs (x, disp_var);
-
- /* Build 'goto DISP_VAR;' and insert. */
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
- x = gimple_build_goto (disp_var);
- gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
- }
-
/* Once the old body has been lowered, replace it with the new
lowered sequence. */
gimple_set_body (current_function_decl, lowered_body);
@@ -364,7 +332,6 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
{
lower_builtin_setjmp (gsi);
data->cannot_fallthru = false;
- data->calls_builtin_setjmp = true;
return;
}
@@ -689,15 +656,12 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
all will be used on all machines). It operates similarly to the C
library function of the same name, but is more efficient.
- It is lowered into 3 other builtins, namely __builtin_setjmp_setup,
- __builtin_setjmp_dispatcher and __builtin_setjmp_receiver, but with
- __builtin_setjmp_dispatcher shared among all the instances; that's
- why it is only emitted at the end by lower_function_body.
+ It is lowered into 2 other builtins, namely __builtin_setjmp_setup,
+ __builtin_setjmp_receiver.
After full lowering, the body of the function should look like:
{
- void * setjmpvar.0;
int D.1844;
int D.2844;
@@ -727,14 +691,13 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
:;
return;
- : [non-local];
- setjmpvar.0 = __builtin_setjmp_dispatcher (&);
- goto setjmpvar.0;
}
- The dispatcher block will be both the unique destination of all the
- abnormal call edges and the unique source of all the abnormal edges
- to the receivers, thus keeping the complexity explosion localized. */
+ During cfg creation an extra per-function (or per-OpenMP region)
+ block with ABNORMAL_DISPATCHER internal call will be added, unique
+ destination of all the abnormal call edges and the unique source of
+ all the abnormal edges to the receivers, thus keeping the complexity
+ explosion localized. */
static void
lower_builtin_setjmp (gimple_stmt_iterator *gsi)
diff --git a/main/gcc/go/gofrontend/gogo.cc b/main/gcc/go/gofrontend/gogo.cc
index 6ecc6cd0f0f..9739f289f4d 100644
--- a/main/gcc/go/gofrontend/gogo.cc
+++ b/main/gcc/go/gofrontend/gogo.cc
@@ -4094,12 +4094,19 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no)
// stack splitting for the thunk.
bool disable_split_stack = this->is_recover_thunk_;
+ // This should go into a unique section if that has been
+ // requested elsewhere, or if this is a nointerface function.
+ // We want to put a nointerface function into a unique section
+ // because there is a good chance that the linker garbage
+ // collection can discard it.
+ bool in_unique_section = this->in_unique_section_ || this->nointerface_;
+
Btype* functype = this->type_->get_backend_fntype(gogo);
this->fndecl_ =
gogo->backend()->function(functype, no->get_id(gogo), asm_name,
is_visible, false, is_inlinable,
- disable_split_stack,
- this->in_unique_section_, this->location());
+ disable_split_stack, in_unique_section,
+ this->location());
}
return this->fndecl_;
}
diff --git a/main/gcc/input.c b/main/gcc/input.c
index 547c177b09f..63cd062ec5b 100644
--- a/main/gcc/input.c
+++ b/main/gcc/input.c
@@ -698,7 +698,13 @@ location_get_source_line (expanded_location xloc,
static char *buffer;
static ssize_t len;
- fcache * c = lookup_or_add_file_to_cache_tab (xloc.file);
+ if (xloc.line == 0)
+ return NULL;
+
+ fcache *c = lookup_or_add_file_to_cache_tab (xloc.file);
+ if (c == NULL)
+ return NULL;
+
bool read = read_line_num (c, xloc.line, &buffer, &len);
if (read && line_len)
diff --git a/main/gcc/internal-fn.c b/main/gcc/internal-fn.c
index 87a42e7e32c..43aaecba971 100644
--- a/main/gcc/internal-fn.c
+++ b/main/gcc/internal-fn.c
@@ -857,6 +857,11 @@ expand_MASK_STORE (gimple stmt)
expand_insn (optab_handler (maskstore_optab, TYPE_MODE (type)), 3, ops);
}
+static void
+expand_ABNORMAL_DISPATCHER (gimple)
+{
+}
+
/* Routines to expand each internal function, indexed by function number.
Each routine has the prototype:
diff --git a/main/gcc/internal-fn.def b/main/gcc/internal-fn.def
index ca93a0354a2..379b35241b5 100644
--- a/main/gcc/internal-fn.def
+++ b/main/gcc/internal-fn.def
@@ -51,3 +51,4 @@ DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW)
DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW)
+DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN)
diff --git a/main/gcc/ipa-inline-analysis.c b/main/gcc/ipa-inline-analysis.c
index 4f7d98f4b33..a391bc4b4e6 100644
--- a/main/gcc/ipa-inline-analysis.c
+++ b/main/gcc/ipa-inline-analysis.c
@@ -2345,6 +2345,54 @@ find_foldable_builtin_expect (basic_block bb)
return NULL;
}
+/* Return true when the basic blocks contains only clobbers followed by RESX.
+ Such BBs are kept around to make removal of dead stores possible with
+ presence of EH and will be optimized out by optimize_clobbers later in the
+ game.
+
+ NEED_EH is used to recurse in case the clobber has non-EH predecestors
+ that can be clobber only, too.. When it is false, the RESX is not necessary
+ on the end of basic block. */
+
+static bool
+clobber_only_eh_bb_p (basic_block bb, bool need_eh = true)
+{
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ edge_iterator ei;
+ edge e;
+
+ if (need_eh)
+ {
+ if (gsi_end_p (gsi))
+ return false;
+ if (gimple_code (gsi_stmt (gsi)) != GIMPLE_RESX)
+ return false;
+ gsi_prev (&gsi);
+ }
+ else if (!single_succ_p (bb))
+ return false;
+
+ for (; !gsi_end_p (gsi); gsi_prev (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ if (is_gimple_debug (stmt))
+ continue;
+ if (gimple_clobber_p (stmt))
+ continue;
+ if (gimple_code (stmt) == GIMPLE_LABEL)
+ break;
+ return false;
+ }
+
+ /* See if all predecestors are either throws or clobber only BBs. */
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (!(e->flags & EDGE_EH)
+ && !clobber_only_eh_bb_p (e->src, false))
+ return false;
+
+ return true;
+}
+
/* Compute function body size parameters for NODE.
When EARLY is true, we compute only simple summaries without
non-trivial predicates to drive the early inliner. */
@@ -2409,6 +2457,14 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
{
bb = BASIC_BLOCK_FOR_FN (cfun, order[n]);
freq = compute_call_stmt_bb_frequency (node->decl, bb);
+ if (clobber_only_eh_bb_p (bb))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\n Ignoring BB %i;"
+ " it will be optimized away by cleanup_clobbers\n",
+ bb->index);
+ continue;
+ }
/* TODO: Obviously predicates can be propagated down across CFG. */
if (parms_info)
diff --git a/main/gcc/lto-streamer.h b/main/gcc/lto-streamer.h
index 215d4084e29..a53e2535968 100644
--- a/main/gcc/lto-streamer.h
+++ b/main/gcc/lto-streamer.h
@@ -140,8 +140,8 @@ along with GCC; see the file COPYING3. If not see
sections a '.' and the section type are appended. */
#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
-#define LTO_major_version 2
-#define LTO_minor_version 2
+#define LTO_major_version 3
+#define LTO_minor_version 0
typedef unsigned char lto_decl_flags_t;
diff --git a/main/gcc/omp-low.c b/main/gcc/omp-low.c
index eeba4ae8470..d7589aa9ec1 100644
--- a/main/gcc/omp-low.c
+++ b/main/gcc/omp-low.c
@@ -10449,7 +10449,8 @@ diagnose_sb_2 (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
/* Called from tree-cfg.c::make_edges to create cfg edges for all GIMPLE_OMP
codes. */
bool
-make_gimple_omp_edges (basic_block bb, struct omp_region **region)
+make_gimple_omp_edges (basic_block bb, struct omp_region **region,
+ int *region_idx)
{
gimple last = last_stmt (bb);
enum gimple_code code = gimple_code (last);
@@ -10556,7 +10557,13 @@ make_gimple_omp_edges (basic_block bb, struct omp_region **region)
}
if (*region != cur_region)
- *region = cur_region;
+ {
+ *region = cur_region;
+ if (cur_region)
+ *region_idx = cur_region->entry->index;
+ else
+ *region_idx = 0;
+ }
return fallthru;
}
diff --git a/main/gcc/omp-low.h b/main/gcc/omp-low.h
index ce9cef9f5dd..d80c2d6f5c0 100644
--- a/main/gcc/omp-low.h
+++ b/main/gcc/omp-low.h
@@ -26,6 +26,6 @@ extern tree find_omp_clause (tree, enum omp_clause_code);
extern void omp_expand_local (basic_block);
extern void free_omp_regions (void);
extern tree omp_reduction_init (tree, tree);
-extern bool make_gimple_omp_edges (basic_block, struct omp_region **);
+extern bool make_gimple_omp_edges (basic_block, struct omp_region **, int *);
#endif /* GCC_OMP_LOW_H */
diff --git a/main/gcc/profile.c b/main/gcc/profile.c
index e4d65ab0a80..4a0621c9916 100644
--- a/main/gcc/profile.c
+++ b/main/gcc/profile.c
@@ -1135,27 +1135,22 @@ branch_prob (void)
gimple first;
tree fndecl;
- gsi = gsi_after_labels (bb);
+ gsi = gsi_start_nondebug_after_labels_bb (bb);
gcc_checking_assert (!gsi_end_p (gsi));
first = gsi_stmt (gsi);
- if (is_gimple_debug (first))
- {
- gsi_next_nondebug (&gsi);
- gcc_checking_assert (!gsi_end_p (gsi));
- first = gsi_stmt (gsi);
- }
/* Don't split the bbs containing __builtin_setjmp_receiver
- or __builtin_setjmp_dispatcher calls. These are very
+ or ABNORMAL_DISPATCHER calls. These are very
special and don't expect anything to be inserted before
them. */
if (is_gimple_call (first)
&& (((fndecl = gimple_call_fndecl (first)) != NULL
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
&& (DECL_FUNCTION_CODE (fndecl)
- == BUILT_IN_SETJMP_RECEIVER
- || (DECL_FUNCTION_CODE (fndecl)
- == BUILT_IN_SETJMP_DISPATCHER)))
- || gimple_call_flags (first) & ECF_RETURNS_TWICE))
+ == BUILT_IN_SETJMP_RECEIVER))
+ || (gimple_call_flags (first) & ECF_RETURNS_TWICE)
+ || (gimple_call_internal_p (first)
+ && (gimple_call_internal_fn (first)
+ == IFN_ABNORMAL_DISPATCHER))))
continue;
if (dump_file)
diff --git a/main/gcc/read-rtl.c b/main/gcc/read-rtl.c
index aa7c03b2060..81ce1a864ae 100644
--- a/main/gcc/read-rtl.c
+++ b/main/gcc/read-rtl.c
@@ -1131,6 +1131,7 @@ read_rtx_code (const char *code_name)
/* If we end up with an insn expression then we free this space below. */
return_rtx = rtx_alloc (code);
format_ptr = GET_RTX_FORMAT (code);
+ memset (return_rtx, 0, RTX_CODE_SIZE (code));
PUT_CODE (return_rtx, code);
if (iterator)
@@ -1154,6 +1155,8 @@ read_rtx_code (const char *code_name)
/* 0 means a field for internal use only.
Don't expect it to be present in the input. */
case '0':
+ if (code == REG)
+ ORIGINAL_REGNO (return_rtx) = REGNO (return_rtx);
break;
case 'e':
diff --git a/main/gcc/testsuite/ChangeLog b/main/gcc/testsuite/ChangeLog
index 8ae82d5f975..62bcc3131ca 100644
--- a/main/gcc/testsuite/ChangeLog
+++ b/main/gcc/testsuite/ChangeLog
@@ -1,3 +1,84 @@
+2014-01-29 Paolo Carlini
+
+ PR c++/58561
+ * g++.dg/cpp1y/auto-fn23.C: New.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58846
+ * g++.dg/init/dso_handle2.C: New.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58674
+ * g++.dg/cpp0x/pr58674.C: New.
+
+2014-01-28 Kirill Yukhin
+
+ PR target/59617
+ * gcc.target/i386/avx512f-gather-2.c: Remove XPASS.
+ * gcc.target/i386/avx512f-gather-5.c: Ditto.
+
+2014-01-29 Bill Schmidt
+
+ * gcc.dg/vmx/merge-be-order.c: New.
+ * gcc.dg/vmx/merge.c: New.
+ * gcc.dg/vmx/merge-vsx-be-order.c: New.
+ * gcc.dg/vmx/merge-vsx.c: New.
+
+2014-01-29 Richard Biener
+
+ PR tree-optimization/58742
+ * gcc.dg/pr58742-1.c: New testcase.
+ * gcc.dg/pr58742-2.c: Likewise.
+ * gcc.dg/pr58742-3.c: Likewise.
+
+2014-01-29 Renlin Li
+
+ * gcc.target/arm/ftest-armv7ve-arm.c: New.
+ * gcc.target/arm/ftest-armv7ve-thumb.c: New.
+ * lib/target-supports.exp: New armfunc, armflag and armdef for armv7ve.
+
+2014-01-29 Paolo Carlini
+
+ PR c++/58702
+ * g++.dg/gomp/pr58702.C: New.
+
+2014-01-29 Dodji Seketeli
+
+ * c-c++-common/cpp/warning-zero-location-2.c: Fix error message
+ selector.
+
+2014-01-29 Jakub Jelinek
+
+ PR middle-end/59917
+ PR tree-optimization/59920
+ * gcc.dg/pr59920-1.c: New test.
+ * gcc.dg/pr59920-2.c: New test.
+ * gcc.dg/pr59920-3.c: New test.
+ * c-c++-common/gomp/pr59917-1.c: New test.
+ * c-c++-common/gomp/pr59917-2.c: New test.
+
+ PR tree-optimization/59594
+ * gcc.dg/vect/no-vfa-vect-depend-2.c: New test.
+ * gcc.dg/vect/no-vfa-vect-depend-3.c: New test.
+ * gcc.dg/vect/pr59594.c: New test.
+
+2014-01-28 Paul Thomas
+
+ PR fortran/59414
+ * gfortran.dg/allocate_class_3.f90: New test.
+
+2014-01-28 Dodji Seketeli
+
+ PR preprocessor/59935
+ * c-c++-common/cpp/warning-zero-location.c: New test.
+ * c-c++-common/cpp/warning-zero-location-2.c: Likewise.
+
+2014-01-27 Steve Ellcey
+
+ * gcc.target/mips/pr52125.c: Add -mno-optgp option.
+
2014-01-27 Allan Sandfeld Jensen
* g++.dg/ext/mv16.C: New tests.
@@ -693,7 +774,7 @@
PR ipa/58252
PR ipa/59226
- * g++.dg/ipa/devirt-20.C: New testcase.
+ * g++.dg/ipa/devirt-20.C: New testcase.
* g++.dg/torture/pr58252.C: Likewise.
* g++.dg/torture/pr59226.C: Likewise.
diff --git a/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c b/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
new file mode 100644
index 00000000000..e919bca6975
--- /dev/null
+++ b/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location-2.c
@@ -0,0 +1,10 @@
+/*
+ { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
+ { dg-do compile }
+ */
+
+#line 4636 "configure"
+#include
+int main() { return 0; }
+
+/* { dg-message "" "#include" {target *-*-* } 0 }
diff --git a/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c b/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
new file mode 100644
index 00000000000..ca2e102bba0
--- /dev/null
+++ b/main/gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
@@ -0,0 +1,8 @@
+/*
+ { dg-options "-D _GNU_SOURCE -fdiagnostics-show-caret" }
+ { dg-do compile }
+ */
+
+#define _GNU_SOURCE /* { dg-warning "redefined" } */
+
+/* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 }
diff --git a/main/gcc/testsuite/c-c++-common/gomp/pr59917-1.c b/main/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
new file mode 100644
index 00000000000..cca3976ccb7
--- /dev/null
+++ b/main/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
@@ -0,0 +1,22 @@
+/* PR middle-end/59917 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp" } */
+
+struct J { long buf[8]; };
+extern int setjmp (struct J[1]);
+extern struct J j[1];
+void foo (int);
+
+void
+bar (void)
+{
+ if (setjmp (j) == 0)
+ {
+ int k;
+ foo (-1);
+#pragma omp parallel
+ for (k = 0; k < 10; ++k)
+ foo (k);
+ foo (-2);
+ }
+}
diff --git a/main/gcc/testsuite/c-c++-common/gomp/pr59917-2.c b/main/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
new file mode 100644
index 00000000000..1d603422f66
--- /dev/null
+++ b/main/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
@@ -0,0 +1,22 @@
+/* PR middle-end/59917 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp" } */
+
+struct J { long buf[8]; };
+extern int setjmp (struct J[1]);
+void foo (int);
+
+void
+bar (void)
+{
+ int k;
+ foo (-1);
+#pragma omp parallel
+ for (k = 0; k < 10; ++k)
+ {
+ struct J j[1];
+ if (setjmp (j) == 0)
+ foo (k);
+ }
+ foo (-2);
+}
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/initlist22.C b/main/gcc/testsuite/g++.dg/cpp0x/initlist22.C
index f913aebb906..19aefd304d5 100644
--- a/main/gcc/testsuite/g++.dg/cpp0x/initlist22.C
+++ b/main/gcc/testsuite/g++.dg/cpp0x/initlist22.C
@@ -1,4 +1,4 @@
-// Core issue 934
+// Core issue 934/1288
// { dg-options "-std=c++11" }
int i;
@@ -13,12 +13,12 @@ struct A { int i; } a;
A& r5 { i }; // { dg-error "" } reference to temporary
A&& r6 { i }; // OK, aggregate initialization of temporary
-A& r7 { a }; // { dg-error "" } invalid aggregate initializer for A
-A&& r8 { a }; // { dg-error "" } invalid aggregate initializer for A
+A& r7 { a }; // OK, direct-initialization
+A&& r8 { a }; // { dg-error "lvalue" } binding && to lvalue
struct B { B(int); int i; } b(0);
B& r9 { i }; // { dg-error "" } reference to temporary
B&& r10 { i }; // OK, make temporary with B(int) constructor
-B& r11 { b }; // { dg-error "" } reference to temporary
-B&& r12 { b }; // OK, make temporary with copy constructor
+B& r11 { b }; // OK, direct-initialization
+B&& r12 { b }; // { dg-error "lvalue" } binding && to lvalue
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/initlist76.C b/main/gcc/testsuite/g++.dg/cpp0x/initlist76.C
new file mode 100644
index 00000000000..ac419dde8cf
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/initlist76.C
@@ -0,0 +1,5 @@
+// PR c++/58812
+// { dg-require-effective-target c++11 }
+
+int i;
+int&& j{{ i }}; // { dg-error "too many braces" }
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/initlist77.C b/main/gcc/testsuite/g++.dg/cpp0x/initlist77.C
new file mode 100644
index 00000000000..49b9079fb44
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/initlist77.C
@@ -0,0 +1,10 @@
+// PR c++/58651
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+ int i;
+ A(int j) : i{{j}} {} // { dg-error "too many braces" }
+};
+
+A a(0);
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/initlist78.C b/main/gcc/testsuite/g++.dg/cpp0x/initlist78.C
new file mode 100644
index 00000000000..648ec5307df
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/initlist78.C
@@ -0,0 +1,12 @@
+// PR c++/58639
+// { dg-require-effective-target c++11 }
+
+struct node {
+ node &parent;
+};
+
+struct vector {
+ node n;
+};
+
+vector v({}); // { dg-error "" }
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C b/main/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C
new file mode 100644
index 00000000000..0ab0cddb54a
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C
@@ -0,0 +1,21 @@
+// PR c++/59791
+// We force the gimple dump to trigger use of lang_decl_name.
+// { dg-options "-std=c++11 -fdump-tree-gimple" }
+// { dg-final { cleanup-tree-dump "gimple" } }
+
+template < class T > void
+f (T t)
+{
+ int i = t;
+ [](int)->decltype (i + t)
+ {
+ return 0;
+ }
+ (0);
+}
+
+void
+foo ()
+{
+ f (0);
+}
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/nsdmi-union5.C b/main/gcc/testsuite/g++.dg/cpp0x/nsdmi-union5.C
new file mode 100644
index 00000000000..57dfd59863b
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/nsdmi-union5.C
@@ -0,0 +1,11 @@
+// PR c++/58701
+// { dg-require-effective-target c++11 }
+// { dg-final { scan-assembler "7" } }
+
+static union
+{
+ union
+ {
+ int i = 7;
+ };
+};
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/overload3.C b/main/gcc/testsuite/g++.dg/cpp0x/overload3.C
new file mode 100644
index 00000000000..e521b35bd0d
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/overload3.C
@@ -0,0 +1,17 @@
+// PR c++/59823
+// { dg-options "-std=c++11" }
+
+struct X { };
+
+void f(X&&);
+
+struct wrap
+{
+ operator const X&() const;
+};
+
+int main()
+{
+ wrap w;
+ f(w); // { dg-error "lvalue" }
+}
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/pr58674.C b/main/gcc/testsuite/g++.dg/cpp0x/pr58674.C
new file mode 100644
index 00000000000..fe97c6de970
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/pr58674.C
@@ -0,0 +1,18 @@
+// PR c++/58674
+// { dg-do compile { target c++11 } }
+
+template struct A {};
+
+template using B = A;
+
+template struct C
+{
+ B b; // { dg-error "not usable" }
+};
+
+struct X
+{
+ static const int i;
+};
+
+C c;
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/static_assert9.C b/main/gcc/testsuite/g++.dg/cpp0x/static_assert9.C
new file mode 100644
index 00000000000..fccaa449c17
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/static_assert9.C
@@ -0,0 +1,7 @@
+// PR c++/58837
+// { dg-require-effective-target c++11 }
+
+void f();
+static_assert(f, "");
+struct A {};
+static_assert(A::~A, ""); // { dg-error "non-static member function" }
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/variadic146.C b/main/gcc/testsuite/g++.dg/cpp0x/variadic146.C
new file mode 100644
index 00000000000..0c91db581d1
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/variadic146.C
@@ -0,0 +1,9 @@
+// PR c++/58606
+// { dg-require-effective-target c++11 }
+
+template struct A
+{
+ template struct B;
+
+ template struct B {};
+};
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/variadic147.C b/main/gcc/testsuite/g++.dg/cpp0x/variadic147.C
new file mode 100644
index 00000000000..7f606d84a1e
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/variadic147.C
@@ -0,0 +1,10 @@
+// PR c++/58466
+// { dg-require-effective-target c++11 }
+
+template struct A;
+
+template struct B;
+
+template struct B> {};
+
+B> b;
diff --git a/main/gcc/testsuite/g++.dg/cpp0x/variadic148.C b/main/gcc/testsuite/g++.dg/cpp0x/variadic148.C
new file mode 100644
index 00000000000..a4ee63533da
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp0x/variadic148.C
@@ -0,0 +1,6 @@
+// PR c++/59989
+// { dg-require-effective-target c++11 }
+
+template struct X {};
+template class D, typename ...U> int test(D*);
+int n = test(0); // { dg-error "no match" }
diff --git a/main/gcc/testsuite/g++.dg/cpp1y/auto-fn12.C b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn12.C
index e4e58e8999a..ab4a1bbf2db 100644
--- a/main/gcc/testsuite/g++.dg/cpp1y/auto-fn12.C
+++ b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn12.C
@@ -1,5 +1,5 @@
// { dg-options -std=c++1y }
-// { dg-final { scan-assembler "_ZN1AIiEcviEv" } }
+// { dg-final { scan-assembler "_ZN1AIiEcvDaEv" } }
template
struct A {
diff --git a/main/gcc/testsuite/g++.dg/cpp1y/auto-fn22.C b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn22.C
new file mode 100644
index 00000000000..f05cbb993ee
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn22.C
@@ -0,0 +1,9 @@
+// { dg-options "-std=c++1y" }
+
+struct A
+{
+ operator auto();
+};
+
+// { dg-final { scan-assembler "_ZN1AcvDaEv" } }
+A::operator auto() { return 42; }
diff --git a/main/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C
new file mode 100644
index 00000000000..57503d7612e
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/cpp1y/auto-fn23.C
@@ -0,0 +1,9 @@
+// PR c++/58561
+// { dg-options "-std=c++1y -g" }
+
+auto foo();
+
+namespace N
+{
+ using ::foo;
+}
diff --git a/main/gcc/testsuite/g++.dg/debug/dwarf2/auto1.C b/main/gcc/testsuite/g++.dg/debug/dwarf2/auto1.C
new file mode 100644
index 00000000000..d637ef0bbad
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/debug/dwarf2/auto1.C
@@ -0,0 +1,30 @@
+// PR c++/53756
+// { dg-options "-std=c++1y -g -dA -fno-debug-types-section" }
+// We're looking for something like
+
+// .uleb128 0x3 # (DIE (0x33) DW_TAG_subprogram)
+// .ascii "a1\0" # DW_AT_name
+// .long 0x4c # DW_AT_type
+//...
+// .uleb128 0x5 # (DIE (0x4c) DW_TAG_unspecified_type)
+// .long .LASF6 # DW_AT_name: "auto"
+//...
+// .uleb128 0x7 # (DIE (0x57) DW_TAG_subprogram)
+// .long 0x33 # DW_AT_specification
+// .long 0x87 # DW_AT_type
+//...
+// .uleb128 0x9 # (DIE (0x87) DW_TAG_base_type)
+// .ascii "int\0" # DW_AT_name
+
+// { dg-final { scan-assembler "a1.*(0x\[0-9a-f]+)\[^\n\r]*DW_AT_type.*\\1. DW_TAG_unspecified_type.*DW_AT_specification\[\n\r]{1,2}\[^\n\r]*(0x\[0-9a-f]+)\[^\n\r]*DW_AT_type.*\\2. DW_TAG_base_type" } }
+
+struct A
+{
+ auto a1 () { return 42; }
+};
+
+int main()
+{
+ A a;
+ a.a1();
+}
diff --git a/main/gcc/testsuite/g++.dg/ext/attrib48.C b/main/gcc/testsuite/g++.dg/ext/attrib48.C
new file mode 100644
index 00000000000..19a9959109d
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/ext/attrib48.C
@@ -0,0 +1,6 @@
+// PR c++/54652
+
+typedef unsigned L __attribute__ ((aligned));
+typedef unsigned L __attribute__ ((aligned));
+
+L l;
diff --git a/main/gcc/testsuite/g++.dg/ext/stmtexpr15.C b/main/gcc/testsuite/g++.dg/ext/stmtexpr15.C
new file mode 100644
index 00000000000..83a831cdd4c
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/ext/stmtexpr15.C
@@ -0,0 +1,7 @@
+// PR c++/59097
+// { dg-options "" }
+
+void foo()
+{
+ int x[({ return; })]; // { dg-error "non-integral" }
+}
diff --git a/main/gcc/testsuite/g++.dg/ext/traits1.C b/main/gcc/testsuite/g++.dg/ext/traits1.C
new file mode 100644
index 00000000000..24099e53cd7
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/ext/traits1.C
@@ -0,0 +1,4 @@
+// PR c++/58504
+
+template struct A {};
+A<> a;
diff --git a/main/gcc/testsuite/g++.dg/ext/vector25.C b/main/gcc/testsuite/g++.dg/ext/vector25.C
new file mode 100644
index 00000000000..6c1f5d09878
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/ext/vector25.C
@@ -0,0 +1,6 @@
+volatile int i __attribute__((vector_size(8)));
+
+void foo()
+{
+ i += i;
+}
diff --git a/main/gcc/testsuite/g++.dg/gomp/pr58702.C b/main/gcc/testsuite/g++.dg/gomp/pr58702.C
new file mode 100644
index 00000000000..5bab86118ba
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/gomp/pr58702.C
@@ -0,0 +1,10 @@
+// PR c++/58702
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void foo()
+{
+ x; // { dg-error "was not declared" }
+#pragma omp parallel for reduction(+:x)
+ for (int i = 0; i < 10; ++i) ;
+}
diff --git a/main/gcc/testsuite/g++.dg/init/dso_handle2.C b/main/gcc/testsuite/g++.dg/init/dso_handle2.C
new file mode 100644
index 00000000000..d0ffda1a983
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/init/dso_handle2.C
@@ -0,0 +1,10 @@
+// PR c++/58846
+
+extern "C" { char* __dso_handle; }
+
+struct A
+{
+ ~A();
+};
+
+A a; // { dg-error "conflicting declaration" }
diff --git a/main/gcc/testsuite/g++.dg/parse/enum5.C b/main/gcc/testsuite/g++.dg/parse/enum5.C
index 3ebb02f7573..18480520a6f 100644
--- a/main/gcc/testsuite/g++.dg/parse/enum5.C
+++ b/main/gcc/testsuite/g++.dg/parse/enum5.C
@@ -10,7 +10,7 @@ struct D {
enum EE : sizeof(EE) * CHAR_BIT; // not OK
enum EE xxxx : sizeof(EE) * CHAR_BIT; // OK
T x : sizeof(unsigned int) * CHAR_BIT; // OK
- enum FF {ff} : sizeof(int) * CHAR_BIT; // OK
+ enum FF {ff} : sizeof(FF) * CHAR_BIT; // OK
} element;
enum EE xx;
diff --git a/main/gcc/testsuite/g++.dg/template/friend55.C b/main/gcc/testsuite/g++.dg/template/friend55.C
new file mode 100644
index 00000000000..4abe6ce6a23
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/template/friend55.C
@@ -0,0 +1,18 @@
+// PR c++/59956
+
+template struct A;
+template class B {
+ int i;
+ template friend void A::impl();
+};
+
+B<0> b1;
+templatestruct A { void impl(); };
+B<1> b2;
+
+template void A::impl() { ++b1.i; ++b2.i; }
+
+int main()
+{
+ A<0>().impl();
+}
diff --git a/main/gcc/testsuite/g++.dg/template/ptrmem24.C b/main/gcc/testsuite/g++.dg/template/ptrmem24.C
new file mode 100644
index 00000000000..a4194109ef7
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/template/ptrmem24.C
@@ -0,0 +1,20 @@
+// PR c++/59818
+
+template
+struct Identity {
+ typedef T type;
+};
+
+struct Foo {
+ template
+ Foo(T*, void (Identity::type::*m)(void));
+};
+
+struct Bar {
+ void Method(void) const;
+};
+
+void Bar::Method(void) const
+{
+ Foo foo(this, &Bar::Method); // { dg-error "no match" }
+}
diff --git a/main/gcc/testsuite/g++.dg/template/shadow1.C b/main/gcc/testsuite/g++.dg/template/shadow1.C
new file mode 100644
index 00000000000..6eb30d0945b
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/template/shadow1.C
@@ -0,0 +1,4 @@
+// PR c++/58632
+
+template class A> // { dg-message "shadows" }
+class A {}; // { dg-error "declaration" }
diff --git a/main/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C b/main/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
new file mode 100644
index 00000000000..2043b6cf21a
--- /dev/null
+++ b/main/gcc/testsuite/g++.dg/warn/Wreturn-type-10.C
@@ -0,0 +1,13 @@
+// PR c++/59916
+// { dg-options "-Os -Wreturn-type" }
+
+class A {};
+
+struct B : virtual public A
+{
+ B();
+ virtual ~B();
+};
+
+B::B() {}
+B::~B() {}
diff --git a/main/gcc/testsuite/g++.dg/warn/Wunused-3.C b/main/gcc/testsuite/g++.dg/warn/Wunused-3.C
index 31009094352..2d00dda3faa 100644
--- a/main/gcc/testsuite/g++.dg/warn/Wunused-3.C
+++ b/main/gcc/testsuite/g++.dg/warn/Wunused-3.C
@@ -1,5 +1,5 @@
// { dg-do compile }
-// { dg-options "-Wunused -O" }
+// { dg-options "-Wunused -O -fno-use-cxa-atexit" }
void do_cleanups();
diff --git a/main/gcc/testsuite/gcc.dg/pr58742-1.c b/main/gcc/testsuite/gcc.dg/pr58742-1.c
new file mode 100644
index 00000000000..94f56273f49
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr58742-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
+
+int *
+fx (int *b, int *e)
+{
+ __SIZE_TYPE__ p = e - b;
+ /* The first forwprop pass should optimize this to return e; */
+ return b + p;
+}
+
+/* { dg-final { scan-tree-dump "return e" "cddce1" } } */
+/* { dg-final { cleanup-tree-dump "cddce1" } } */
diff --git a/main/gcc/testsuite/gcc.dg/pr58742-2.c b/main/gcc/testsuite/gcc.dg/pr58742-2.c
new file mode 100644
index 00000000000..e0011e950ca
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr58742-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
+
+__SIZE_TYPE__
+fx (char *a, __SIZE_TYPE__ sz)
+{
+ char *b = a + sz;
+ /* The first forwprop pass should optimize this to return sz; */
+ return b - a;
+}
+
+/* { dg-final { scan-tree-dump "return sz" "cddce1" } } */
+/* { dg-final { cleanup-tree-dump "cddce1" } } */
diff --git a/main/gcc/testsuite/gcc.dg/pr58742-3.c b/main/gcc/testsuite/gcc.dg/pr58742-3.c
new file mode 100644
index 00000000000..f4e95e64547
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr58742-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
+
+int *
+fx (int *a, int sz)
+{
+ int *b = a + sz;
+ b = b - sz;
+ /* forwprop together with FRE should optimize this to return a; */
+ return b;
+}
+
+/* { dg-final { scan-tree-dump "return a" "cddce1" } } */
+/* { dg-final { cleanup-tree-dump "cddce1" } } */
diff --git a/main/gcc/testsuite/gcc.dg/pr59920-1.c b/main/gcc/testsuite/gcc.dg/pr59920-1.c
new file mode 100644
index 00000000000..3e60d37ae20
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr59920-1.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/59920 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+#include
+
+int bar (void);
+void baz (int);
+
+#define A { int x = bar (); if (setjmp (buf) == 0) baz (x); }
+#define B A A A A A A A A A A
+#define C B B B B B B B B B B
+
+extern jmp_buf buf;
+
+void
+foo (void)
+{
+ C C
+}
diff --git a/main/gcc/testsuite/gcc.dg/pr59920-2.c b/main/gcc/testsuite/gcc.dg/pr59920-2.c
new file mode 100644
index 00000000000..bee5542748b
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr59920-2.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/59920 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void *bar (void **);
+void *baz (int, void **);
+
+#define A(n) \
+ { __label__ l1_##n, l2_##n, l3_##n; \
+ static void *a[] = { &&l1_##n, &&l2_##n, &&l3_##n };\
+ void *b = bar (a); \
+ goto *b; \
+ l1_##n: \
+ b = baz (1, a); \
+ goto *b; \
+ l2_##n: \
+ b = baz (2, a); \
+ goto *b; \
+ l3_##n:; \
+ }
+#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) \
+ A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
+#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) \
+ B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
+
+void
+foo (void)
+{
+ C(1)
+}
diff --git a/main/gcc/testsuite/gcc.dg/pr59920-3.c b/main/gcc/testsuite/gcc.dg/pr59920-3.c
new file mode 100644
index 00000000000..2159504e363
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/pr59920-3.c
@@ -0,0 +1,47 @@
+/* PR tree-optimization/59920 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void *bar (void **);
+void *baz (int, void **);
+
+#define A(n) __label__ l##n;
+#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) \
+ A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
+#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) \
+ B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
+#define D C(1)
+
+int
+foo (void)
+{
+ D
+ int bar (int i)
+ {
+ switch (i)
+ {
+#undef A
+#define A(n) \
+ case n: goto l##n;
+ D
+ }
+ return i;
+ }
+ int w = 0;
+#undef A
+#define A(n) int w##n = 0;
+ D
+#undef A
+#define A(n) \
+ { l##n:; \
+ w##n += bar (10000 + n) - 10000; \
+ w##n += bar (10001 + n) - 10000; \
+ bar (n + 1); \
+ return w##n; \
+ }
+ D
+#undef A
+#define A(n) w += w##n;
+ D
+ return w;
+}
diff --git a/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-2.c b/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-2.c
new file mode 100644
index 00000000000..3a94c030f07
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-2.c
@@ -0,0 +1,55 @@
+/* { dg-require-effective-target vect_int } */
+
+#include
+#include "tree-vect.h"
+
+#define N 17
+
+int ia[N] = {48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3,0};
+int ib[N] = {48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3,0};
+int res[N] = {48,192,180,168,156,144,132,120,108,96,84,72,60,48,36,24,12};
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ /* Not vectorizable due to data dependence: dependence distance 1. */
+ for (i = N - 1; i >= 0; i--)
+ {
+ ia[i] = ia[i+1] * 4;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != 0)
+ abort ();
+ }
+
+ /* Vectorizable. Dependence distance -1. */
+ for (i = N - 1; i >= 0; i--)
+ {
+ ib[i+1] = ib[i] * 4;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ib[i] != res[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "dependence distance negative" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-3.c b/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-3.c
new file mode 100644
index 00000000000..8f937a0f3df
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-3.c
@@ -0,0 +1,187 @@
+/* { dg-require-effective-target vect_int } */
+
+#include
+#include "tree-vect.h"
+
+#define N 64
+
+int ia[N + 1];
+int ib[N + 1];
+
+/* Vectorizable. Dependence distance -1. */
+__attribute__((noinline)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ ia[i + 1] = 1;
+ ib[i] = ia[i];
+ }
+}
+
+/* Not vectorizable due to data dependence: dependence distance 1. */
+__attribute__((noinline)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = 1;
+ ib[i] = ia[i + 1];
+ }
+}
+
+/* Not vectorizable due to data dependence: dependence distance 1. */
+__attribute__((noinline)) void
+f3 (void)
+{
+ int i;
+ for (i = N - 1; i >= 0; i--)
+ {
+ ia[i + 1] = 1;
+ ib[i] = ia[i];
+ }
+}
+
+/* Vectorizable. Dependence distance -1. */
+__attribute__((noinline)) void
+f4 (void)
+{
+ int i;
+ for (i = N - 1; i >= 0; i--)
+ {
+ ia[i] = 1;
+ ib[i] = ia[i + 1];
+ }
+}
+
+/* Vectorizable. Dependence distance -1. */
+__attribute__((noinline)) void
+f5 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ ia[i + 1] = 1;
+ ia[i] = 2;
+ }
+}
+
+/* Not vectorizable due to data dependence: dependence distance 1. */
+__attribute__((noinline)) void
+f6 (void)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = 1;
+ ia[i + 1] = 2;
+ }
+}
+
+/* Not vectorizable due to data dependence: dependence distance 1. */
+__attribute__((noinline)) void
+f7 (void)
+{
+ int i;
+ for (i = N - 1; i >= 0; i--)
+ {
+ ia[i + 1] = 1;
+ ia[i] = 2;
+ }
+}
+
+/* Vectorizable. Dependence distance -1. */
+__attribute__((noinline)) void
+f8 (void)
+{
+ int i;
+ for (i = N - 1; i >= 0; i--)
+ {
+ ia[i] = 1;
+ ia[i + 1] = 2;
+ }
+}
+
+__attribute__ ((noinline)) int
+main1 (void)
+{
+ int i, j;
+
+ for (j = 0; j < 8; j++)
+ {
+ for (i = 0; i <= N; i++)
+ {
+ ia[i] = i + 3;
+ ib[i] = i + N + 3;
+ asm ("");
+ }
+
+ switch (j)
+ {
+ case 0: f1 (); break;
+ case 1: f2 (); break;
+ case 2: f3 (); break;
+ case 3: f4 (); break;
+ case 4: f5 (); break;
+ case 5: f6 (); break;
+ case 6: f7 (); break;
+ case 7: f8 (); break;
+ }
+
+ for (i = 0; i <= N; i++)
+ {
+ int ea = i + 3;
+ int eb = i + N + 3;
+ switch (j)
+ {
+ case 0:
+ if (i) ea = 1;
+ if (i == 0) eb = 3;
+ else if (i != N) eb = 1;
+ break;
+ case 1:
+ if (i != N) ea = 1;
+ if (i != N) eb = i + 4;
+ break;
+ case 2:
+ if (i) ea = 1;
+ if (i != N) eb = i + 3;
+ break;
+ case 3:
+ if (i != N) ea = 1;
+ if (i < N - 1) eb = 1;
+ else if (i == N - 1) eb = 67;
+ break;
+ case 4:
+ ea = 1 + (i != N);
+ break;
+ case 5:
+ ea = 2 - (i != N);
+ break;
+ case 6:
+ ea = 1 + (i == 0);
+ break;
+ case 7:
+ ea = 2 - (i == 0);
+ break;
+ }
+ if (ia[i] != ea || ib[i] != eb)
+ abort ();
+ }
+ }
+
+ return 0;
+}
+
+int main ()
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" {xfail vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "dependence distance negative" 4 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/main/gcc/testsuite/gcc.dg/vect/pr59594.c b/main/gcc/testsuite/gcc.dg/vect/pr59594.c
new file mode 100644
index 00000000000..6c0b5880ea1
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vect/pr59594.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/59594 */
+
+#include "tree-vect.h"
+
+#define N 1024
+int b[N + 1];
+
+int
+main ()
+{
+ int i;
+ check_vect ();
+ for (i = 0; i < N + 1; i++)
+ {
+ b[i] = i;
+ asm ("");
+ }
+ for (i = N; i >= 0; i--)
+ {
+ b[i + 1] = b[i];
+ b[i] = 1;
+ }
+ if (b[0] != 1)
+ __builtin_abort ();
+ for (i = 0; i < N; i++)
+ if (b[i + 1] != i)
+ __builtin_abort ();
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/main/gcc/testsuite/gcc.dg/vmx/merge-be-order.c b/main/gcc/testsuite/gcc.dg/vmx/merge-be-order.c
new file mode 100644
index 00000000000..2de888fa444
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vmx/merge-be-order.c
@@ -0,0 +1,96 @@
+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */
+
+#include "harness.h"
+
+static void test()
+{
+ /* Input vectors. */
+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ vector unsigned char vucb
+ = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
+ vector signed char vsca
+ = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1};
+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ vector unsigned short vusa = {0,1,2,3,4,5,6,7};
+ vector unsigned short vusb = {8,9,10,11,12,13,14,15};
+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1};
+ vector signed short vssb = {0,1,2,3,4,5,6,7};
+ vector unsigned int vuia = {0,1,2,3};
+ vector unsigned int vuib = {4,5,6,7};
+ vector signed int vsia = {-4,-3,-2,-1};
+ vector signed int vsib = {0,1,2,3};
+ vector float vfa = {-4.0,-3.0,-2.0,-1.0};
+ vector float vfb = {0.0,1.0,2.0,3.0};
+
+ /* Result vectors. */
+ vector unsigned char vuch, vucl;
+ vector signed char vsch, vscl;
+ vector unsigned short vush, vusl;
+ vector signed short vssh, vssl;
+ vector unsigned int vuih, vuil;
+ vector signed int vsih, vsil;
+ vector float vfh, vfl;
+
+ /* Expected result vectors. */
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ vector unsigned char vucrh = {24,8,25,9,26,10,27,11,28,12,29,13,30,14,31,15};
+ vector unsigned char vucrl = {16,0,17,1,18,2,19,3,20,4,21,5,22,6,23,7};
+ vector signed char vscrh = {8,-8,9,-7,10,-6,11,-5,12,-4,13,-3,14,-2,15,-1};
+ vector signed char vscrl = {0,-16,1,-15,2,-14,3,-13,4,-12,5,-11,6,-10,7,-9};
+ vector unsigned short vusrh = {12,4,13,5,14,6,15,7};
+ vector unsigned short vusrl = {8,0,9,1,10,2,11,3};
+ vector signed short vssrh = {4,-4,5,-3,6,-2,7,-1};
+ vector signed short vssrl = {0,-8,1,-7,2,-6,3,-5};
+ vector unsigned int vuirh = {6,2,7,3};
+ vector unsigned int vuirl = {4,0,5,1};
+ vector signed int vsirh = {2,-2,3,-1};
+ vector signed int vsirl = {0,-4,1,-3};
+ vector float vfrh = {2.0,-2.0,3.0,-1.0};
+ vector float vfrl = {0.0,-4.0,1.0,-3.0};
+#else
+ vector unsigned char vucrh = {0,16,1,17,2,18,3,19,4,20,5,21,6,22,7,23};
+ vector unsigned char vucrl = {8,24,9,25,10,26,11,27,12,28,13,29,14,30,15,31};
+ vector signed char vscrh = {-16,0,-15,1,-14,2,-13,3,-12,4,-11,5,-10,6,-9,7};
+ vector signed char vscrl = {-8,8,-7,9,-6,10,-5,11,-4,12,-3,13,-2,14,-1,15};
+ vector unsigned short vusrh = {0,8,1,9,2,10,3,11};
+ vector unsigned short vusrl = {4,12,5,13,6,14,7,15};
+ vector signed short vssrh = {-8,0,-7,1,-6,2,-5,3};
+ vector signed short vssrl = {-4,4,-3,5,-2,6,-1,7};
+ vector unsigned int vuirh = {0,4,1,5};
+ vector unsigned int vuirl = {2,6,3,7};
+ vector signed int vsirh = {-4,0,-3,1};
+ vector signed int vsirl = {-2,2,-1,3};
+ vector float vfrh = {-4.0,0.0,-3.0,1.0};
+ vector float vfrl = {-2.0,2.0,-1.0,3.0};
+#endif
+
+ vuch = vec_mergeh (vuca, vucb);
+ vucl = vec_mergel (vuca, vucb);
+ vsch = vec_mergeh (vsca, vscb);
+ vscl = vec_mergel (vsca, vscb);
+ vush = vec_mergeh (vusa, vusb);
+ vusl = vec_mergel (vusa, vusb);
+ vssh = vec_mergeh (vssa, vssb);
+ vssl = vec_mergel (vssa, vssb);
+ vuih = vec_mergeh (vuia, vuib);
+ vuil = vec_mergel (vuia, vuib);
+ vsih = vec_mergeh (vsia, vsib);
+ vsil = vec_mergel (vsia, vsib);
+ vfh = vec_mergeh (vfa, vfb );
+ vfl = vec_mergel (vfa, vfb );
+
+ check (vec_all_eq (vuch, vucrh), "vuch");
+ check (vec_all_eq (vucl, vucrl), "vucl");
+ check (vec_all_eq (vsch, vscrh), "vsch");
+ check (vec_all_eq (vscl, vscrl), "vscl");
+ check (vec_all_eq (vush, vusrh), "vush");
+ check (vec_all_eq (vusl, vusrl), "vusl");
+ check (vec_all_eq (vssh, vssrh), "vssh");
+ check (vec_all_eq (vssl, vssrl), "vssl");
+ check (vec_all_eq (vuih, vuirh), "vuih");
+ check (vec_all_eq (vuil, vuirl), "vuil");
+ check (vec_all_eq (vsih, vsirh), "vsih");
+ check (vec_all_eq (vsil, vsirl), "vsil");
+ check (vec_all_eq (vfh, vfrh), "vfh");
+ check (vec_all_eq (vfl, vfrl), "vfl");
+}
diff --git a/main/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c b/main/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c
new file mode 100644
index 00000000000..92cdabff0cf
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c
@@ -0,0 +1,46 @@
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */
+
+#include "harness.h"
+
+static int vec_long_eq (vector long x, vector long y)
+{
+ return (x[0] == y[0] && x[1] == y[1]);
+}
+
+static void test()
+{
+ /* Input vectors. */
+ vector long vla = {-2,-1};
+ vector long vlb = {0,1};
+ vector double vda = {-2.0,-1.0};
+ vector double vdb = {0.0,1.0};
+
+ /* Result vectors. */
+ vector long vlh, vll;
+ vector double vdh, vdl;
+
+ /* Expected result vectors. */
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ vector long vlrh = {1,-1};
+ vector long vlrl = {0,-2};
+ vector double vdrh = {1.0,-1.0};
+ vector double vdrl = {0.0,-2.0};
+#else
+ vector long vlrh = {-2,0};
+ vector long vlrl = {-1,1};
+ vector double vdrh = {-2.0,0.0};
+ vector double vdrl = {-1.0,1.0};
+#endif
+
+ vlh = vec_mergeh (vla, vlb);
+ vll = vec_mergel (vla, vlb);
+ vdh = vec_mergeh (vda, vdb);
+ vdl = vec_mergel (vda, vdb);
+
+ check (vec_long_eq (vlh, vlrh), "vlh");
+ check (vec_long_eq (vll, vlrl), "vll");
+ check (vec_all_eq (vdh, vdrh), "vdh" );
+ check (vec_all_eq (vdl, vdrl), "vdl" );
+}
diff --git a/main/gcc/testsuite/gcc.dg/vmx/merge-vsx.c b/main/gcc/testsuite/gcc.dg/vmx/merge-vsx.c
new file mode 100644
index 00000000000..51e45746843
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vmx/merge-vsx.c
@@ -0,0 +1,39 @@
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */
+
+#include "harness.h"
+
+static int vec_long_eq (vector long x, vector long y)
+{
+ return (x[0] == y[0] && x[1] == y[1]);
+}
+
+static void test()
+{
+ /* Input vectors. */
+ vector long vla = {-2,-1};
+ vector long vlb = {0,1};
+ vector double vda = {-2.0,-1.0};
+ vector double vdb = {0.0,1.0};
+
+ /* Result vectors. */
+ vector long vlh, vll;
+ vector double vdh, vdl;
+
+ /* Expected result vectors. */
+ vector long vlrh = {-2,0};
+ vector long vlrl = {-1,1};
+ vector double vdrh = {-2.0,0.0};
+ vector double vdrl = {-1.0,1.0};
+
+ vlh = vec_mergeh (vla, vlb);
+ vll = vec_mergel (vla, vlb);
+ vdh = vec_mergeh (vda, vdb);
+ vdl = vec_mergel (vda, vdb);
+
+ check (vec_long_eq (vlh, vlrh), "vlh");
+ check (vec_long_eq (vll, vlrl), "vll");
+ check (vec_all_eq (vdh, vdrh), "vdh" );
+ check (vec_all_eq (vdl, vdrl), "vdl" );
+}
diff --git a/main/gcc/testsuite/gcc.dg/vmx/merge.c b/main/gcc/testsuite/gcc.dg/vmx/merge.c
new file mode 100644
index 00000000000..84b14fea744
--- /dev/null
+++ b/main/gcc/testsuite/gcc.dg/vmx/merge.c
@@ -0,0 +1,77 @@
+#include "harness.h"
+
+static void test()
+{
+ /* Input vectors. */
+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ vector unsigned char vucb
+ = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
+ vector signed char vsca
+ = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1};
+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ vector unsigned short vusa = {0,1,2,3,4,5,6,7};
+ vector unsigned short vusb = {8,9,10,11,12,13,14,15};
+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1};
+ vector signed short vssb = {0,1,2,3,4,5,6,7};
+ vector unsigned int vuia = {0,1,2,3};
+ vector unsigned int vuib = {4,5,6,7};
+ vector signed int vsia = {-4,-3,-2,-1};
+ vector signed int vsib = {0,1,2,3};
+ vector float vfa = {-4.0,-3.0,-2.0,-1.0};
+ vector float vfb = {0.0,1.0,2.0,3.0};
+
+ /* Result vectors. */
+ vector unsigned char vuch, vucl;
+ vector signed char vsch, vscl;
+ vector unsigned short vush, vusl;
+ vector signed short vssh, vssl;
+ vector unsigned int vuih, vuil;
+ vector signed int vsih, vsil;
+ vector float vfh, vfl;
+
+ /* Expected result vectors. */
+ vector unsigned char vucrh = {0,16,1,17,2,18,3,19,4,20,5,21,6,22,7,23};
+ vector unsigned char vucrl = {8,24,9,25,10,26,11,27,12,28,13,29,14,30,15,31};
+ vector signed char vscrh = {-16,0,-15,1,-14,2,-13,3,-12,4,-11,5,-10,6,-9,7};
+ vector signed char vscrl = {-8,8,-7,9,-6,10,-5,11,-4,12,-3,13,-2,14,-1,15};
+ vector unsigned short vusrh = {0,8,1,9,2,10,3,11};
+ vector unsigned short vusrl = {4,12,5,13,6,14,7,15};
+ vector signed short vssrh = {-8,0,-7,1,-6,2,-5,3};
+ vector signed short vssrl = {-4,4,-3,5,-2,6,-1,7};
+ vector unsigned int vuirh = {0,4,1,5};
+ vector unsigned int vuirl = {2,6,3,7};
+ vector signed int vsirh = {-4,0,-3,1};
+ vector signed int vsirl = {-2,2,-1,3};
+ vector float vfrh = {-4.0,0.0,-3.0,1.0};
+ vector float vfrl = {-2.0,2.0,-1.0,3.0};
+
+ vuch = vec_mergeh (vuca, vucb);
+ vucl = vec_mergel (vuca, vucb);
+ vsch = vec_mergeh (vsca, vscb);
+ vscl = vec_mergel (vsca, vscb);
+ vush = vec_mergeh (vusa, vusb);
+ vusl = vec_mergel (vusa, vusb);
+ vssh = vec_mergeh (vssa, vssb);
+ vssl = vec_mergel (vssa, vssb);
+ vuih = vec_mergeh (vuia, vuib);
+ vuil = vec_mergel (vuia, vuib);
+ vsih = vec_mergeh (vsia, vsib);
+ vsil = vec_mergel (vsia, vsib);
+ vfh = vec_mergeh (vfa, vfb );
+ vfl = vec_mergel (vfa, vfb );
+
+ check (vec_all_eq (vuch, vucrh), "vuch");
+ check (vec_all_eq (vucl, vucrl), "vucl");
+ check (vec_all_eq (vsch, vscrh), "vsch");
+ check (vec_all_eq (vscl, vscrl), "vscl");
+ check (vec_all_eq (vush, vusrh), "vush");
+ check (vec_all_eq (vusl, vusrl), "vusl");
+ check (vec_all_eq (vssh, vssrh), "vssh");
+ check (vec_all_eq (vssl, vssrl), "vssl");
+ check (vec_all_eq (vuih, vuirh), "vuih");
+ check (vec_all_eq (vuil, vuirl), "vuil");
+ check (vec_all_eq (vsih, vsirh), "vsih");
+ check (vec_all_eq (vsil, vsirl), "vsil");
+ check (vec_all_eq (vfh, vfrh), "vfh");
+ check (vec_all_eq (vfl, vfrl), "vfl");
+}
diff --git a/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-arm.c b/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-arm.c
new file mode 100644
index 00000000000..3cf987ccc87
--- /dev/null
+++ b/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-arm.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv7ve" } } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-mthumb" } { "" } } */
+/* { dg-options "-marm" } */
+/* { dg-add-options arm_arch_v7ve } */
+
+#define NEED_ARM_ARCH
+#define VALUE_ARM_ARCH 7
+
+#define NEED_ARM_ARCH_ISA_ARM
+#define VALUE_ARM_ARCH_ISA_ARM 1
+
+#define NEED_ARM_ARCH_ISA_THUMB
+#define VALUE_ARM_ARCH_ISA_THUMB 2
+
+#define NEED_ARM_ARCH_PROFILE
+#define VALUE_ARM_ARCH_PROFILE 'A'
+
+#define NEED_ARM_FEATURE_UNALIGNED
+#define VALUE_ARM_FEATURE_UNALIGNED 1
+
+#define NEED_ARM_FEATURE_LDREX
+#define VALUE_ARM_FEATURE_LDREX 15
+
+#define NEED_ARM_FEATURE_CLZ
+#define VALUE_ARM_FEATURE_CLZ 1
+
+#define NEED_ARM_FEATURE_DSP
+#define VALUE_ARM_FEATURE_DSP 1
+
+#define NEED_ARM_FEATURE_SIMD32
+#define VALUE_ARM_FEATURE_SIMD32 1
+
+#define NEED_ARM_FEATURE_QBIT
+#define VALUE_ARM_FEATURE_QBIT 1
+
+#define NEED_ARM_FEATURE_SAT
+#define VALUE_ARM_FEATURE_SAT 1
+
+#include "ftest-support.h"
diff --git a/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-thumb.c b/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-thumb.c
new file mode 100644
index 00000000000..0d6b4322133
--- /dev/null
+++ b/main/gcc/testsuite/gcc.target/arm/ftest-armv7ve-thumb.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv7ve" } } */
+/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */
+/* { dg-options "-mthumb" } */
+/* { dg-add-options arm_arch_v7ve } */
+
+#define NEED_ARM_ARCH
+#define VALUE_ARM_ARCH 7
+
+#define NEED_ARM_ARCH_ISA_ARM
+#define VALUE_ARM_ARCH_ISA_ARM 1
+
+#define NEED_ARM_ARCH_ISA_THUMB
+#define VALUE_ARM_ARCH_ISA_THUMB 2
+
+#define NEED_ARM_ARCH_PROFILE
+#define VALUE_ARM_ARCH_PROFILE 'A'
+
+#define NEED_ARM_FEATURE_UNALIGNED
+#define VALUE_ARM_FEATURE_UNALIGNED 1
+
+#define NEED_ARM_FEATURE_LDREX
+#define VALUE_ARM_FEATURE_LDREX 15
+
+#define NEED_ARM_FEATURE_CLZ
+#define VALUE_ARM_FEATURE_CLZ 1
+
+#define NEED_ARM_FEATURE_DSP
+#define VALUE_ARM_FEATURE_DSP 1
+
+#define NEED_ARM_FEATURE_SIMD32
+#define VALUE_ARM_FEATURE_SIMD32 1
+
+#define NEED_ARM_FEATURE_QBIT
+#define VALUE_ARM_FEATURE_QBIT 1
+
+#define NEED_ARM_FEATURE_SAT
+#define VALUE_ARM_FEATURE_SAT 1
+
+#include "ftest-support.h"
diff --git a/main/gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c b/main/gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c
index ad28e7f54b8..5894df964a0 100644
--- a/main/gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c
+++ b/main/gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c
@@ -12,4 +12,4 @@ int ldrb(unsigned char* p)
/* { dg-final { scan-assembler "127" } } */
-/* { dg-final { scan-assembler "bhi" } } */
+/* { dg-final { scan-assembler "bhi|bls" } } */
diff --git a/main/gcc/testsuite/gcc.target/i386/avx512f-gather-2.c b/main/gcc/testsuite/gcc.target/i386/avx512f-gather-2.c
index 86641926149..f20d3db228e 100644
--- a/main/gcc/testsuite/gcc.target/i386/avx512f-gather-2.c
+++ b/main/gcc/testsuite/gcc.target/i386/avx512f-gather-2.c
@@ -3,9 +3,9 @@
#include "avx512f-gather-1.c"
-/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*ymm" { xfail { *-*-* } } } } */ /* PR59617 */
-/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*ymm" { xfail { *-*-* } } } } */ /* PR59617 */
-/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*xmm" { xfail { *-*-* } } } } */ /* PR59617 */
-/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*xmm" { xfail { lp64 } } } } */ /* PR59617 */
+/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*ymm" } } */
+/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*ymm" } } */
+/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*xmm" } } */
+/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*xmm" } } */
/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops in function" 16 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/main/gcc/testsuite/gcc.target/i386/avx512f-gather-5.c b/main/gcc/testsuite/gcc.target/i386/avx512f-gather-5.c
index 5edd446cb73..d2237da1566 100644
--- a/main/gcc/testsuite/gcc.target/i386/avx512f-gather-5.c
+++ b/main/gcc/testsuite/gcc.target/i386/avx512f-gather-5.c
@@ -3,8 +3,8 @@
#include "avx512f-gather-4.c"
-/* { dg-final { scan-assembler "gather\[^\n\]*zmm" { xfail { *-*-* } } } } */ /* PR59617 */
-/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*ymm" { xfail { *-*-* } } } } */ /* PR59617 */
+/* { dg-final { scan-assembler "gather\[^\n\]*zmm" } } */
+/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*ymm" } } */
/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*ymm" } } */
/* { dg-final { scan-assembler-not "gather\[^\n\]*ymm\[^\n\]*xmm" } } */
/* { dg-final { scan-assembler-not "gather\[^\n\]*xmm\[^\n\]*xmm" } } */
diff --git a/main/gcc/testsuite/gcc.target/mips/pr52125.c b/main/gcc/testsuite/gcc.target/mips/pr52125.c
index cfa8d68d10b..2ac80672060 100644
--- a/main/gcc/testsuite/gcc.target/mips/pr52125.c
+++ b/main/gcc/testsuite/gcc.target/mips/pr52125.c
@@ -1,4 +1,4 @@
-/* { dg-options "addressing=absolute" } */
+/* { dg-options "-mno-gpopt addressing=absolute" } */
int a, b, c, d;
diff --git a/main/gcc/testsuite/gfortran.dg/allocate_class_3.f90 b/main/gcc/testsuite/gfortran.dg/allocate_class_3.f90
new file mode 100644
index 00000000000..ddc7e23283f
--- /dev/null
+++ b/main/gcc/testsuite/gfortran.dg/allocate_class_3.f90
@@ -0,0 +1,107 @@
+! { dg-do run }
+! Tests the fix for PR59414, comment #3, in which the allocate
+! expressions were not correctly being stripped to provide the
+! vpointer as an lhs to the pointer assignment of the vptr from
+! the SOURCE expression.
+!
+! Contributed by Antony Lewis
+!
+module ObjectLists
+ implicit none
+
+ type :: t
+ integer :: i
+ end type
+
+ type Object_array_pointer
+ class(t), pointer :: p(:)
+ end type
+
+contains
+
+ subroutine AddArray1 (P, Pt)
+ class(t) :: P(:)
+ class(Object_array_pointer) :: Pt
+
+ select type (Pt)
+ class is (Object_array_pointer)
+ if (associated (Pt%P)) deallocate (Pt%P)
+ allocate(Pt%P(1:SIZE(P)), source=P)
+ end select
+ end subroutine
+
+ subroutine AddArray2 (P, Pt)
+ class(t) :: P(:)
+ class(Object_array_pointer) :: Pt
+
+ select type (Pt)
+ type is (Object_array_pointer)
+ if (associated (Pt%P)) deallocate (Pt%P)
+ allocate(Pt%P(1:SIZE(P)), source=P)
+ end select
+ end subroutine
+
+ subroutine AddArray3 (P, Pt)
+ class(t) :: P
+ class(Object_array_pointer) :: Pt
+
+ select type (Pt)
+ class is (Object_array_pointer)
+ if (associated (Pt%P)) deallocate (Pt%P)
+ allocate(Pt%P(1:4), source=P)
+ end select
+ end subroutine
+
+ subroutine AddArray4 (P, Pt)
+ type(t) :: P(:)
+ class(Object_array_pointer) :: Pt
+
+ select type (Pt)
+ class is (Object_array_pointer)
+ if (associated (Pt%P)) deallocate (Pt%P)
+ allocate(Pt%P(1:SIZE(P)), source=P)
+ end select
+ end subroutine
+end module
+
+ use ObjectLists
+ type(Object_array_pointer), pointer :: Pt
+ class(t), pointer :: P(:)
+
+ allocate (P(2), source = [t(1),t(2)])
+ allocate (Pt, source = Object_array_pointer(NULL()))
+ call AddArray1 (P, Pt)
+ select type (x => Pt%p)
+ type is (t)
+ if (any (x%i .ne. [1,2])) call abort
+ end select
+ deallocate (P)
+ deallocate (pt)
+
+ allocate (P(3), source = [t(3),t(4),t(5)])
+ allocate (Pt, source = Object_array_pointer(NULL()))
+ call AddArray2 (P, Pt)
+ select type (x => Pt%p)
+ type is (t)
+ if (any (x%i .ne. [3,4,5])) call abort
+ end select
+ deallocate (P)
+ deallocate (pt)
+
+ allocate (Pt, source = Object_array_pointer(NULL()))
+ call AddArray3 (t(6), Pt)
+ select type (x => Pt%p)
+ type is (t)
+ if (any (x%i .ne. [6,6,6,6])) call abort
+ end select
+ deallocate (pt)
+
+ allocate (Pt, source = Object_array_pointer(NULL()))
+ call AddArray4 ([t(7), t(8)], Pt)
+ select type (x => Pt%p)
+ type is (t)
+ if (any (x%i .ne. [7,8])) call abort
+ end select
+ deallocate (pt)
+ end
+
diff --git a/main/gcc/testsuite/lib/target-supports.exp b/main/gcc/testsuite/lib/target-supports.exp
index a8029c8477e..b1c397c221b 100644
--- a/main/gcc/testsuite/lib/target-supports.exp
+++ b/main/gcc/testsuite/lib/target-supports.exp
@@ -2630,6 +2630,7 @@ foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
v6z "-march=armv6z" __ARM_ARCH_6Z__
v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
v7a "-march=armv7-a" __ARM_ARCH_7A__
+ v7ve "-march=armv7ve" __ARM_ARCH_7A__
v7r "-march=armv7-r" __ARM_ARCH_7R__
v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
diff --git a/main/gcc/tree-cfg.c b/main/gcc/tree-cfg.c
index 5292c79a6e5..9b07bc77f34 100644
--- a/main/gcc/tree-cfg.c
+++ b/main/gcc/tree-cfg.c
@@ -107,9 +107,6 @@ struct cfg_stats_d
static struct cfg_stats_d cfg_stats;
-/* Nonzero if we found a computed goto while building basic blocks. */
-static bool found_computed_goto;
-
/* Hash table to store last discriminator assigned for each locus. */
struct locus_discrim_map
{
@@ -149,14 +146,13 @@ static hash_table discriminator_per_locus;
/* Basic blocks and flowgraphs. */
static void make_blocks (gimple_seq);
-static void factor_computed_gotos (void);
/* Edges. */
static void make_edges (void);
static void assign_discriminators (void);
static void make_cond_expr_edges (basic_block);
static void make_gimple_switch_edges (basic_block);
-static void make_goto_expr_edges (basic_block);
+static bool make_goto_expr_edges (basic_block);
static void make_gimple_asm_edges (basic_block);
static edge gimple_redirect_edge_and_branch (edge, basic_block);
static edge gimple_try_redirect_by_replacing_jump (edge, basic_block);
@@ -226,17 +222,8 @@ build_gimple_cfg (gimple_seq seq)
init_empty_tree_cfg ();
- found_computed_goto = 0;
make_blocks (seq);
- /* Computed gotos are hell to deal with, especially if there are
- lots of them with a large number of destinations. So we factor
- them to a common computed goto location before we build the
- edge list. After we convert back to normal form, we will un-factor
- the computed gotos since factoring introduces an unwanted jump. */
- if (found_computed_goto)
- factor_computed_gotos ();
-
/* Make sure there is always at least one block, even if it's empty. */
if (n_basic_blocks_for_fn (cfun) == NUM_FIXED_BLOCKS)
create_empty_bb (ENTRY_BLOCK_PTR_FOR_FN (cfun));
@@ -386,7 +373,7 @@ make_pass_build_cfg (gcc::context *ctxt)
/* Return true if T is a computed goto. */
-static bool
+bool
computed_goto_p (gimple t)
{
return (gimple_code (t) == GIMPLE_GOTO
@@ -438,82 +425,6 @@ assert_unreachable_fallthru_edge_p (edge e)
}
-/* Search the CFG for any computed gotos. If found, factor them to a
- common computed goto site. Also record the location of that site so
- that we can un-factor the gotos after we have converted back to
- normal form. */
-
-static void
-factor_computed_gotos (void)
-{
- basic_block bb;
- tree factored_label_decl = NULL;
- tree var = NULL;
- gimple factored_computed_goto_label = NULL;
- gimple factored_computed_goto = NULL;
-
- /* We know there are one or more computed gotos in this function.
- Examine the last statement in each basic block to see if the block
- ends with a computed goto. */
-
- FOR_EACH_BB_FN (bb, cfun)
- {
- gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gimple last;
-
- if (gsi_end_p (gsi))
- continue;
-
- last = gsi_stmt (gsi);
-
- /* Ignore the computed goto we create when we factor the original
- computed gotos. */
- if (last == factored_computed_goto)
- continue;
-
- /* If the last statement is a computed goto, factor it. */
- if (computed_goto_p (last))
- {
- gimple assignment;
-
- /* The first time we find a computed goto we need to create
- the factored goto block and the variable each original
- computed goto will use for their goto destination. */
- if (!factored_computed_goto)
- {
- basic_block new_bb = create_empty_bb (bb);
- gimple_stmt_iterator new_gsi = gsi_start_bb (new_bb);
-
- /* Create the destination of the factored goto. Each original
- computed goto will put its desired destination into this
- variable and jump to the label we create immediately
- below. */
- var = create_tmp_var (ptr_type_node, "gotovar");
-
- /* Build a label for the new block which will contain the
- factored computed goto. */
- factored_label_decl = create_artificial_label (UNKNOWN_LOCATION);
- factored_computed_goto_label
- = gimple_build_label (factored_label_decl);
- gsi_insert_after (&new_gsi, factored_computed_goto_label,
- GSI_NEW_STMT);
-
- /* Build our new computed goto. */
- factored_computed_goto = gimple_build_goto (var);
- gsi_insert_after (&new_gsi, factored_computed_goto, GSI_NEW_STMT);
- }
-
- /* Copy the original computed goto's destination into VAR. */
- assignment = gimple_build_assign (var, gimple_goto_dest (last));
- gsi_insert_before (&gsi, assignment, GSI_SAME_STMT);
-
- /* And re-vector the computed goto to the new destination. */
- gimple_goto_set_dest (last, factored_label_decl);
- }
- }
-}
-
-
/* Build a flowgraph for the sequence of stmts SEQ. */
static void
@@ -547,9 +458,6 @@ make_blocks (gimple_seq seq)
codes. */
gimple_set_bb (stmt, bb);
- if (computed_goto_p (stmt))
- found_computed_goto = true;
-
/* If STMT is a basic block terminator, set START_NEW_BLOCK for the
next iteration. */
if (stmt_ends_bb_p (stmt))
@@ -667,6 +575,144 @@ fold_cond_expr_cond (void)
}
}
+/* If basic block BB has an abnormal edge to a basic block
+ containing IFN_ABNORMAL_DISPATCHER internal call, return
+ that the dispatcher's basic block, otherwise return NULL. */
+
+basic_block
+get_abnormal_succ_dispatcher (basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if ((e->flags & (EDGE_ABNORMAL | EDGE_EH)) == EDGE_ABNORMAL)
+ {
+ gimple_stmt_iterator gsi
+ = gsi_start_nondebug_after_labels_bb (e->dest);
+ gimple g = gsi_stmt (gsi);
+ if (g
+ && is_gimple_call (g)
+ && gimple_call_internal_p (g)
+ && gimple_call_internal_fn (g) == IFN_ABNORMAL_DISPATCHER)
+ return e->dest;
+ }
+ return NULL;
+}
+
+/* Helper function for make_edges. Create a basic block with
+ with ABNORMAL_DISPATCHER internal call in it if needed, and
+ create abnormal edges from BBS to it and from it to FOR_BB
+ if COMPUTED_GOTO is false, otherwise factor the computed gotos. */
+
+static void
+handle_abnormal_edges (basic_block *dispatcher_bbs,
+ basic_block for_bb, int *bb_to_omp_idx,
+ auto_vec *bbs, bool computed_goto)
+{
+ basic_block *dispatcher = dispatcher_bbs + (computed_goto ? 1 : 0);
+ unsigned int idx = 0;
+ basic_block bb;
+ bool inner = false;
+
+ if (bb_to_omp_idx)
+ {
+ dispatcher = dispatcher_bbs + 2 * bb_to_omp_idx[for_bb->index];
+ if (bb_to_omp_idx[for_bb->index] != 0)
+ inner = true;
+ }
+
+ /* If the dispatcher has been created already, then there are basic
+ blocks with abnormal edges to it, so just make a new edge to
+ for_bb. */
+ if (*dispatcher == NULL)
+ {
+ /* Check if there are any basic blocks that need to have
+ abnormal edges to this dispatcher. If there are none, return
+ early. */
+ if (bb_to_omp_idx == NULL)
+ {
+ if (bbs->is_empty ())
+ return;
+ }
+ else
+ {
+ FOR_EACH_VEC_ELT (*bbs, idx, bb)
+ if (bb_to_omp_idx[bb->index] == bb_to_omp_idx[for_bb->index])
+ break;
+ if (bb == NULL)
+ return;
+ }
+
+ /* Create the dispatcher bb. */
+ *dispatcher = create_basic_block (NULL, NULL, for_bb);
+ if (computed_goto)
+ {
+ /* Factor computed gotos into a common computed goto site. Also
+ record the location of that site so that we can un-factor the
+ gotos after we have converted back to normal form. */
+ gimple_stmt_iterator gsi = gsi_start_bb (*dispatcher);
+
+ /* Create the destination of the factored goto. Each original
+ computed goto will put its desired destination into this
+ variable and jump to the label we create immediately below. */
+ tree var = create_tmp_var (ptr_type_node, "gotovar");
+
+ /* Build a label for the new block which will contain the
+ factored computed goto. */
+ tree factored_label_decl
+ = create_artificial_label (UNKNOWN_LOCATION);
+ gimple factored_computed_goto_label
+ = gimple_build_label (factored_label_decl);
+ gsi_insert_after (&gsi, factored_computed_goto_label, GSI_NEW_STMT);
+
+ /* Build our new computed goto. */
+ gimple factored_computed_goto = gimple_build_goto (var);
+ gsi_insert_after (&gsi, factored_computed_goto, GSI_NEW_STMT);
+
+ FOR_EACH_VEC_ELT (*bbs, idx, bb)
+ {
+ if (bb_to_omp_idx
+ && bb_to_omp_idx[bb->index] != bb_to_omp_idx[for_bb->index])
+ continue;
+
+ gsi = gsi_last_bb (bb);
+ gimple last = gsi_stmt (gsi);
+
+ gcc_assert (computed_goto_p (last));
+
+ /* Copy the original computed goto's destination into VAR. */
+ gimple assignment
+ = gimple_build_assign (var, gimple_goto_dest (last));
+ gsi_insert_before (&gsi, assignment, GSI_SAME_STMT);
+
+ edge e = make_edge (bb, *dispatcher, EDGE_FALLTHRU);
+ e->goto_locus = gimple_location (last);
+ gsi_remove (&gsi, true);
+ }
+ }
+ else
+ {
+ tree arg = inner ? boolean_true_node : boolean_false_node;
+ gimple g = gimple_build_call_internal (IFN_ABNORMAL_DISPATCHER,
+ 1, arg);
+ gimple_stmt_iterator gsi = gsi_after_labels (*dispatcher);
+ gsi_insert_after (&gsi, g, GSI_NEW_STMT);
+
+ /* Create predecessor edges of the dispatcher. */
+ FOR_EACH_VEC_ELT (*bbs, idx, bb)
+ {
+ if (bb_to_omp_idx
+ && bb_to_omp_idx[bb->index] != bb_to_omp_idx[for_bb->index])
+ continue;
+ make_edge (bb, *dispatcher, EDGE_ABNORMAL);
+ }
+ }
+ }
+
+ make_edge (*dispatcher, for_bb, EDGE_ABNORMAL);
+}
+
/* Join all the blocks in the flowgraph. */
static void
@@ -674,6 +720,10 @@ make_edges (void)
{
basic_block bb;
struct omp_region *cur_region = NULL;
+ auto_vec ab_edge_goto;
+ auto_vec ab_edge_call;
+ int *bb_to_omp_idx = NULL;
+ int cur_omp_region_idx = 0;
/* Create an edge from entry to the first block with executable
statements in it. */
@@ -687,13 +737,17 @@ make_edges (void)
gimple last = last_stmt (bb);
bool fallthru;
+ if (bb_to_omp_idx)
+ bb_to_omp_idx[bb->index] = cur_omp_region_idx;
+
if (last)
{
enum gimple_code code = gimple_code (last);
switch (code)
{
case GIMPLE_GOTO:
- make_goto_expr_edges (bb);
+ if (make_goto_expr_edges (bb))
+ ab_edge_goto.safe_push (bb);
fallthru = false;
break;
case GIMPLE_RETURN:
@@ -721,7 +775,7 @@ make_edges (void)
make edges from this call site to all the nonlocal goto
handlers. */
if (stmt_can_make_abnormal_goto (last))
- make_abnormal_goto_edges (bb, true);
+ ab_edge_call.safe_push (bb);
/* If this statement has reachable exception handlers, then
create abnormal edges to them. */
@@ -729,8 +783,10 @@ make_edges (void)
/* BUILTIN_RETURN is really a return statement. */
if (gimple_call_builtin_p (last, BUILT_IN_RETURN))
- make_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), 0), fallthru =
- false;
+ {
+ make_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), 0);
+ fallthru = false;
+ }
/* Some calls are known not to return. */
else
fallthru = !(gimple_call_flags (last) & ECF_NORETURN);
@@ -750,7 +806,10 @@ make_edges (void)
break;
CASE_GIMPLE_OMP:
- fallthru = make_gimple_omp_edges (bb, &cur_region);
+ fallthru = make_gimple_omp_edges (bb, &cur_region,
+ &cur_omp_region_idx);
+ if (cur_region && bb_to_omp_idx == NULL)
+ bb_to_omp_idx = XCNEWVEC (int, n_basic_blocks_for_fn (cfun));
break;
case GIMPLE_TRANSACTION:
@@ -774,6 +833,77 @@ make_edges (void)
make_edge (bb, bb->next_bb, EDGE_FALLTHRU);
}
+ /* Computed gotos are hell to deal with, especially if there are
+ lots of them with a large number of destinations. So we factor
+ them to a common computed goto location before we build the
+ edge list. After we convert back to normal form, we will un-factor
+ the computed gotos since factoring introduces an unwanted jump.
+ For non-local gotos and abnormal edges from calls to calls that return
+ twice or forced labels, factor the abnormal edges too, by having all
+ abnormal edges from the calls go to a common artificial basic block
+ with ABNORMAL_DISPATCHER internal call and abnormal edges from that
+ basic block to all forced labels and calls returning twice.
+ We do this per-OpenMP structured block, because those regions
+ are guaranteed to be single entry single exit by the standard,
+ so it is not allowed to enter or exit such regions abnormally this way,
+ thus all computed gotos, non-local gotos and setjmp/longjmp calls
+ must not transfer control across SESE region boundaries. */
+ if (!ab_edge_goto.is_empty () || !ab_edge_call.is_empty ())
+ {
+ gimple_stmt_iterator gsi;
+ basic_block dispatcher_bb_array[2] = { NULL, NULL };
+ basic_block *dispatcher_bbs = dispatcher_bb_array;
+ int count = n_basic_blocks_for_fn (cfun);
+
+ if (bb_to_omp_idx)
+ dispatcher_bbs = XCNEWVEC (basic_block, 2 * count);
+
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple label_stmt = gsi_stmt (gsi);
+ tree target;
+
+ if (gimple_code (label_stmt) != GIMPLE_LABEL)
+ break;
+
+ target = gimple_label_label (label_stmt);
+
+ /* Make an edge to every label block that has been marked as a
+ potential target for a computed goto or a non-local goto. */
+ if (FORCED_LABEL (target))
+ handle_abnormal_edges (dispatcher_bbs, bb, bb_to_omp_idx,
+ &ab_edge_goto, true);
+ if (DECL_NONLOCAL (target))
+ {
+ handle_abnormal_edges (dispatcher_bbs, bb, bb_to_omp_idx,
+ &ab_edge_call, false);
+ break;
+ }
+ }
+
+ if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next_nondebug (&gsi);
+ if (!gsi_end_p (gsi))
+ {
+ /* Make an edge to every setjmp-like call. */
+ gimple call_stmt = gsi_stmt (gsi);
+ if (is_gimple_call (call_stmt)
+ && ((gimple_call_flags (call_stmt) & ECF_RETURNS_TWICE)
+ || gimple_call_builtin_p (call_stmt,
+ BUILT_IN_SETJMP_RECEIVER)))
+ handle_abnormal_edges (dispatcher_bbs, bb, bb_to_omp_idx,
+ &ab_edge_call, false);
+ }
+ }
+
+ if (bb_to_omp_idx)
+ XDELETE (dispatcher_bbs);
+ }
+
+ XDELETE (bb_to_omp_idx);
+
free_omp_regions ();
/* Fold COND_EXPR_COND of each COND_EXPR. */
@@ -1046,53 +1176,10 @@ label_to_block_fn (struct function *ifun, tree dest)
return (*ifun->cfg->x_label_to_block_map)[uid];
}
-/* Create edges for an abnormal goto statement at block BB. If FOR_CALL
- is true, the source statement is a CALL_EXPR instead of a GOTO_EXPR. */
-
-void
-make_abnormal_goto_edges (basic_block bb, bool for_call)
-{
- basic_block target_bb;
- gimple_stmt_iterator gsi;
-
- FOR_EACH_BB_FN (target_bb, cfun)
- {
- for (gsi = gsi_start_bb (target_bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple label_stmt = gsi_stmt (gsi);
- tree target;
-
- if (gimple_code (label_stmt) != GIMPLE_LABEL)
- break;
-
- target = gimple_label_label (label_stmt);
-
- /* Make an edge to every label block that has been marked as a
- potential target for a computed goto or a non-local goto. */
- if ((FORCED_LABEL (target) && !for_call)
- || (DECL_NONLOCAL (target) && for_call))
- {
- make_edge (bb, target_bb, EDGE_ABNORMAL);
- break;
- }
- }
- if (!gsi_end_p (gsi)
- && is_gimple_debug (gsi_stmt (gsi)))
- gsi_next_nondebug (&gsi);
- if (!gsi_end_p (gsi))
- {
- /* Make an edge to every setjmp-like call. */
- gimple call_stmt = gsi_stmt (gsi);
- if (is_gimple_call (call_stmt)
- && (gimple_call_flags (call_stmt) & ECF_RETURNS_TWICE))
- make_edge (bb, target_bb, EDGE_ABNORMAL);
- }
- }
-}
-
-/* Create edges for a goto statement at block BB. */
+/* Create edges for a goto statement at block BB. Returns true
+ if abnormal edges should be created. */
-static void
+static bool
make_goto_expr_edges (basic_block bb)
{
gimple_stmt_iterator last = gsi_last_bb (bb);
@@ -1106,11 +1193,11 @@ make_goto_expr_edges (basic_block bb)
edge e = make_edge (bb, label_bb, EDGE_FALLTHRU);
e->goto_locus = gimple_location (goto_t);
gsi_remove (&last, true);
- return;
+ return false;
}
/* A computed GOTO creates abnormal edges. */
- make_abnormal_goto_edges (bb, false);
+ return true;
}
/* Create edges for an asm statement with labels at block BB. */
diff --git a/main/gcc/tree-cfg.h b/main/gcc/tree-cfg.h
index babbd2db2ca..a115df58b9d 100644
--- a/main/gcc/tree-cfg.h
+++ b/main/gcc/tree-cfg.h
@@ -31,7 +31,6 @@ extern void start_recording_case_labels (void);
extern void end_recording_case_labels (void);
extern basic_block label_to_block_fn (struct function *, tree);
#define label_to_block(t) (label_to_block_fn (cfun, t))
-extern void make_abnormal_goto_edges (basic_block, bool);
extern void cleanup_dead_labels (void);
extern void group_case_labels_stmt (gimple);
extern void group_case_labels (void);
@@ -46,7 +45,9 @@ extern void gimple_debug_cfg (int);
extern void gimple_dump_cfg (FILE *, int);
extern void dump_cfg_stats (FILE *);
extern void debug_cfg_stats (void);
+extern bool computed_goto_p (gimple);
extern bool stmt_can_make_abnormal_goto (gimple);
+extern basic_block get_abnormal_succ_dispatcher (basic_block);
extern bool is_ctrl_stmt (gimple);
extern bool is_ctrl_altering_stmt (gimple);
extern bool simple_goto_p (gimple);
diff --git a/main/gcc/tree-data-ref.h b/main/gcc/tree-data-ref.h
index d9eac29dbaf..9d819e4a0ff 100644
--- a/main/gcc/tree-data-ref.h
+++ b/main/gcc/tree-data-ref.h
@@ -457,32 +457,6 @@ same_access_functions (const struct data_dependence_relation *ddr)
return true;
}
-/* Return true when DDR is an anti-dependence relation. */
-
-static inline bool
-ddr_is_anti_dependent (ddr_p ddr)
-{
- return (DDR_ARE_DEPENDENT (ddr) == NULL_TREE
- && DR_IS_READ (DDR_A (ddr))
- && DR_IS_WRITE (DDR_B (ddr))
- && !same_access_functions (ddr));
-}
-
-/* Return true when DEPENDENCE_RELATIONS contains an anti-dependence. */
-
-static inline bool
-ddrs_have_anti_deps (vec dependence_relations)
-{
- unsigned i;
- ddr_p ddr;
-
- for (i = 0; dependence_relations.iterate (i, &ddr); i++)
- if (ddr_is_anti_dependent (ddr))
- return true;
-
- return false;
-}
-
/* Returns true when all the dependences are computable. */
inline bool
diff --git a/main/gcc/tree-inline.c b/main/gcc/tree-inline.c
index f48bc7704e9..a2e5677ed01 100644
--- a/main/gcc/tree-inline.c
+++ b/main/gcc/tree-inline.c
@@ -1969,7 +1969,7 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
static bool
copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
- bool can_make_abnormal_goto)
+ basic_block abnormal_goto_dest)
{
basic_block new_bb = (basic_block) bb->aux;
edge_iterator ei;
@@ -2023,7 +2023,9 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
into a COMPONENT_REF which doesn't. If the copy
can throw, the original could also throw. */
can_throw = stmt_can_throw_internal (copy_stmt);
- nonlocal_goto = stmt_can_make_abnormal_goto (copy_stmt);
+ nonlocal_goto
+ = (stmt_can_make_abnormal_goto (copy_stmt)
+ && !computed_goto_p (copy_stmt));
if (can_throw || nonlocal_goto)
{
@@ -2054,9 +2056,26 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
/* If the call we inline cannot make abnormal goto do not add
additional abnormal edges but only retain those already present
in the original function body. */
- nonlocal_goto &= can_make_abnormal_goto;
+ if (abnormal_goto_dest == NULL)
+ nonlocal_goto = false;
if (nonlocal_goto)
- make_abnormal_goto_edges (gimple_bb (copy_stmt), true);
+ {
+ basic_block copy_stmt_bb = gimple_bb (copy_stmt);
+
+ if (get_abnormal_succ_dispatcher (copy_stmt_bb))
+ nonlocal_goto = false;
+ /* ABNORMAL_DISPATCHER (1) is for longjmp/setjmp or nonlocal gotos
+ in OpenMP regions which aren't allowed to be left abnormally.
+ So, no need to add abnormal edge in that case. */
+ else if (is_gimple_call (copy_stmt)
+ && gimple_call_internal_p (copy_stmt)
+ && (gimple_call_internal_fn (copy_stmt)
+ == IFN_ABNORMAL_DISPATCHER)
+ && gimple_call_arg (copy_stmt, 0) == boolean_true_node)
+ nonlocal_goto = false;
+ else
+ make_edge (copy_stmt_bb, abnormal_goto_dest, EDGE_ABNORMAL);
+ }
if ((can_throw || nonlocal_goto)
&& gimple_in_ssa_p (cfun))
@@ -2496,13 +2515,22 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
last = last_basic_block_for_fn (cfun);
/* Now that we've duplicated the blocks, duplicate their edges. */
- bool can_make_abormal_goto
- = id->gimple_call && stmt_can_make_abnormal_goto (id->gimple_call);
+ basic_block abnormal_goto_dest = NULL;
+ if (id->gimple_call
+ && stmt_can_make_abnormal_goto (id->gimple_call))
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (id->gimple_call);
+
+ bb = gimple_bb (id->gimple_call);
+ gsi_next (&gsi);
+ if (gsi_end_p (gsi))
+ abnormal_goto_dest = get_abnormal_succ_dispatcher (bb);
+ }
FOR_ALL_BB_FN (bb, cfun_to_copy)
if (!id->blocks_to_copy
|| (bb->index > 0 && bitmap_bit_p (id->blocks_to_copy, bb->index)))
need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map,
- can_make_abormal_goto);
+ abnormal_goto_dest);
if (new_entry)
{
diff --git a/main/gcc/tree-ssa-forwprop.c b/main/gcc/tree-ssa-forwprop.c
index ce9e42621e6..ebdd8f546f2 100644
--- a/main/gcc/tree-ssa-forwprop.c
+++ b/main/gcc/tree-ssa-forwprop.c
@@ -2543,6 +2543,7 @@ associate_plusminus (gimple_stmt_iterator *gsi)
CST +- (CST +- A) -> CST +- A
CST +- (A +- CST) -> CST +- A
A + ~A -> -1
+ (T)(P + A) - (T)P -> (T)A
via commutating the addition and contracting operations to zero
by reassociation. */
@@ -2646,6 +2647,55 @@ associate_plusminus (gimple_stmt_iterator *gsi)
gimple_set_modified (stmt, true);
}
}
+ else if (CONVERT_EXPR_CODE_P (def_code) && code == MINUS_EXPR
+ && TREE_CODE (rhs2) == SSA_NAME)
+ {
+ /* (T)(ptr + adj) - (T)ptr -> (T)adj. */
+ gimple def_stmt2 = SSA_NAME_DEF_STMT (rhs2);
+ if (TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME
+ && is_gimple_assign (def_stmt2)
+ && can_propagate_from (def_stmt2)
+ && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt2))
+ && TREE_CODE (gimple_assign_rhs1 (def_stmt2)) == SSA_NAME)
+ {
+ /* Now we have (T)A - (T)ptr. */
+ tree ptr = gimple_assign_rhs1 (def_stmt2);
+ def_stmt2 = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
+ if (is_gimple_assign (def_stmt2)
+ && gimple_assign_rhs_code (def_stmt2) == POINTER_PLUS_EXPR
+ && gimple_assign_rhs1 (def_stmt2) == ptr)
+ {
+ /* And finally (T)(ptr + X) - (T)ptr. */
+ tree adj = gimple_assign_rhs2 (def_stmt2);
+ /* If the conversion of the pointer adjustment to the
+ final type requires a sign- or zero-extension we
+ have to punt - it is not defined which one is
+ correct. */
+ if (TYPE_PRECISION (TREE_TYPE (rhs1))
+ <= TYPE_PRECISION (TREE_TYPE (adj))
+ || (TREE_CODE (adj) == INTEGER_CST
+ && tree_int_cst_sign_bit (adj) == 0))
+ {
+ if (useless_type_conversion_p (TREE_TYPE (rhs1),
+ TREE_TYPE (adj)))
+ {
+ code = TREE_CODE (adj);
+ rhs1 = adj;
+ }
+ else
+ {
+ code = NOP_EXPR;
+ rhs1 = adj;
+ }
+ rhs2 = NULL_TREE;
+ gimple_assign_set_rhs_with_ops (gsi, code, rhs1,
+ NULL_TREE);
+ gcc_assert (gsi_stmt (*gsi) == stmt);
+ gimple_set_modified (stmt, true);
+ }
+ }
+ }
+ }
}
}
@@ -2742,9 +2792,7 @@ out:
{
fold_stmt_inplace (gsi);
update_stmt (stmt);
- if (maybe_clean_or_replace_eh_stmt (stmt, stmt)
- && gimple_purge_dead_eh_edges (gimple_bb (stmt)))
- return true;
+ return true;
}
return false;
@@ -2754,7 +2802,7 @@ out:
true if anything changed, false otherwise. */
static bool
-associate_pointerplus (gimple_stmt_iterator *gsi)
+associate_pointerplus_align (gimple_stmt_iterator *gsi)
{
gimple stmt = gsi_stmt (*gsi);
gimple def_stmt;
@@ -2802,6 +2850,103 @@ associate_pointerplus (gimple_stmt_iterator *gsi)
return true;
}
+/* Associate operands of a POINTER_PLUS_EXPR assignmen at *GSI. Returns
+ true if anything changed, false otherwise. */
+
+static bool
+associate_pointerplus_diff (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ gimple def_stmt;
+ tree ptr1, rhs;
+
+ /* Pattern match
+ tem1 = (long) ptr1;
+ tem2 = (long) ptr2;
+ tem3 = tem2 - tem1;
+ tem4 = (unsigned long) tem3;
+ tem5 = ptr1 + tem4;
+ and produce
+ tem5 = ptr2; */
+ ptr1 = gimple_assign_rhs1 (stmt);
+ rhs = gimple_assign_rhs2 (stmt);
+ if (TREE_CODE (rhs) != SSA_NAME)
+ return false;
+ gimple minus = SSA_NAME_DEF_STMT (rhs);
+ /* Conditionally look through a sign-changing conversion. */
+ if (is_gimple_assign (minus)
+ && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (minus))
+ && (TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (minus)))
+ == TYPE_PRECISION (TREE_TYPE (rhs)))
+ && TREE_CODE (gimple_assign_rhs1 (minus)) == SSA_NAME)
+ minus = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (minus));
+ if (!is_gimple_assign (minus))
+ return false;
+ if (gimple_assign_rhs_code (minus) != MINUS_EXPR)
+ return false;
+ rhs = gimple_assign_rhs2 (minus);
+ if (TREE_CODE (rhs) != SSA_NAME)
+ return false;
+ def_stmt = SSA_NAME_DEF_STMT (rhs);
+ if (!is_gimple_assign (def_stmt)
+ || ! CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))
+ || gimple_assign_rhs1 (def_stmt) != ptr1)
+ return false;
+ rhs = gimple_assign_rhs1 (minus);
+ if (TREE_CODE (rhs) != SSA_NAME)
+ return false;
+ def_stmt = SSA_NAME_DEF_STMT (rhs);
+ if (!is_gimple_assign (def_stmt)
+ || ! CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
+ return false;
+ rhs = gimple_assign_rhs1 (def_stmt);
+ if (! useless_type_conversion_p (TREE_TYPE (ptr1), TREE_TYPE (rhs)))
+ return false;
+
+ gimple_assign_set_rhs_with_ops (gsi, TREE_CODE (rhs), rhs, NULL_TREE);
+ update_stmt (stmt);
+
+ return true;
+}
+
+/* Associate operands of a POINTER_PLUS_EXPR assignmen at *GSI. Returns
+ true if anything changed, false otherwise. */
+
+static bool
+associate_pointerplus (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ gimple def_stmt;
+ tree ptr, off1, off2;
+
+ if (associate_pointerplus_align (gsi)
+ || associate_pointerplus_diff (gsi))
+ return true;
+
+ /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */
+ ptr = gimple_assign_rhs1 (stmt);
+ off1 = gimple_assign_rhs2 (stmt);
+ if (TREE_CODE (ptr) != SSA_NAME)
+ return false;
+ def_stmt = SSA_NAME_DEF_STMT (ptr);
+ if (!is_gimple_assign (def_stmt)
+ || gimple_assign_rhs_code (def_stmt) != POINTER_PLUS_EXPR)
+ return false;
+ ptr = gimple_assign_rhs1 (def_stmt);
+ off2 = gimple_assign_rhs2 (def_stmt);
+ if (!types_compatible_p (TREE_TYPE (off1), TREE_TYPE (off2)))
+ return false;
+
+ tree off = make_ssa_name (TREE_TYPE (off1), NULL);
+ gimple ostmt = gimple_build_assign_with_ops (PLUS_EXPR, off, off1, off2);
+ gsi_insert_before (gsi, ostmt, GSI_SAME_STMT);
+
+ gimple_assign_set_rhs_with_ops (gsi, POINTER_PLUS_EXPR, ptr, off);
+ update_stmt (stmt);
+
+ return true;
+}
+
/* Combine two conversions in a row for the second conversion at *GSI.
Returns 1 if there were any changes made, 2 if cfg-cleanup needs to
run. Else it returns 0. */
@@ -3375,6 +3520,53 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
return true;
}
+/* Simplify multiplications.
+ Return true if a transformation applied, otherwise return false. */
+
+static bool
+simplify_mult (gimple_stmt_iterator *gsi)
+{
+ gimple stmt = gsi_stmt (*gsi);
+ tree arg1 = gimple_assign_rhs1 (stmt);
+ tree arg2 = gimple_assign_rhs2 (stmt);
+
+ if (TREE_CODE (arg1) != SSA_NAME)
+ return false;
+
+ gimple def_stmt = SSA_NAME_DEF_STMT (arg1);
+ if (!is_gimple_assign (def_stmt))
+ return false;
+
+ /* Look through a sign-changing conversion. */
+ if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
+ {
+ if (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (def_stmt)))
+ != TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt)))
+ || TREE_CODE (gimple_assign_rhs1 (def_stmt)) != SSA_NAME)
+ return false;
+ def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
+ if (!is_gimple_assign (def_stmt))
+ return false;
+ }
+
+ if (gimple_assign_rhs_code (def_stmt) == EXACT_DIV_EXPR)
+ {
+ if (operand_equal_p (gimple_assign_rhs2 (def_stmt), arg2, 0))
+ {
+ tree res = gimple_assign_rhs1 (def_stmt);
+ if (useless_type_conversion_p (TREE_TYPE (arg1), TREE_TYPE (res)))
+ gimple_assign_set_rhs_with_ops (gsi, TREE_CODE (res), res,
+ NULL_TREE);
+ else
+ gimple_assign_set_rhs_with_ops (gsi, NOP_EXPR, res, NULL_TREE);
+ gcc_assert (gsi_stmt (*gsi) == stmt);
+ update_stmt (stmt);
+ return true;
+ }
+ }
+
+ return false;
+}
/* Main entry point for the forward propagation and statement combine
optimizer. */
@@ -3526,9 +3718,23 @@ ssa_forward_propagate_and_combine (void)
|| code == BIT_IOR_EXPR
|| code == BIT_XOR_EXPR)
changed = simplify_bitwise_binary (&gsi);
+ else if (code == MULT_EXPR)
+ {
+ changed = simplify_mult (&gsi);
+ if (changed
+ && maybe_clean_or_replace_eh_stmt (stmt, stmt)
+ && gimple_purge_dead_eh_edges (bb))
+ cfg_changed = true;
+ }
else if (code == PLUS_EXPR
|| code == MINUS_EXPR)
- changed = associate_plusminus (&gsi);
+ {
+ changed = associate_plusminus (&gsi);
+ if (changed
+ && maybe_clean_or_replace_eh_stmt (stmt, stmt)
+ && gimple_purge_dead_eh_edges (bb))
+ cfg_changed = true;
+ }
else if (code == POINTER_PLUS_EXPR)
changed = associate_pointerplus (&gsi);
else if (CONVERT_EXPR_CODE_P (code)
diff --git a/main/gcc/tree-vect-data-refs.c b/main/gcc/tree-vect-data-refs.c
index 0deac8177fd..c3e8f372b83 100644
--- a/main/gcc/tree-vect-data-refs.c
+++ b/main/gcc/tree-vect-data-refs.c
@@ -2484,19 +2484,21 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
return true;
/* Sort the array of datarefs to make building the interleaving chains
- linear. */
- qsort (datarefs.address (), datarefs.length (),
+ linear. Don't modify the original vector's order, it is needed for
+ determining what dependencies are reversed. */
+ vec datarefs_copy = datarefs.copy ();
+ qsort (datarefs_copy.address (), datarefs_copy.length (),
sizeof (data_reference_p), dr_group_sort_cmp);
/* Build the interleaving chains. */
- for (i = 0; i < datarefs.length () - 1;)
+ for (i = 0; i < datarefs_copy.length () - 1;)
{
- data_reference_p dra = datarefs[i];
+ data_reference_p dra = datarefs_copy[i];
stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra));
stmt_vec_info lastinfo = NULL;
- for (i = i + 1; i < datarefs.length (); ++i)
+ for (i = i + 1; i < datarefs_copy.length (); ++i)
{
- data_reference_p drb = datarefs[i];
+ data_reference_p drb = datarefs_copy[i];
stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
/* ??? Imperfect sorting (non-compatible types, non-modulo
@@ -2573,7 +2575,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
}
}
- FOR_EACH_VEC_ELT (datarefs, i, dr)
+ FOR_EACH_VEC_ELT (datarefs_copy, i, dr)
if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr)))
&& !vect_analyze_data_ref_access (dr))
{
@@ -2588,9 +2590,13 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
continue;
}
else
- return false;
+ {
+ datarefs_copy.release ();
+ return false;
+ }
}
+ datarefs_copy.release ();
return true;
}
diff --git a/main/gcc/tree.c b/main/gcc/tree.c
index f5e28e9eff7..d83c8c7421c 100644
--- a/main/gcc/tree.c
+++ b/main/gcc/tree.c
@@ -9978,12 +9978,6 @@ build_common_builtin_nodes (void)
BUILT_IN_SETJMP_SETUP,
"__builtin_setjmp_setup", ECF_NOTHROW);
- ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
- local_define_builtin ("__builtin_setjmp_dispatcher", ftype,
- BUILT_IN_SETJMP_DISPATCHER,
- "__builtin_setjmp_dispatcher",
- ECF_PURE | ECF_NOTHROW);
-
ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
local_define_builtin ("__builtin_setjmp_receiver", ftype,
BUILT_IN_SETJMP_RECEIVER,
diff --git a/main/libgcc/ChangeLog b/main/libgcc/ChangeLog
index 845c8f4faac..fe0f74d9ef8 100644
--- a/main/libgcc/ChangeLog
+++ b/main/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-29 Marcus Shawcroft
+
+ * config/aarch64/sfp-machine.h (_FP_I_TYPE): Define
+ as long long.
+
2014-01-25 Walter Lee
* config/tilepro/atomic.c: Include tconfig.h. Don't include
diff --git a/main/libgcc/config/aarch64/sfp-machine.h b/main/libgcc/config/aarch64/sfp-machine.h
index 61b5f720274..ddb67fb1c2b 100644
--- a/main/libgcc/config/aarch64/sfp-machine.h
+++ b/main/libgcc/config/aarch64/sfp-machine.h
@@ -26,7 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define _FP_W_TYPE_SIZE 64
#define _FP_W_TYPE unsigned long long
#define _FP_WS_TYPE signed long long
-#define _FP_I_TYPE int
+#define _FP_I_TYPE long long
typedef int TItype __attribute__ ((mode (TI)));
typedef unsigned int UTItype __attribute__ ((mode (TI)));
diff --git a/main/libiberty/ChangeLog b/main/libiberty/ChangeLog
index 083ec79cf97..0a4496bb8ca 100644
--- a/main/libiberty/ChangeLog
+++ b/main/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-28 Thomas Schwinge
+
+ * cp-demangle.c (d_demangle_callback): Put an abort call in place,
+ to help the compiler.
+
2014-01-21 Tom Tromey
* _doprint.c (checkit): Use stdarg, not VA_* macros.
diff --git a/main/libiberty/cp-demangle.c b/main/libiberty/cp-demangle.c
index bf2ffa95a8d..3d5d33ef591 100644
--- a/main/libiberty/cp-demangle.c
+++ b/main/libiberty/cp-demangle.c
@@ -1,5 +1,5 @@
/* Demangler for g++ V3 ABI.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014
Free Software Foundation, Inc.
Written by Ian Lance Taylor .
@@ -5824,6 +5824,8 @@ d_demangle_callback (const char *mangled, int options,
NULL);
d_advance (&di, strlen (d_str (&di)));
break;
+ default:
+ abort (); /* We have listed all the cases. */
}
/* If DMGL_PARAMS is set, then if we didn't consume the entire
diff --git a/main/libstdc++-v3/ChangeLog b/main/libstdc++-v3/ChangeLog
index da708305497..8c6dea89f24 100644
--- a/main/libstdc++-v3/ChangeLog
+++ b/main/libstdc++-v3/ChangeLog
@@ -1,3 +1,69 @@
+2014-01-29 Jonathan Wakely
+
+ * include/bits/alloc_traits.h (allocator_traits::_S_allocate): Do
+ not use varargs when argument could be non-POD.
+ (__alloctr_rebind_helper): Eliminate static const bool member by
+ using true_type and false_type.
+ (allocator_traits::__allocate_helper): Likewise.
+ (allocator_traits::__construct_helper): Likewise.
+ (allocator_traits::__destroy_helper): Likewise.
+ (allocator_traits::__maxsize_helper): Likewise.
+ (allocator_traits::__select_helper): Likewise.
+ * include/bits/ptr_traits.h (__ptrtr_rebind_helper): Likewise.
+ * include/bits/stl_tree.h (_Rb_tree::operator=(const _Rb_tree&)):
+ Remove redundant condition.
+ * include/bits/stl_vector.h (vector::operator=(const vector&)):
+ Likewise.
+ (_Vector_impl::_M_allocate, _Vector_impl::_M_deallocate): Use
+ indirection through __alloc_traits.
+ * include/ext/alloc_traits.h (__allocator_always_compares_equal):
+ Eliminate static const bool members by using true_type and false_type.
+ (__gnu_cxx::__alloc_traits::__is_custom_pointer): Optimize.
+ * testsuite/util/testsuite_allocator.h (PointerBase): Define.
+ * testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc:
+ New.
+ * testsuite/20_util/allocator_traits/requirements/typedefs2.cc: New.
+
+ PR libstdc++/59829
+ * include/bits/stl_vector.h (vector::data()): Call _M_data_ptr.
+ (vector::_M_data_ptr): New overloaded functions to ensure empty
+ vectors do not dereference the pointer.
+ * testsuite/23_containers/vector/59829.cc: New.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+ Adjust dg-error line number.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Likewise.
+
+ PR libstdc++/21609
+ * include/ext/array_allocator.h: Add deprecated attribute.
+
+ PR libstdc++/57226
+ * doc/xml/manual/debug.xml (debug.gdb): Update documentation for
+ installation and use of python printers.
+ * doc/xml/manual/status_cxx2011.xml: Update.
+ * doc/html/*: Regenerate.
+
+2014-01-28 Jonathan Wakely
+ Kyle Lippincott
+
+ PR libstdc++/59656
+ * include/bits/shared_ptr.h (shared_ptr): Add new non-throwing
+ constructor and grant friendship to weak_ptr.
+ (weak_ptr::lock()): Use new constructor.
+ * include/bits/shared_ptr_base.h
+ (_Sp_counted_base::_M_add_ref_lock_nothrow()): Declare new function
+ and define specializations.
+ (__shared_count): Add new non-throwing constructor.
+ (__shared_ptr): Add new non-throwing constructor and grant friendship
+ to __weak_ptr.
+ (__weak_ptr::lock()): Use new constructor.
+ * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust dg-error.
+ * testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
+
2014-01-27 Jonathan Wakely
PR libstdc++/59215
diff --git a/main/libstdc++-v3/doc/html/api.html b/main/libstdc++-v3/doc/html/api.html
index e1b6e44760d..28d0061970c 100644
--- a/main/libstdc++-v3/doc/html/api.html
+++ b/main/libstdc++-v3/doc/html/api.html
@@ -6,7 +6,7 @@
FSF
-
The neatest accomplishment of the algorithms section is that all the
work is done via iterators, not containers directly. This means two
diff --git a/main/libstdc++-v3/doc/html/manual/api.html b/main/libstdc++-v3/doc/html/manual/api.html
index af6af248972..ceca6391f70 100644
--- a/main/libstdc++-v3/doc/html/manual/api.html
+++ b/main/libstdc++-v3/doc/html/manual/api.html
@@ -77,11 +77,11 @@ _Alloc_traits have been removed.
__alloc to select an underlying allocator that
satisfied memory allocation requests. The selection of this
underlying allocator was not user-configurable.
-
Table B.6. Extension Allocators
Allocator (3.4)
Header (3.4)
Allocator (3.[0-3])
Header (3.[0-3])
__gnu_cxx::new_allocator<T>
ext/new_allocator.h
std::__new_alloc
memory
__gnu_cxx::malloc_allocator<T>
ext/malloc_allocator.h
std::__malloc_alloc_template<int>
memory
__gnu_cxx::debug_allocator<T>
ext/debug_allocator.h
std::debug_alloc<T>
memory
__gnu_cxx::__pool_alloc<T>
ext/pool_allocator.h
std::__default_alloc_template<bool,int>
memory
__gnu_cxx::__mt_alloc<T>
ext/mt_allocator.h
__gnu_cxx::bitmap_allocator<T>
ext/bitmap_allocator.h
Releases after gcc-3.4 have continued to add to the collection
+
Table B.6. Extension Allocators
Allocator (3.4)
Header (3.4)
Allocator (3.[0-3])
Header (3.[0-3])
__gnu_cxx::new_allocator<T>
ext/new_allocator.h
std::__new_alloc
memory
__gnu_cxx::malloc_allocator<T>
ext/malloc_allocator.h
std::__malloc_alloc_template<int>
memory
__gnu_cxx::debug_allocator<T>
ext/debug_allocator.h
std::debug_alloc<T>
memory
__gnu_cxx::__pool_alloc<T>
ext/pool_allocator.h
std::__default_alloc_template<bool,int>
memory
__gnu_cxx::__mt_alloc<T>
ext/mt_allocator.h
__gnu_cxx::bitmap_allocator<T>
ext/bitmap_allocator.h
Releases after gcc-3.4 have continued to add to the collection
of available allocators. All of these new allocators are
standard-style. The following table includes details, along with
the first released version of GCC that included the extension allocator.
-
The GNU C++ Library is part of GCC and follows the same development model,
so the general rules for
diff --git a/main/libstdc++-v3/doc/html/manual/appendix_free.html b/main/libstdc++-v3/doc/html/manual/appendix_free.html
index 0976a43d507..27df3aa2ba2 100644
--- a/main/libstdc++-v3/doc/html/manual/appendix_free.html
+++ b/main/libstdc++-v3/doc/html/manual/appendix_free.html
@@ -6,7 +6,7 @@
Appendices
The biggest deficiency in free operating systems is not in the
software--it is the lack of good free manuals that we can include in
diff --git a/main/libstdc++-v3/doc/html/manual/appendix_gpl.html b/main/libstdc++-v3/doc/html/manual/appendix_gpl.html
index 58e45adfcfa..257a2fc4762 100644
--- a/main/libstdc++-v3/doc/html/manual/appendix_gpl.html
+++ b/main/libstdc++-v3/doc/html/manual/appendix_gpl.html
@@ -77,7 +77,7 @@
The precise terms and conditions for copying, distribution and modification
follow.
-
+
TERMS AND CONDITIONS
0. Definitions.
@@ -618,7 +618,7 @@
waiver of all civil liability in connection with the Program, unless a
warranty or assumption of liability accompanies a copy of the Program in
return for a fee.
-
+
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
diff --git a/main/libstdc++-v3/doc/html/manual/appendix_porting.html b/main/libstdc++-v3/doc/html/manual/appendix_porting.html
index 44f6bfdf798..0e9c781eec1 100644
--- a/main/libstdc++-v3/doc/html/manual/appendix_porting.html
+++ b/main/libstdc++-v3/doc/html/manual/appendix_porting.html
@@ -6,7 +6,7 @@
Appendices
Regenerate all generated files by using the command
autoreconf at the top level of the libstdc++ source
directory.
@@ -90,13 +90,13 @@ in the build directory starts the build process. The all
Coding and Commenting Conventions
Most comments should use {octothorpes, shibboleths, hash marks,
pound signs, whatever} rather than "dnl". Nearly all comments in
- configure.ac should. Comments inside macros written in ancilliary
+ configure.ac should. Comments inside macros written in ancillary
.m4 files should. About the only comments which should
not use #, but use dnl instead, are comments
- outside our own macros in the ancilliary
+ outside our own macros in the ancillary
files. The difference is that # comments show up in
configure (which is most helpful for debugging),
- while dnl'd lines just vanish. Since the macros in ancilliary
+ while dnl'd lines just vanish. Since the macros in ancillary
files generate code which appears in odd places, their "outside"
comments tend to not be useful while reading
configure.
@@ -280,7 +280,7 @@ in the build directory starts the build process. The all
make src
Generates two convenience libraries, one for C++98 and one for
- C++11, various compability files for shared and static
+ C++11, various compatibility files for shared and static
libraries, and then collects all the generated bits and creates
the final libstdc++ libraries.
diff --git a/main/libstdc++-v3/doc/html/manual/atomics.html b/main/libstdc++-v3/doc/html/manual/atomics.html
index 7e0a7439cf5..4ac12fe5665 100644
--- a/main/libstdc++-v3/doc/html/manual/atomics.html
+++ b/main/libstdc++-v3/doc/html/manual/atomics.html
@@ -6,7 +6,7 @@
Standard Contents
diff --git a/main/libstdc++-v3/doc/html/manual/backwards.html b/main/libstdc++-v3/doc/html/manual/backwards.html
index 44faea91e8f..7373c34ece6 100644
--- a/main/libstdc++-v3/doc/html/manual/backwards.html
+++ b/main/libstdc++-v3/doc/html/manual/backwards.html
@@ -512,16 +512,23 @@ AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
fi
])
No ios::nocreate/ios::noreplace.
-
The existence of ios::nocreate being used for
-input-streams has been confirmed, most probably because the author
-thought it would be more correct to specify nocreate explicitly. So
-it can be left out for input-streams.
-
For output streams, “nocreate” is probably the default,
-unless you specify std::ios::trunc ? To be safe, you can
-open the file for reading, check if it has been opened, and then
-decide whether you want to create/replace or not. To my knowledge,
-even older implementations support app, ate
-and trunc (except for app ?).
+
Historically these flags were used with iostreams to control whether
+new files are created or not when opening a file stream, similar to the
+O_CREAT and O_EXCL flags for the
+open(2) system call. Because iostream modes correspond
+to fopen(3) modes these flags are not supported.
+For input streams a new file will not be created anyway, so
+ios::nocreate is not needed.
+For output streams, a new file will be created if it does not exist, which is
+consistent with the behaviour of fopen.
+
When one of these flags is needed a possible alternative is to attempt
+to open the file using std::ifstream first to determine whether
+the file already exists or not. This may not be reliable however, because
+whether the file exists or not could change between opening the
+std::istream and re-opening with an output stream. If you need
+to check for existence and open a file as a single operation then you will
+need to use OS-specific facilities outside the C++ standard library, such
+as open(2).
No stream::attach(int fd)
@@ -940,15 +947,15 @@ AC_DEFUN([AC_HEADER_UNORDERED_SET], [
This is a change in behavior from older versions. Now, most
iterator_type typedefs in container classes are POD
objects, not value_type pointers.
-
Consider a block of size 64 ints. In memory, it would look like this:
(assume a 32-bit system where, size_t is a 32-bit entity).
-
Table 21.1. Bitmap Allocator Memory Map
268
0
4294967295
4294967295
Data -> Space for 64 ints
+
Table 21.1. Bitmap Allocator Memory Map
268
0
4294967295
4294967295
Data -> Space for 64 ints
The first Column(268) represents the size of the Block in bytes as
seen by the Bitmap Allocator. Internally, a global free list is
used to keep track of the free blocks used and given back by the
diff --git a/main/libstdc++-v3/doc/html/manual/bugs.html b/main/libstdc++-v3/doc/html/manual/bugs.html
index e9301d99bf3..86831e8e124 100644
--- a/main/libstdc++-v3/doc/html/manual/bugs.html
+++ b/main/libstdc++-v3/doc/html/manual/bugs.html
@@ -338,9 +338,6 @@
809:
std::swap should be overloaded for array types
Facilities for concurrent operation, and control thereof.
API Reference
diff --git a/main/libstdc++-v3/doc/html/manual/configure.html b/main/libstdc++-v3/doc/html/manual/configure.html
index 5526dee44f2..eb8b26e36da 100644
--- a/main/libstdc++-v3/doc/html/manual/configure.html
+++ b/main/libstdc++-v3/doc/html/manual/configure.html
@@ -224,7 +224,14 @@
to standard error for certain events such as calling a pure virtual
function or the invocation of the standard terminate handler. Those
messages cause the library to depend on the demangler and standard I/O
- facilites, which might be undesirable in a low-memory environment or
+ facilities, which might be undesirable in a low-memory environment or
when standard error is not available. This option disables those
messages. This option does not change the library ABI.
-
\ No newline at end of file
+
--enable-vtable-verify[default]
Use -fvtable-verify=std to compile the C++
+ runtime with instrumentation for vtable verification. All virtual
+ functions in the standard library will be verified at runtime.
+ Types impacted include locale and
+ iostream, and others. Disabling means that
+ the C++ runtime is compiled without support for vtable
+ verification. By default, this option is off.
+
\ No newline at end of file
diff --git a/main/libstdc++-v3/doc/html/manual/containers.html b/main/libstdc++-v3/doc/html/manual/containers.html
index a1d35f069c2..45828513a55 100644
--- a/main/libstdc++-v3/doc/html/manual/containers.html
+++ b/main/libstdc++-v3/doc/html/manual/containers.html
@@ -6,8 +6,8 @@
Standard Contents
Yes it is, and that's okay. This is a decision that we preserved
when we imported SGI's STL implementation. The following is
quoted from their FAQ:
diff --git a/main/libstdc++-v3/doc/html/manual/debug.html b/main/libstdc++-v3/doc/html/manual/debug.html
index 458a1379e7d..6e4fea8094a 100644
--- a/main/libstdc++-v3/doc/html/manual/debug.html
+++ b/main/libstdc++-v3/doc/html/manual/debug.html
@@ -178,8 +178,8 @@
recommended: the other parts of this manual.
These settings can either be switched on in at the GDB command line,
- or put into a .gdbint file to establish default debugging
- characteristics, like so:
+ or put into a .gdbinit file to establish default
+ debugging characteristics, like so:
set print pretty on
set print object on
@@ -189,32 +189,22 @@
set demangle-style gnu-v3
Starting with version 7.0, GDB includes support for writing
- pretty-printers in Python. Pretty printers for STL classes are
- distributed with GCC from version 4.5.0. The most recent version of
- these printers are always found in libstdc++ svn repository.
- To enable these printers, check-out the latest printers to a local
- directory:
-
- svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
-
- Next, add the following section to your ~/.gdbinit The path must
- match the location where the Python module above was checked-out.
- So if checked out to: /home/maude/gdb_printers/, the path would be as
- written in the example below.
-
- python
- import sys
- sys.path.insert(0, '/home/maude/gdb_printers/python')
- from libstdcxx.v6.printers import register_libstdcxx_printers
- register_libstdcxx_printers (None)
- end
-
- The path should be the only element that needs to be adjusted in the
- example. Once loaded, STL classes that the printers support
+ pretty-printers in Python. Pretty printers for containers and other
+ classes are distributed with GCC from version 4.5.0 and should be installed
+ alongside the libstdc++ shared library files and found automatically by
+ GDB.
+
+ Depending where libstdc++ is installed, GDB might refuse to auto-load
+ the python printers and print a warning instead.
+ If this happens the python printers can be enabled by following the
+ instructions GDB gives for setting your auto-load safe-path
+ in your .gdbinit configuration file.
+
+ Once loaded, standard library classes that the printers support
should print in a more human-readable format. To print the classes
- in the old style, use the /r (raw) switch in the print command
- (i.e., print /r foo). This will print the classes as if the Python
- pretty-printers were not loaded.
+ in the old style, use the /r (raw) switch in the
+ print command (i.e., print /r foo). This will
+ print the classes as if the Python pretty-printers were not loaded.
The verbose
termination handler gives information about uncaught
- exceptions which are killing the program. It is described in the
- linked-to page.
+ exceptions which kill the program.
Debug Mode
The Debug Mode
has compile and run-time checks for many containers.
Compile Time Checking
The Compile-Time
- Checks Extension has compile-time checks for many algorithms.
+ Checks extension has compile-time checks for many algorithms.
Profile-based Performance Analysis
The Profile-based
- Performance Analysis Extension has performance checks for many
+ Performance Analysis extension has performance checks for many
algorithms.
All exception objects are defined in one of the standard header
files: exception,
diff --git a/main/libstdc++-v3/doc/html/manual/documentation_hacking.html b/main/libstdc++-v3/doc/html/manual/documentation_hacking.html
index 24aac36a534..68d03cafc71 100644
--- a/main/libstdc++-v3/doc/html/manual/documentation_hacking.html
+++ b/main/libstdc++-v3/doc/html/manual/documentation_hacking.html
@@ -112,7 +112,7 @@
supported, and are always aliased to dummy rules. These
unsupported formats are: info,
ps, and dvi.
-
Editing the DocBook sources requires an XML editor. Many
exist: some notable options
include emacs, Kate,
@@ -519,11 +519,11 @@ make XSL_STYLE_DIR="/usr/share/xml/docbook/stylesheet/nwal
online.
An incomplete reference for HTML to Docbook conversion is
detailed in the table below.
-
And examples of detailed markup for which there are no real HTML
equivalents are listed in the table below.
-
Table B.5. Docbook XML Element Use
Element
Use
<structname>
<structname>char_traits</structname>
<classname>
<classname>string</classname>
<function>
+
Table B.5. Docbook XML Element Use
Element
Use
<structname>
<structname>char_traits</structname>
<classname>
<classname>string</classname>
<function>
<function>clear()</function>
<function>fs.clear()</function>
<type>
<type>long long</type>
<varname>
<varname>fs</varname>
<literal>
diff --git a/main/libstdc++-v3/doc/html/manual/ext_compile_checks.html b/main/libstdc++-v3/doc/html/manual/ext_compile_checks.html
index 3850c52ec54..da4723311e2 100644
--- a/main/libstdc++-v3/doc/html/manual/ext_compile_checks.html
+++ b/main/libstdc++-v3/doc/html/manual/ext_compile_checks.html
@@ -32,8 +32,9 @@
#define _GLIBCXX_CONCEPT_CHECKS for GCC 3.4 and higher
(or with #define _GLIBCPP_CONCEPT_CHECKS for versions
3.1, 3.2 and 3.3).
-
Please note that the upcoming C++ standard has first-class
+
Please note that the concept checks only validate the requirements
+ of the old C++03 standard. C++11 was expected to have first-class
support for template parameter constraints based on concepts in the core
- language. This will obviate the need for the library-simulated concept
- checking described above.
+ language. This would have obviated the need for the library-simulated concept
+ checking described above, but was not part of C++11.