summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2006-02-15 10:31:54 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2006-02-15 10:31:54 +0100
commit6f301919dc530893fa43e994531ff347f955000a (patch)
tree14eb42b222454b2b7f3b3060688e866bdb0b0127 /gcc/ada
parent5b47742c2d278f8f8a4b1e02c6e1f786340da38f (diff)
downloadgcc-6f301919dc530893fa43e994531ff347f955000a.tar.gz
2006-02-13 Arnaud Charlet <charlet@adacore.com>
Robert Dewar <dewar@adacore.com> * a-exexpr.adb, a-exexpr-gcc.adb (Process_Raise_Exception): Removed, merged with Propagate_Exception. (Propagate_Exception): Now take extra From_Signal_Handler parameter. Remove code unused for exception propagation for the compiler itself from a-except.adb and update to still share separate packages. * a-except.ads, a-except.adb: Ditto. Add comments that this version is now used only by the compiler and other basic tools. The full version that includes the Ada 2005 stuff is in separate files a-except-2005.ads/adb. The reason is that we do not want to cause bootstrap problems with compilers not recognizing Wide_Wide_String. Add exception reason code PE_Implicit_Return Add new exception reason code (Null Exception_Id) * a-except-2005.adb, a-except-2005.ads: New files. * s-wchcon.ads: (Get_WC_Encoding_Method): New function. * s-wchcon.adb: New file. * Makefile.in (LIBGNAT_SRCS): Add tb-gcc.c. (traceback.o deps): Likewise. (SPARC/Solaris): Accept sparc[64|v9]-sun-solaris. Activate build of GMEM instrumentation library on VMS targets. (gnatlib-sjlj, gnatlib-zcx): Pass EH_MECHANISM to make gnatlib. Use a-except-2005.ads/adb for all run-time library builds unless specified otherwise. [VMS] (LIBGNAT_TARGET_PAIRS_AUX1,2): Rename s-parame-vms.ads to s-parame-vms-alpha.ads and add s-parame-vms-ia64.ads. Use s-parame.adb on all native platforms. Use s-parame-vxworks.adb on all vxworks platforms. Add env.c env.h in LIBGNAT_SRCS Add env.o in LIBGNAT_OBJS (GNATMAKE_OBJS): Remove ctrl_c.o object. (LIBGNAT_TARGET_PAIRS for x86-vxworks): Use an specialized version of s-osinte.adb, s-tpopsp.adb, and system.ads for the run time that supports VxWorks 6 RTPs. (EXTRA_GNATRTL_NONTASKING_OBJS for x86-vxworks): Remove the use of i-vxworks and i-vxwoio from the run time that supports VxWorks 6 RTPs. * types.h, types.ads (Terminate_Program): New exception Add comment on modifying multiple versions of a-except.adb when the table of exception reasons is modified. Add exception reason code PE_Implicit_Return Add new exception reason code (Null Exception_Id) * clean.adb (Initialize): Get the target parameters before checking if target is OpenVMS. Move the OpenVMS specific code here from package body elaboration code. From-SVN: r111031
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/Makefile.in221
-rw-r--r--gcc/ada/a-except-2005.adb1355
-rw-r--r--gcc/ada/a-except-2005.ads335
-rw-r--r--gcc/ada/a-except.adb262
-rw-r--r--gcc/ada/a-except.ads9
-rw-r--r--gcc/ada/a-exexpr-gcc.adb8
-rw-r--r--gcc/ada/a-exexpr.adb9
-rw-r--r--gcc/ada/clean.adb34
-rwxr-xr-xgcc/ada/s-wchcon.adb51
-rw-r--r--gcc/ada/s-wchcon.ads4
-rw-r--r--gcc/ada/types.ads87
-rw-r--r--gcc/ada/types.h54
12 files changed, 2103 insertions, 326 deletions
diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in
index a6df24da84f..c53832b206c 100644
--- a/gcc/ada/Makefile.in
+++ b/gcc/ada/Makefile.in
@@ -302,7 +302,7 @@ GNATLINK_OBJS = gnatlink.o \
sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
types.o validsw.o widechar.o
-GNATMAKE_OBJS = a-except.o ctrl_c.o ali.o ali-util.o s-casuti.o \
+GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \
alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\
erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
@@ -399,6 +399,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
@@ -435,6 +436,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
@@ -473,6 +475,57 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
endif
+# vxworksae / vxworks 653
+ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
+ # target pairs for kernel + vthreads runtime
+ LIBGNAT_TARGET_PAIRS = \
+ a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
+ a-intnam.ads<a-intnam-vxworks.ads \
+ a-numaux.ads<a-numaux-vxworks.ads \
+ a-sytaco.ads<1asytaco.ads \
+ a-sytaco.adb<1asytaco.adb \
+ g-io.adb<g-io-vxworks-ppc-cert.adb \
+ g-io.ads<g-io-vxworks-ppc-cert.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-interr.adb<s-interr-vxworks.adb \
+ s-intman.ads<s-intman-vxworks.ads \
+ s-intman.adb<s-intman-vxworks.adb \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-osinte.ads<s-osinte-vxworks.ads \
+ s-osprim.adb<s-osprim-vxworks.adb \
+ s-parame.ads<s-parame-ae653.ads \
+ s-parame.adb<s-parame-vxworks.adb \
+ s-taprop.adb<s-taprop-vxworks.adb \
+ s-taspri.ads<s-taspri-vxworks.ads \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ s-vxwork.ads<s-vxwork-ppc.ads \
+ g-soccon.ads<g-soccon-vxworks.ads \
+ g-socthi.ads<g-socthi-vxworks.ads \
+ g-socthi.adb<g-socthi-vxworks.adb \
+ system.ads<system-vxworks-ppc-vthread.ads
+
+ TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-vxworks.adb
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
+
+ # Extra pairs for the vthreads runtime
+ ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-thread.adb<s-thread-ae653.adb
+ EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
+ endif
+
+ ifeq ($(strip $(filter-out yes,$(TRACE))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-traces.adb<s-traces-default.adb \
+ s-trafor.adb<s-trafor-default.adb \
+ s-trafor.ads<s-trafor-default.ads \
+ s-tratas.adb<s-tratas-default.adb \
+ s-tfsetr.adb<s-tfsetr-vxworks.adb
+ endif
+endif
+
ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
@@ -485,6 +538,7 @@ ifeq ($(strip $(filter-out sparc% wrs vx%,$(targ))),)
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
@@ -511,19 +565,17 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
s-intman.adb<s-intman-vxworks.adb \
a-numaux.adb<a-numaux-x86.adb \
a-numaux.ads<a-numaux-x86.ads \
- s-osinte.adb<s-osinte-vxworks.adb \
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
s-vxwork.ads<s-vxwork-x86.ads \
g-soccon.ads<g-soccon-vxworks.ads \
g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- system.ads<system-vxworks-x86.ads
+ g-socthi.adb<g-socthi-vxworks.adb
TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-vxworks.adb
@@ -536,7 +588,22 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
s-tfsetr.adb<s-tfsetr-vxworks.adb
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks-rtp.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
+ system.ads<system-vxworks-x86-rtp.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ system.ads<system-vxworks-x86.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ endif
+
EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
endif
@@ -552,6 +619,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
@@ -580,6 +648,7 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
+ s-parame.adb<s-parame-vxworks.adb \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
@@ -596,65 +665,14 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
endif
-# vxworksae / vxworks 653
-ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(targ))),)
- # target pairs for kernel + vthreads runtime
- LIBGNAT_TARGET_PAIRS = \
- a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- a-sytaco.ads<1asytaco.ads \
- a-sytaco.adb<1asytaco.adb \
- g-io.adb<g-io-vxworks-ppc-cert.adb \
- g-io.ads<g-io-vxworks-ppc-cert.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-ae653.ads \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-vxwork.ads<s-vxwork-ppc.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- system.ads<system-vxworks-ppc-vthread.ads
-
- TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-vxworks.adb
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-
- # Extra pairs for the vthreads runtime
- ifeq ($(strip $(filter-out vthreads,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS += \
- s-thread.adb<s-thread-ae653.adb
- EXTRA_GNATRTL_NONTASKING_OBJS += s-thread.o
- endif
-
- ifeq ($(strip $(filter-out yes,$(TRACE))),)
- LIBGNAT_TARGET_PAIRS += \
- s-traces.adb<s-traces-default.adb \
- s-trafor.adb<s-trafor-default.adb \
- s-trafor.ads<s-trafor-default.ads \
- s-tratas.adb<s-tratas-default.adb \
- s-tfsetr.adb<s-tfsetr-vxworks.adb
- endif
-endif
-
-ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
+ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS_32 = \
a-intnam.ads<a-intnam-solaris.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-solaris.adb \
s-osinte.adb<s-osinte-solaris.adb \
s-osinte.ads<s-osinte-solaris.ads \
s-osprim.adb<s-osprim-solaris.adb \
- s-parame.adb<s-parame-solaris.adb \
s-taprop.adb<s-taprop-solaris.adb \
s-tasinf.adb<s-tasinf-solaris.adb \
s-tasinf.ads<s-tasinf-solaris.ads \
@@ -664,6 +682,28 @@ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
g-soliop.ads<g-soliop-solaris.ads \
system.ads<system-solaris-sparc.ads
+ LIBGNAT_TARGET_PAIRS_64 = \
+ a-intnam.ads<a-intnam-solaris.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-solaris.adb \
+ s-osinte.adb<s-osinte-solaris.adb \
+ s-osinte.ads<s-osinte-solaris.ads \
+ s-osprim.adb<s-osprim-solaris.adb \
+ s-taprop.adb<s-taprop-solaris.adb \
+ s-tasinf.adb<s-tasinf-solaris.adb \
+ s-tasinf.ads<s-tasinf-solaris.ads \
+ s-taspri.ads<s-taspri-solaris.ads \
+ s-tpopsp.adb<s-tpopsp-solaris.adb \
+ g-soccon.ads<g-soccon-solaris-64.ads \
+ g-soliop.ads<g-soliop-solaris.ads \
+ system.ads<system-solaris-sparcv9.ads
+
+ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_32)
+ else
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
+ endif
+
TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-solaris.adb
EH_MECHANISM=-gcc
@@ -694,22 +734,7 @@ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
endif
ifeq ($(strip $(filter-out m64,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-solaris.adb \
- s-osinte.adb<s-osinte-solaris.adb \
- s-osinte.ads<s-osinte-solaris.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-parame.adb<s-parame-solaris.adb \
- s-taprop.adb<s-taprop-solaris.adb \
- s-tasinf.adb<s-tasinf-solaris.adb \
- s-tasinf.ads<s-tasinf-solaris.ads \
- s-taspri.ads<s-taspri-solaris.ads \
- s-tpopsp.adb<s-tpopsp-solaris.adb \
- g-soccon.ads<g-soccon-solaris-64.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-sparcv9.ads
+ LIBGNAT_TARGET_PAIRS = $(LIBGNAT_TARGET_PAIRS_64)
endif
endif
@@ -723,7 +748,6 @@ ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
s-osinte.adb<s-osinte-solaris.adb \
s-osinte.ads<s-osinte-solaris.ads \
s-osprim.adb<s-osprim-solaris.adb \
- s-parame.adb<s-parame-solaris.adb \
s-taprop.adb<s-taprop-solaris.adb \
s-tasinf.adb<s-tasinf-solaris.adb \
s-tasinf.ads<s-tasinf-solaris.ads \
@@ -758,7 +782,6 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-x86.ads
TOOLS_TARGET_PAIRS = \
@@ -811,7 +834,6 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-s390x.ads
else
LIBGNAT_TARGET_PAIRS = \
@@ -824,7 +846,6 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-s390.ads
endif
@@ -1055,6 +1076,9 @@ ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
s-osinte.ads<s-osinte-vms-ia64.ads \
s-vaflop.adb<s-vaflop-vms-ia64.adb \
system.ads<system-vms_64.ads
+
+ LIBGNAT_TARGET_PAIRS_AUX2 = \
+ s-parame.ads<s-parame-vms-ia64.ads
else
ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
LIBGNAT_TARGET_PAIRS_AUX1 = \
@@ -1067,14 +1091,15 @@ ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
s-osinte.ads<s-osinte-vms.ads \
s-vaflop.adb<s-vaflop-vms-alpha.adb \
system.ads<system-vms_64.ads
-endif
-endif
+
ifeq ($(strip $(filter-out express EXPRESS,$(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS_AUX2 = \
s-parame.ads<s-parame-vms-restrict.ads
else
LIBGNAT_TARGET_PAIRS_AUX2 = \
- s-parame.ads<s-parame-vms.ads
+ s-parame.ads<s-parame-vms-alpha.ads
+endif
+endif
endif
LIBGNAT_TARGET_PAIRS = \
@@ -1118,6 +1143,8 @@ else
symbols-processing.adb<symbols-processing-vms-alpha.adb
endif
+
+ GMEM_LIB = gmemlib
EH_MECHANISM=-gcc
GNATLIB_SHARED=gnatlib-shared-vms
ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
@@ -1153,7 +1180,6 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
s-osprim.adb<s-osprim-mingw.adb \
s-taprop.adb<s-taprop-mingw.adb \
s-taspri.ads<s-taspri-mingw.ads \
- s-parame.adb<s-parame-mingw.adb \
g-socthi.ads<g-socthi-mingw.ads \
g-socthi.adb<g-socthi-mingw.adb \
g-soccon.ads<g-soccon-mingw.ads \
@@ -1189,7 +1215,6 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-ppc.ads
TOOLS_TARGET_PAIRS = \
@@ -1215,7 +1240,6 @@ ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-sparc.ads
TOOLS_TARGET_PAIRS = \
@@ -1241,7 +1265,6 @@ ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
s-taprop.adb<s-taprop-linux.adb \
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- s-parame.adb<s-parame-linux.adb \
system.ads<system-linux-hppa.ads
TOOLS_TARGET_PAIRS = \
@@ -1372,6 +1395,18 @@ ifneq ($(EH_MECHANISM),)
EXTRA_LIBGNAT_OBJS+=raise$(EH_MECHANISM).o
endif
+# Use the Ada 2005 version of Ada.Exceptions by default, unless specified
+# explicitely already. The base files (a-except.ad?) are used only for building
+# the compiler and other basic tools.
+# These base versions lack Ada 2005 additions which would cause bootstrap
+# problems if included in the compiler and other basic tools.
+
+ifeq ($(filter-out a-except%,$(LIBGNAT_TARGET_PAIRS)),$(LIBGNAT_TARGET_PAIRS))
+ LIBGNAT_TARGET_PAIRS += \
+ a-except.ads<a-except-2005.ads \
+ a-except.adb<a-except-2005.adb
+endif
+
# The runtime library for gnat comprises two directories. One contains the
# Ada source files that the compiler (gnat1) needs -- these files are listed
# by ADA_INCLUDE_SRCS -- and the other contains the object files and their
@@ -1382,12 +1417,12 @@ endif
# go into the directory. The pthreads emulation is built in the threads
# subdirectory and copied.
LIBGNAT_SRCS = ada.h adaint.c adaint.h argv.c cio.c cstreams.c \
- errno.c exit.c cal.c ctrl_c.c \
+ errno.c exit.c cal.c ctrl_c.c env.c env.h \
raise.h raise.c sysdep.c aux-io.c init.c initialize.c seh_init.c \
- final.c tracebak.c tb-alvms.c tb-alvxw.c expect.c mkdir.c socket.c gsocket.h \
- targext.c $(EXTRA_LIBGNAT_SRCS)
+ final.c tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c expect.c mkdir.c \
+ socket.c gsocket.h targext.c $(EXTRA_LIBGNAT_SRCS)
-LIBGNAT_OBJS = adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o \
+LIBGNAT_OBJS = adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o env.o \
raise.o sysdep.o aux-io.o init.o initialize.o seh_init.o cal.o \
final.o tracebak.o expect.o mkdir.o socket.o targext.o $(EXTRA_LIBGNAT_OBJS)
@@ -1811,7 +1846,8 @@ gnatlib-sjlj:
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' rts/system.ads > rts/s.ads
$(MV) rts/s.ads rts/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
- GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+ EH_MECHANISM="" \
+ GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
THREAD_KIND="$(THREAD_KIND)" \
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
@@ -1821,6 +1857,7 @@ gnatlib-zcx:
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' rts/system.ads > rts/s.ads
$(MV) rts/s.ads rts/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
+ EH_MECHANISM="-gcc" \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
THREAD_KIND="$(THREAD_KIND)" \
@@ -1935,7 +1972,7 @@ seh_init.o : seh_init.c raise.h
# Need to keep the frame pointer in this file to pop the stack properly on
# some targets.
-tracebak.o : tracebak.c tb-alvms.c tb-alvxw.c
+tracebak.o : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-fno-omit-frame-pointer $< $(OUTPUT_OPTION)
diff --git a/gcc/ada/a-except-2005.adb b/gcc/ada/a-except-2005.adb
new file mode 100644
index 00000000000..7325723d7f8
--- /dev/null
+++ b/gcc/ada/a-except-2005.adb
@@ -0,0 +1,1355 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . E X C E P T I O N S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2006, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This version is used for all Ada 2005 builds. It differs from a-except.ads
+-- only with respect to the addition of Wide_[Wide]Exception_Name functions.
+
+-- The reason for this splitting off of a separate version is that bootstrap
+-- compilers often will be used that do not support Ada 2005 features, and
+-- Ada.Exceptions is part of the compiler sources.
+
+-- The base version of this unit Ada.Exceptions omits the Wide version of
+-- Exception_Name and is used to build the compiler and other basic tools.
+
+pragma Polling (Off);
+-- We must turn polling off for this unit, because otherwise we get
+-- elaboration circularities with System.Exception_Tables.
+
+with System; use System;
+with System.Standard_Library; use System.Standard_Library;
+with System.Soft_Links; use System.Soft_Links;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_StW; use System.WCh_StW;
+
+package body Ada.Exceptions is
+
+ pragma Suppress (All_Checks);
+ -- We definitely do not want exceptions occurring within this unit, or
+ -- we are in big trouble. If an exceptional situation does occur, better
+ -- that it not be raised, since raising it can cause confusing chaos.
+
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ -- Note: the exported subprograms in this package body are called directly
+ -- from C clients using the given external name, even though they are not
+ -- technically visible in the Ada sense.
+
+ function Code_Address_For_AAA return System.Address;
+ function Code_Address_For_ZZZ return System.Address;
+ -- Return start and end of procedures in this package
+ --
+ -- These procedures are used to provide exclusion bounds in
+ -- calls to Call_Chain at exception raise points from this unit. The
+ -- purpose is to arrange for the exception tracebacks not to include
+ -- frames from routines involved in the raise process, as these are
+ -- meaningless from the user's standpoint.
+ --
+ -- For these bounds to be meaningful, we need to ensure that the object
+ -- code for the routines involved in processing a raise is located after
+ -- the object code Code_Address_For_AAA and before the object code
+ -- Code_Address_For_ZZZ. This will indeed be the case as long as the
+ -- following rules are respected:
+ --
+ -- 1) The bodies of the subprograms involved in processing a raise
+ -- are located after the body of Code_Address_For_AAA and before the
+ -- body of Code_Address_For_ZZZ.
+ --
+ -- 2) No pragma Inline applies to any of these subprograms, as this
+ -- could delay the corresponding assembly output until the end of
+ -- the unit.
+
+ procedure Call_Chain (Excep : EOA);
+ -- Store up to Max_Tracebacks in Excep, corresponding to the current
+ -- call chain.
+
+ procedure To_Stderr (S : String);
+ pragma Export (Ada, To_Stderr, "__gnat_to_stderr");
+ -- Little routine to output string to stderr that is also used
+ -- in the tasking run time.
+
+ procedure To_Stderr (C : Character);
+ pragma Inline (To_Stderr);
+ pragma Export (Ada, To_Stderr, "__gnat_to_stderr_char");
+ -- Little routine to output a character to stderr, used by some of
+ -- the separate units below.
+
+ package Exception_Data is
+
+ ---------------------------------
+ -- Exception messages routines --
+ ---------------------------------
+
+ procedure Set_Exception_C_Msg
+ (Id : Exception_Id;
+ Msg1 : System.Address;
+ Line : Integer := 0;
+ Msg2 : System.Address := System.Null_Address);
+ -- This routine is called to setup the exception referenced by the
+ -- Current_Excep field in the TSD to contain the indicated Id value
+ -- and message. Msg1 is a null terminated string which is generated
+ -- as the exception message. If line is non-zero, then a colon and
+ -- the decimal representation of this integer is appended to the
+ -- message. When Msg2 is non-null, a space and this additional null
+ -- terminated string is added to the message.
+
+ procedure Set_Exception_Msg
+ (Id : Exception_Id;
+ Message : String);
+ -- This routine is called to setup the exception referenced by the
+ -- Current_Excep field in the TSD to contain the indicated Id value
+ -- and message. Message is a string which is generated as the
+ -- exception message.
+
+ --------------------------------------
+ -- Exception information subprogram --
+ --------------------------------------
+
+ function Exception_Information (X : Exception_Occurrence) return String;
+ -- The format of the exception information is as follows:
+ --
+ -- Exception_Name: <exception name> (as in Exception_Name)
+ -- Message: <message> (only if Exception_Message is empty)
+ -- PID=nnnn (only if != 0)
+ -- Call stack traceback locations: (only if at least one location)
+ -- <0xyyyyyyyy 0xyyyyyyyy ...> (is recorded)
+ --
+ -- The lines are separated by a ASCII.LF character.
+ -- The nnnn is the partition Id given as decimal digits.
+ -- The 0x... line represents traceback program counter locations, in
+ -- execution order with the first one being the exception location. It
+ -- is present only
+ --
+ -- 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.
+
+ ---------------------------------------
+ -- Exception backtracing subprograms --
+ ---------------------------------------
+
+ -- What is automatically output when exception tracing is on is the
+ -- usual exception information with the call chain backtrace possibly
+ -- tailored by a backtrace decorator. Modifying Exception_Information
+ -- itself is not a good idea because the decorated output is completely
+ -- out of control and would break all our code related to the streaming
+ -- of exceptions. We then provide an alternative function to compute
+ -- the possibly tailored output, which is equivalent if no decorator is
+ -- currently set:
+
+ function Tailored_Exception_Information
+ (X : Exception_Occurrence) return String;
+ -- Exception information to be output in the case of automatic tracing
+ -- requested through GNAT.Exception_Traces.
+ --
+ -- This is the same as Exception_Information if no backtrace decorator
+ -- is currently in place. Otherwise, this is Exception_Information with
+ -- the call chain raw addresses replaced by the result of a call to the
+ -- current decorator provided with the call chain addresses.
+
+ pragma Export
+ (Ada, Tailored_Exception_Information,
+ "__gnat_tailored_exception_information");
+ -- This is currently used by System.Tasking.Stages
+
+ end Exception_Data;
+
+ package Exception_Traces is
+
+ use Exception_Data;
+ -- Imports Tailored_Exception_Information
+
+ ----------------------------------------------
+ -- Run-Time Exception Notification Routines --
+ ----------------------------------------------
+
+ -- These subprograms provide a common run-time interface to trigger the
+ -- actions required when an exception is about to be propagated (e.g.
+ -- user specified actions or output of exception information). They are
+ -- exported to be usable by the Ada exception handling personality
+ -- routine when the GCC 3 mechanism is used.
+
+ procedure Notify_Handled_Exception;
+ pragma Export
+ (C, Notify_Handled_Exception, "__gnat_notify_handled_exception");
+ -- This routine is called for a handled occurrence is about to be
+ -- propagated.
+
+ procedure Notify_Unhandled_Exception;
+ pragma Export
+ (C, Notify_Unhandled_Exception, "__gnat_notify_unhandled_exception");
+ -- This routine is called when an unhandled occurrence is about to be
+ -- propagated.
+
+ procedure Unhandled_Exception_Terminate;
+ pragma No_Return (Unhandled_Exception_Terminate);
+ -- This procedure is called to terminate execution following an
+ -- unhandled exception. The exception information, including
+ -- traceback if available is output, and execution is then
+ -- terminated. Note that at the point where this routine is
+ -- called, the stack has typically been destroyed.
+
+ end Exception_Traces;
+
+ package Exception_Propagation is
+
+ use Exception_Traces;
+ -- Imports Notify_Unhandled_Exception and
+ -- Unhandled_Exception_Terminate
+
+ ------------------------------------
+ -- Exception propagation routines --
+ ------------------------------------
+
+ procedure Setup_Exception
+ (Excep : EOA;
+ Current : EOA;
+ Reraised : Boolean := False);
+ -- Perform the necessary operations to prepare the propagation of Excep
+ -- in a task where Current is the current occurrence. Excep is assumed
+ -- to be a valid (non null) pointer.
+ --
+ -- This should be called before any (re-)setting of the current
+ -- occurrence. Any such (re-)setting shall take care *not* to clobber
+ -- the Private_Data component.
+ --
+ -- Having Current provided as an argument (instead of retrieving it via
+ -- Get_Current_Excep internally) is required to allow one task to setup
+ -- an exception for another task, which is used by Transfer_Occurrence.
+
+ procedure Propagate_Exception
+ (E : Exception_Id;
+ From_Signal_Handler : Boolean);
+ pragma No_Return (Propagate_Exception);
+ -- This procedure propagates the exception represented by the occurrence
+ -- referenced by Current_Excep in the TSD for the current task.
+
+ end Exception_Propagation;
+
+ package Stream_Attributes is
+
+ --------------------------------
+ -- Stream attributes routines --
+ --------------------------------
+
+ function EId_To_String (X : Exception_Id) return String;
+ function String_To_EId (S : String) return Exception_Id;
+ -- Functions for implementing Exception_Id stream attributes
+
+ function EO_To_String (X : Exception_Occurrence) return String;
+ function String_To_EO (S : String) return Exception_Occurrence;
+ -- Functions for implementing Exception_Occurrence stream
+ -- attributes
+
+ end Stream_Attributes;
+
+ procedure Raise_Current_Excep (E : Exception_Id);
+ pragma No_Return (Raise_Current_Excep);
+ pragma Export (C, Raise_Current_Excep, "__gnat_raise_nodefer_with_msg");
+ -- This is a simple wrapper to Exception_Propagation.Propagate_Exception
+ -- setting the From_Signal_Handler argument to False.
+ --
+ -- This external name for Raise_Current_Excep is historical, and probably
+ -- should be changed but for now we keep it, because gdb and gigi know
+ -- about it.
+
+ procedure Raise_Exception_No_Defer
+ (E : Exception_Id; Message : String := "");
+ pragma Export
+ (Ada, Raise_Exception_No_Defer,
+ "ada__exceptions__raise_exception_no_defer");
+ pragma No_Return (Raise_Exception_No_Defer);
+ -- Similar to Raise_Exception, but with no abort deferral
+
+ procedure Raise_With_Msg (E : Exception_Id);
+ pragma No_Return (Raise_With_Msg);
+ pragma Export (C, Raise_With_Msg, "__gnat_raise_with_msg");
+ -- Raises an exception with given exception id value. A message
+ -- is associated with the raise, and has already been stored in the
+ -- exception occurrence referenced by the Current_Excep in the TSD.
+ -- Abort is deferred before the raise call.
+
+ procedure Raise_With_Location_And_Msg
+ (E : Exception_Id;
+ F : System.Address;
+ L : Integer;
+ M : System.Address := System.Null_Address);
+ pragma No_Return (Raise_With_Location_And_Msg);
+ -- Raise an exception with given exception id value. A filename and line
+ -- number is associated with the raise and is stored in the exception
+ -- occurrence and in addition a string message M is appended to
+ -- this (if M is not null).
+
+ procedure Raise_Constraint_Error
+ (File : System.Address;
+ Line : Integer);
+ pragma No_Return (Raise_Constraint_Error);
+ pragma Export
+ (C, Raise_Constraint_Error, "__gnat_raise_constraint_error");
+ -- Raise constraint error with file:line information
+
+ procedure Raise_Constraint_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address);
+ pragma No_Return (Raise_Constraint_Error_Msg);
+ pragma Export
+ (C, Raise_Constraint_Error_Msg, "__gnat_raise_constraint_error_msg");
+ -- Raise constraint error with file:line + msg information
+
+ procedure Raise_Program_Error
+ (File : System.Address;
+ Line : Integer);
+ pragma No_Return (Raise_Program_Error);
+ pragma Export
+ (C, Raise_Program_Error, "__gnat_raise_program_error");
+ -- Raise program error with file:line information
+
+ procedure Raise_Program_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address);
+ pragma No_Return (Raise_Program_Error_Msg);
+ pragma Export
+ (C, Raise_Program_Error_Msg, "__gnat_raise_program_error_msg");
+ -- Raise program error with file:line + msg information
+
+ procedure Raise_Storage_Error
+ (File : System.Address;
+ Line : Integer);
+ pragma No_Return (Raise_Storage_Error);
+ pragma Export
+ (C, Raise_Storage_Error, "__gnat_raise_storage_error");
+ -- Raise storage error with file:line information
+
+ procedure Raise_Storage_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address);
+ pragma No_Return (Raise_Storage_Error_Msg);
+ pragma Export
+ (C, Raise_Storage_Error_Msg, "__gnat_raise_storage_error_msg");
+ -- Raise storage error with file:line + reason msg information
+
+ -- The exception raising process and the automatic tracing mechanism rely
+ -- on some careful use of flags attached to the exception occurrence. The
+ -- graph below illustrates the relations between the Raise_ subprograms
+ -- and identifies the points where basic flags such as Exception_Raised
+ -- are initialized.
+ --
+ -- (i) signs indicate the flags initialization points. R stands for Raise,
+ -- W for With, and E for Exception.
+ --
+ -- R_No_Msg R_E R_Pe R_Ce R_Se
+ -- | | | | |
+ -- +--+ +--+ +---+ | +---+
+ -- | | | | |
+ -- R_E_No_Defer(i) R_W_Msg(i) R_W_Loc
+ -- | | | |
+ -- +------------+ | +-----------+ +--+
+ -- | | | |
+ -- | | | Set_E_C_Msg(i)
+ -- | | |
+ -- Raise_Current_Excep
+
+ procedure Reraise;
+ pragma No_Return (Reraise);
+ pragma Export (C, Reraise, "__gnat_reraise");
+ -- Reraises the exception referenced by the Current_Excep field of
+ -- the TSD (all fields of this exception occurrence are set). Abort
+ -- is deferred before the reraise operation.
+
+ -- Save_Occurrence variations: As the management of the private data
+ -- attached to occurrences is delicate, wether or not pointers to such
+ -- data has to be copied in various situations is better made explicit.
+ -- The following procedures provide an internal interface to help making
+ -- this explicit.
+
+ procedure Save_Occurrence_No_Private
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence);
+ -- Copy all the components of Source to Target, except the
+ -- Private_Data pointer.
+
+ procedure Transfer_Occurrence
+ (Target : Exception_Occurrence_Access;
+ Source : Exception_Occurrence);
+ pragma Export (C, Transfer_Occurrence, "__gnat_transfer_occurrence");
+ -- Called from System.Tasking.RendezVous.Exceptional_Complete_RendezVous
+ -- to setup Target from Source as an exception to be propagated in the
+ -- caller task. Target is expected to be a pointer to the fixed TSD
+ -- occurrence for this task.
+
+ -----------------------------
+ -- Run-Time Check Routines --
+ -----------------------------
+
+ -- These routines are called from the runtime to raise a specific
+ -- exception with a reason message attached. The parameters are
+ -- the file name and line number in each case. The names are keyed
+ -- to the codes defined in Types.ads and a-types.h (for example,
+ -- the name Rcheck_05 refers to the Reason whose Pos code is 5).
+
+ procedure Rcheck_00 (File : System.Address; Line : Integer);
+ procedure Rcheck_01 (File : System.Address; Line : Integer);
+ procedure Rcheck_02 (File : System.Address; Line : Integer);
+ procedure Rcheck_03 (File : System.Address; Line : Integer);
+ procedure Rcheck_04 (File : System.Address; Line : Integer);
+ procedure Rcheck_05 (File : System.Address; Line : Integer);
+ procedure Rcheck_06 (File : System.Address; Line : Integer);
+ procedure Rcheck_07 (File : System.Address; Line : Integer);
+ procedure Rcheck_08 (File : System.Address; Line : Integer);
+ procedure Rcheck_09 (File : System.Address; Line : Integer);
+ procedure Rcheck_10 (File : System.Address; Line : Integer);
+ procedure Rcheck_11 (File : System.Address; Line : Integer);
+ procedure Rcheck_12 (File : System.Address; Line : Integer);
+ procedure Rcheck_13 (File : System.Address; Line : Integer);
+ procedure Rcheck_14 (File : System.Address; Line : Integer);
+ procedure Rcheck_15 (File : System.Address; Line : Integer);
+ procedure Rcheck_16 (File : System.Address; Line : Integer);
+ procedure Rcheck_17 (File : System.Address; Line : Integer);
+ procedure Rcheck_18 (File : System.Address; Line : Integer);
+ procedure Rcheck_19 (File : System.Address; Line : Integer);
+ procedure Rcheck_20 (File : System.Address; Line : Integer);
+ procedure Rcheck_21 (File : System.Address; Line : Integer);
+ procedure Rcheck_22 (File : System.Address; Line : Integer);
+ procedure Rcheck_23 (File : System.Address; Line : Integer);
+ procedure Rcheck_24 (File : System.Address; Line : Integer);
+ procedure Rcheck_25 (File : System.Address; Line : Integer);
+ procedure Rcheck_26 (File : System.Address; Line : Integer);
+ procedure Rcheck_27 (File : System.Address; Line : Integer);
+ procedure Rcheck_28 (File : System.Address; Line : Integer);
+ procedure Rcheck_29 (File : System.Address; Line : Integer);
+ procedure Rcheck_30 (File : System.Address; Line : Integer);
+ procedure Rcheck_31 (File : System.Address; Line : Integer);
+ procedure Rcheck_32 (File : System.Address; Line : Integer);
+
+ pragma Export (C, Rcheck_00, "__gnat_rcheck_00");
+ pragma Export (C, Rcheck_01, "__gnat_rcheck_01");
+ pragma Export (C, Rcheck_02, "__gnat_rcheck_02");
+ pragma Export (C, Rcheck_03, "__gnat_rcheck_03");
+ pragma Export (C, Rcheck_04, "__gnat_rcheck_04");
+ pragma Export (C, Rcheck_05, "__gnat_rcheck_05");
+ pragma Export (C, Rcheck_06, "__gnat_rcheck_06");
+ pragma Export (C, Rcheck_07, "__gnat_rcheck_07");
+ pragma Export (C, Rcheck_08, "__gnat_rcheck_08");
+ pragma Export (C, Rcheck_09, "__gnat_rcheck_09");
+ pragma Export (C, Rcheck_10, "__gnat_rcheck_10");
+ pragma Export (C, Rcheck_11, "__gnat_rcheck_11");
+ pragma Export (C, Rcheck_12, "__gnat_rcheck_12");
+ pragma Export (C, Rcheck_13, "__gnat_rcheck_13");
+ pragma Export (C, Rcheck_14, "__gnat_rcheck_14");
+ pragma Export (C, Rcheck_15, "__gnat_rcheck_15");
+ pragma Export (C, Rcheck_16, "__gnat_rcheck_16");
+ pragma Export (C, Rcheck_17, "__gnat_rcheck_17");
+ pragma Export (C, Rcheck_18, "__gnat_rcheck_18");
+ pragma Export (C, Rcheck_19, "__gnat_rcheck_19");
+ pragma Export (C, Rcheck_20, "__gnat_rcheck_20");
+ pragma Export (C, Rcheck_21, "__gnat_rcheck_21");
+ pragma Export (C, Rcheck_22, "__gnat_rcheck_22");
+ pragma Export (C, Rcheck_23, "__gnat_rcheck_23");
+ pragma Export (C, Rcheck_24, "__gnat_rcheck_24");
+ pragma Export (C, Rcheck_25, "__gnat_rcheck_25");
+ pragma Export (C, Rcheck_26, "__gnat_rcheck_26");
+ pragma Export (C, Rcheck_27, "__gnat_rcheck_27");
+ pragma Export (C, Rcheck_28, "__gnat_rcheck_28");
+ pragma Export (C, Rcheck_29, "__gnat_rcheck_29");
+ pragma Export (C, Rcheck_30, "__gnat_rcheck_30");
+ pragma Export (C, Rcheck_31, "__gnat_rcheck_31");
+ pragma Export (C, Rcheck_32, "__gnat_rcheck_32");
+
+ -- 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).
+
+ pragma No_Return (Rcheck_00);
+ pragma No_Return (Rcheck_01);
+ pragma No_Return (Rcheck_02);
+ pragma No_Return (Rcheck_03);
+ pragma No_Return (Rcheck_04);
+ pragma No_Return (Rcheck_05);
+ pragma No_Return (Rcheck_06);
+ pragma No_Return (Rcheck_07);
+ pragma No_Return (Rcheck_08);
+ pragma No_Return (Rcheck_09);
+ pragma No_Return (Rcheck_10);
+ pragma No_Return (Rcheck_11);
+ pragma No_Return (Rcheck_12);
+ pragma No_Return (Rcheck_13);
+ pragma No_Return (Rcheck_14);
+ pragma No_Return (Rcheck_15);
+ pragma No_Return (Rcheck_16);
+ pragma No_Return (Rcheck_17);
+ pragma No_Return (Rcheck_18);
+ pragma No_Return (Rcheck_19);
+ pragma No_Return (Rcheck_20);
+ pragma No_Return (Rcheck_21);
+ pragma No_Return (Rcheck_22);
+ pragma No_Return (Rcheck_23);
+ pragma No_Return (Rcheck_24);
+ pragma No_Return (Rcheck_25);
+ pragma No_Return (Rcheck_26);
+ pragma No_Return (Rcheck_27);
+ pragma No_Return (Rcheck_28);
+ pragma No_Return (Rcheck_29);
+ pragma No_Return (Rcheck_30);
+ pragma No_Return (Rcheck_32);
+
+ ---------------------------------------------
+ -- Reason Strings for Run-Time Check Calls --
+ ---------------------------------------------
+
+ -- These strings are null-terminated and are used by Rcheck_nn. The
+ -- strings correspond to the definitions for Types.RT_Exception_Code.
+
+ use ASCII;
+
+ Rmsg_00 : constant String := "access check failed" & NUL;
+ Rmsg_01 : constant String := "access parameter is null" & NUL;
+ Rmsg_02 : constant String := "discriminant check failed" & NUL;
+ Rmsg_03 : constant String := "divide by zero" & NUL;
+ Rmsg_04 : constant String := "explicit raise" & NUL;
+ Rmsg_05 : constant String := "index check failed" & NUL;
+ Rmsg_06 : constant String := "invalid data" & NUL;
+ Rmsg_07 : constant String := "length check failed" & NUL;
+ Rmsg_08 : constant String := "null Exception_Id" & NUL;
+ Rmsg_09 : constant String := "null-exclusion check failed" & NUL;
+ Rmsg_10 : constant String := "overflow check failed" & NUL;
+ Rmsg_11 : constant String := "partition check failed" & NUL;
+ Rmsg_12 : constant String := "range check failed" & NUL;
+ Rmsg_13 : constant String := "tag check failed" & NUL;
+ Rmsg_14 : constant String := "access before elaboration" & NUL;
+ Rmsg_15 : constant String := "accessibility check failed" & NUL;
+ Rmsg_16 : constant String := "all guards closed" & NUL;
+ Rmsg_17 : constant String := "duplicated entry address" & NUL;
+ Rmsg_18 : constant String := "explicit raise" & NUL;
+ Rmsg_19 : constant String := "finalize/adjust raised exception" & NUL;
+ Rmsg_20 : constant String := "implicit return with No_Return" & NUL;
+ Rmsg_21 : constant String := "misaligned address value" & NUL;
+ Rmsg_22 : constant String := "missing return" & NUL;
+ Rmsg_23 : constant String := "overlaid controlled object" & NUL;
+ Rmsg_24 : constant String := "potentially blocking operation" & NUL;
+ Rmsg_25 : constant String := "stubbed subprogram called" & NUL;
+ Rmsg_26 : constant String := "unchecked union restriction" & NUL;
+ Rmsg_27 : constant String := "illegal use of remote access-to-" &
+ "class-wide type, see RM E.4(18)" & NUL;
+ Rmsg_28 : constant String := "empty storage pool" & NUL;
+ Rmsg_29 : constant String := "explicit raise" & NUL;
+ Rmsg_30 : constant String := "infinite recursion" & NUL;
+ Rmsg_31 : constant String := "object too large" & NUL;
+ Rmsg_32 : constant String := "restriction violation" & NUL;
+
+ -----------------------
+ -- Polling Interface --
+ -----------------------
+
+ type Unsigned is mod 2 ** 32;
+
+ Counter : Unsigned := 0;
+ pragma Warnings (Off, Counter);
+ -- This counter is provided for convenience. It can be used in Poll to
+ -- perform periodic but not systematic operations.
+
+ procedure Poll is separate;
+ -- The actual polling routine is separate, so that it can easily
+ -- be replaced with a target dependent version.
+
+ --------------------------
+ -- Code_Address_For_AAA --
+ --------------------------
+
+ -- 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!
+
+ function Code_Address_For_AAA return System.Address is
+ begin
+ -- We are using a label instead of merely using
+ -- Code_Address_For_AAA'Address because on some platforms the latter
+ -- does not yield the address we want, but the address of a stub or of
+ -- a descriptor instead. This is the case at least on Alpha-VMS and
+ -- PA-HPUX.
+
+ <<Start_Of_AAA>>
+ return Start_Of_AAA'Address;
+ end Code_Address_For_AAA;
+
+ ----------------
+ -- Call_Chain --
+ ----------------
+
+ procedure Call_Chain (Excep : EOA) is separate;
+ -- The actual Call_Chain routine is separate, so that it can easily
+ -- be dummied out when no exception traceback information is needed.
+
+ ------------------------------
+ -- Current_Target_Exception --
+ ------------------------------
+
+ function Current_Target_Exception return Exception_Occurrence is
+ begin
+ return Null_Occurrence;
+ end Current_Target_Exception;
+
+ -------------------
+ -- EId_To_String --
+ -------------------
+
+ function EId_To_String (X : Exception_Id) return String
+ renames Stream_Attributes.EId_To_String;
+
+ ------------------
+ -- EO_To_String --
+ ------------------
+
+ -- We use the null string to represent the null occurrence, otherwise
+ -- we output the Exception_Information string for the occurrence.
+
+ function EO_To_String (X : Exception_Occurrence) return String
+ renames Stream_Attributes.EO_To_String;
+
+ ------------------------
+ -- Exception_Identity --
+ ------------------------
+
+ function Exception_Identity
+ (X : Exception_Occurrence) return Exception_Id
+ is
+ begin
+ -- Note that the following test used to be here for the original
+ -- Ada 95 semantics, but these were modified by AI-241 to require
+ -- returning Null_Id instead of raising Constraint_Error.
+
+ -- if X.Id = Null_Id then
+ -- raise Constraint_Error;
+ -- end if;
+
+ return X.Id;
+ end Exception_Identity;
+
+ ---------------------------
+ -- Exception_Information --
+ ---------------------------
+
+ function Exception_Information (X : Exception_Occurrence) return String is
+ begin
+ if X.Id = Null_Id then
+ raise Constraint_Error;
+ end if;
+
+ return Exception_Data.Exception_Information (X);
+ end Exception_Information;
+
+ -----------------------
+ -- Exception_Message --
+ -----------------------
+
+ function Exception_Message (X : Exception_Occurrence) return String is
+ begin
+ if X.Id = Null_Id then
+ raise Constraint_Error;
+ end if;
+
+ return X.Msg (1 .. X.Msg_Length);
+ end Exception_Message;
+
+ --------------------
+ -- Exception_Name --
+ --------------------
+
+ function Exception_Name (Id : Exception_Id) return String is
+ begin
+ if Id = null then
+ raise Constraint_Error;
+ end if;
+
+ return To_Ptr (Id.Full_Name) (1 .. Id.Name_Length - 1);
+ end Exception_Name;
+
+ function Exception_Name (X : Exception_Occurrence) return String is
+ begin
+ return Exception_Name (X.Id);
+ end Exception_Name;
+
+ ---------------------------
+ -- Exception_Name_Simple --
+ ---------------------------
+
+ function Exception_Name_Simple (X : Exception_Occurrence) return String is
+ Name : constant String := Exception_Name (X);
+ P : Natural;
+
+ begin
+ P := Name'Length;
+ while P > 1 loop
+ exit when Name (P - 1) = '.';
+ P := P - 1;
+ end loop;
+
+ -- Return result making sure lower bound is 1
+
+ declare
+ subtype Rname is String (1 .. Name'Length - P + 1);
+ begin
+ return Rname (Name (P .. Name'Length));
+ end;
+ end Exception_Name_Simple;
+
+ --------------------
+ -- Exception_Data --
+ --------------------
+
+ package body Exception_Data is separate;
+ -- This package can be easily dummied out if we do not want the
+ -- basic support for exception messages (such as in Ada 83).
+
+ ---------------------------
+ -- Exception_Propagation --
+ ---------------------------
+
+ package body Exception_Propagation is separate;
+ -- Depending on the actual exception mechanism used (front-end or
+ -- back-end based), the implementation will differ, which is why this
+ -- package is separated.
+
+ ----------------------
+ -- Exception_Traces --
+ ----------------------
+
+ package body Exception_Traces is separate;
+ -- Depending on the underlying support for IO the implementation
+ -- will differ. Moreover we would like to dummy out this package
+ -- in case we do not want any exception tracing support. This is
+ -- why this package is separated.
+
+ -----------------------
+ -- Stream Attributes --
+ -----------------------
+
+ package body Stream_Attributes is separate;
+ -- This package can be easily dummied out if we do not want the
+ -- support for streaming Exception_Ids and Exception_Occurrences.
+
+ ----------------------------
+ -- Raise_Constraint_Error --
+ ----------------------------
+
+ procedure Raise_Constraint_Error
+ (File : System.Address;
+ Line : Integer)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Constraint_Error_Def'Access, File, Line);
+ end Raise_Constraint_Error;
+
+ --------------------------------
+ -- Raise_Constraint_Error_Msg --
+ --------------------------------
+
+ procedure Raise_Constraint_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Constraint_Error_Def'Access, File, Line, Msg);
+ end Raise_Constraint_Error_Msg;
+
+ -------------------------
+ -- Raise_Current_Excep --
+ -------------------------
+
+ procedure Raise_Current_Excep (E : Exception_Id) is
+
+ pragma Inspection_Point (E);
+ -- This is so the debugger can reliably inspect the parameter when
+ -- inserting a breakpoint at the start of this procedure.
+
+ Id : Exception_Id := E;
+ pragma Volatile (Id);
+ pragma Warnings (Off, Id);
+ -- In order to provide support for breakpoints on unhandled exceptions,
+ -- the debugger will also need to be able to inspect the value of E from
+ -- another (inner) frame. So we need to make sure that if E is passed in
+ -- a register, its value is also spilled on stack. For this, we store
+ -- 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!
+
+ begin
+ Exception_Propagation.Propagate_Exception
+ (E => E, From_Signal_Handler => False);
+ end Raise_Current_Excep;
+
+ ---------------------
+ -- Raise_Exception --
+ ---------------------
+
+ procedure Raise_Exception
+ (E : Exception_Id;
+ Message : String := "")
+ is
+ begin
+ if E /= null then
+ Exception_Data.Set_Exception_Msg (E, Message);
+ Abort_Defer.all;
+ Raise_Current_Excep (E);
+ end if;
+
+ -- Note: if E is null, then we simply return, which is correct Ada 95
+ -- semantics. If we are operating in Ada 2005 mode, then the expander
+ -- generates a raise Constraint_Error immediately following the call
+ -- to provide the required Ada 2005 semantics (see AI-329). We do it
+ -- this way to avoid having run time dependencies on the Ada version.
+
+ return;
+ end Raise_Exception;
+
+ ----------------------------
+ -- Raise_Exception_Always --
+ ----------------------------
+
+ procedure Raise_Exception_Always
+ (E : Exception_Id;
+ Message : String := "")
+ is
+ begin
+ Exception_Data.Set_Exception_Msg (E, Message);
+ Abort_Defer.all;
+ Raise_Current_Excep (E);
+ end Raise_Exception_Always;
+
+ -------------------------------
+ -- Raise_From_Signal_Handler --
+ -------------------------------
+
+ procedure Raise_From_Signal_Handler
+ (E : Exception_Id;
+ M : System.Address)
+ is
+ begin
+ Exception_Data.Set_Exception_C_Msg (E, M);
+ Abort_Defer.all;
+ Exception_Propagation.Propagate_Exception
+ (E => E, From_Signal_Handler => True);
+ end Raise_From_Signal_Handler;
+
+ -------------------------
+ -- Raise_Program_Error --
+ -------------------------
+
+ procedure Raise_Program_Error
+ (File : System.Address;
+ Line : Integer)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Program_Error_Def'Access, File, Line);
+ end Raise_Program_Error;
+
+ -----------------------------
+ -- Raise_Program_Error_Msg --
+ -----------------------------
+
+ procedure Raise_Program_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Program_Error_Def'Access, File, Line, Msg);
+ end Raise_Program_Error_Msg;
+
+ -------------------------
+ -- Raise_Storage_Error --
+ -------------------------
+
+ procedure Raise_Storage_Error
+ (File : System.Address;
+ Line : Integer)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Storage_Error_Def'Access, File, Line);
+ end Raise_Storage_Error;
+
+ -----------------------------
+ -- Raise_Storage_Error_Msg --
+ -----------------------------
+
+ procedure Raise_Storage_Error_Msg
+ (File : System.Address;
+ Line : Integer;
+ Msg : System.Address)
+ is
+ begin
+ Raise_With_Location_And_Msg
+ (Storage_Error_Def'Access, File, Line, Msg);
+ end Raise_Storage_Error_Msg;
+
+ ---------------------------------
+ -- Raise_With_Location_And_Msg --
+ ---------------------------------
+
+ procedure Raise_With_Location_And_Msg
+ (E : Exception_Id;
+ F : System.Address;
+ L : Integer;
+ M : System.Address := System.Null_Address)
+ is
+ begin
+ Exception_Data.Set_Exception_C_Msg (E, F, L, M);
+ Abort_Defer.all;
+ Raise_Current_Excep (E);
+ end Raise_With_Location_And_Msg;
+
+ --------------------
+ -- Raise_With_Msg --
+ --------------------
+
+ procedure Raise_With_Msg (E : Exception_Id) is
+ Excep : constant EOA := Get_Current_Excep.all;
+
+ begin
+ Exception_Propagation.Setup_Exception (Excep, Excep);
+
+ Excep.Exception_Raised := False;
+ Excep.Id := E;
+ Excep.Num_Tracebacks := 0;
+ Excep.Cleanup_Flag := False;
+ Excep.Pid := Local_Partition_ID;
+ Abort_Defer.all;
+ Raise_Current_Excep (E);
+ end Raise_With_Msg;
+
+ --------------------------------------
+ -- Calls to Run-Time Check Routines --
+ --------------------------------------
+
+ procedure Rcheck_00 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_00'Address);
+ end Rcheck_00;
+
+ procedure Rcheck_01 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_01'Address);
+ end Rcheck_01;
+
+ procedure Rcheck_02 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_02'Address);
+ end Rcheck_02;
+
+ procedure Rcheck_03 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_03'Address);
+ end Rcheck_03;
+
+ procedure Rcheck_04 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_04'Address);
+ end Rcheck_04;
+
+ procedure Rcheck_05 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_05'Address);
+ end Rcheck_05;
+
+ procedure Rcheck_06 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_06'Address);
+ end Rcheck_06;
+
+ procedure Rcheck_07 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_07'Address);
+ end Rcheck_07;
+
+ procedure Rcheck_08 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_08'Address);
+ end Rcheck_08;
+
+ procedure Rcheck_09 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_09'Address);
+ end Rcheck_09;
+
+ procedure Rcheck_10 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_10'Address);
+ end Rcheck_10;
+
+ procedure Rcheck_11 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_11'Address);
+ end Rcheck_11;
+
+ procedure Rcheck_12 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_12'Address);
+ end Rcheck_12;
+
+ procedure Rcheck_13 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_13'Address);
+ end Rcheck_13;
+
+ procedure Rcheck_14 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_14'Address);
+ end Rcheck_14;
+
+ procedure Rcheck_15 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_15'Address);
+ end Rcheck_15;
+
+ procedure Rcheck_16 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_16'Address);
+ end Rcheck_16;
+
+ procedure Rcheck_17 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_17'Address);
+ end Rcheck_17;
+
+ procedure Rcheck_18 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_18'Address);
+ end Rcheck_18;
+
+ procedure Rcheck_19 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_19'Address);
+ end Rcheck_19;
+
+ procedure Rcheck_20 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_20'Address);
+ end Rcheck_20;
+
+ procedure Rcheck_21 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_21'Address);
+ end Rcheck_21;
+
+ procedure Rcheck_22 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_22'Address);
+ end Rcheck_22;
+
+ procedure Rcheck_23 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_23'Address);
+ end Rcheck_23;
+
+ procedure Rcheck_24 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_24'Address);
+ end Rcheck_24;
+
+ procedure Rcheck_25 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_25'Address);
+ end Rcheck_25;
+
+ procedure Rcheck_26 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_26'Address);
+ end Rcheck_26;
+
+ procedure Rcheck_27 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Program_Error_Msg (File, Line, Rmsg_27'Address);
+ end Rcheck_27;
+
+ procedure Rcheck_28 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_28'Address);
+ end Rcheck_28;
+
+ procedure Rcheck_29 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_29'Address);
+ end Rcheck_29;
+
+ procedure Rcheck_30 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_30'Address);
+ end Rcheck_30;
+
+ procedure Rcheck_31 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_31'Address);
+ end Rcheck_31;
+
+ procedure Rcheck_32 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_32'Address);
+ end Rcheck_32;
+
+ -------------
+ -- Reraise --
+ -------------
+
+ procedure Reraise is
+ Excep : constant EOA := Get_Current_Excep.all;
+
+ begin
+ Abort_Defer.all;
+ Exception_Propagation.Setup_Exception (Excep, Excep, Reraised => True);
+ Raise_Current_Excep (Excep.Id);
+ end Reraise;
+
+ ------------------------
+ -- Reraise_Occurrence --
+ ------------------------
+
+ procedure Reraise_Occurrence (X : Exception_Occurrence) is
+ begin
+ if X.Id /= null then
+ Abort_Defer.all;
+ Exception_Propagation.Setup_Exception
+ (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
+ Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+ Raise_Current_Excep (X.Id);
+ end if;
+ end Reraise_Occurrence;
+
+ -------------------------------
+ -- Reraise_Occurrence_Always --
+ -------------------------------
+
+ procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
+ begin
+ Abort_Defer.all;
+ Exception_Propagation.Setup_Exception
+ (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
+ Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+ Raise_Current_Excep (X.Id);
+ end Reraise_Occurrence_Always;
+
+ ---------------------------------
+ -- Reraise_Occurrence_No_Defer --
+ ---------------------------------
+
+ procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
+ begin
+ Exception_Propagation.Setup_Exception
+ (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
+ Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
+ Raise_Current_Excep (X.Id);
+ end Reraise_Occurrence_No_Defer;
+
+ ---------------------
+ -- Save_Occurrence --
+ ---------------------
+
+ procedure Save_Occurrence
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence)
+ is
+ begin
+ Save_Occurrence_No_Private (Target, Source);
+ end Save_Occurrence;
+
+ function Save_Occurrence (Source : Exception_Occurrence) return EOA is
+ Target : constant EOA := new Exception_Occurrence;
+ begin
+ Save_Occurrence (Target.all, Source);
+ return Target;
+ end Save_Occurrence;
+
+ --------------------------------
+ -- Save_Occurrence_No_Private --
+ --------------------------------
+
+ procedure Save_Occurrence_No_Private
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence)
+ is
+ begin
+ Target.Id := Source.Id;
+ Target.Msg_Length := Source.Msg_Length;
+ Target.Num_Tracebacks := Source.Num_Tracebacks;
+ Target.Pid := Source.Pid;
+ Target.Cleanup_Flag := Source.Cleanup_Flag;
+
+ Target.Msg (1 .. Target.Msg_Length) :=
+ Source.Msg (1 .. Target.Msg_Length);
+
+ Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
+ Source.Tracebacks (1 .. Target.Num_Tracebacks);
+ end Save_Occurrence_No_Private;
+
+ -------------------------
+ -- Transfer_Occurrence --
+ -------------------------
+
+ procedure Transfer_Occurrence
+ (Target : Exception_Occurrence_Access;
+ Source : Exception_Occurrence)
+ is
+ begin
+ -- Setup Target as an exception to be propagated in the calling task
+ -- (rendezvous-wise), taking care not to clobber the associated private
+ -- data. Target is expected to be a pointer to the calling task's
+ -- fixed TSD occurrence, which is very different from Get_Current_Excep
+ -- here because this subprogram is called from the called task.
+
+ Exception_Propagation.Setup_Exception (Target, Target);
+ Save_Occurrence_No_Private (Target.all, Source);
+ end Transfer_Occurrence;
+
+ -------------------
+ -- String_To_EId --
+ -------------------
+
+ function String_To_EId (S : String) return Exception_Id
+ renames Stream_Attributes.String_To_EId;
+
+ ------------------
+ -- String_To_EO --
+ ------------------
+
+ function String_To_EO (S : String) return Exception_Occurrence
+ renames Stream_Attributes.String_To_EO;
+
+ ------------------------------
+ -- Raise_Exception_No_Defer --
+ ------------------------------
+
+ procedure Raise_Exception_No_Defer
+ (E : Exception_Id;
+ Message : String := "")
+ is
+ begin
+ Exception_Data.Set_Exception_Msg (E, Message);
+
+ -- Do not call Abort_Defer.all, as specified by the spec
+
+ Raise_Current_Excep (E);
+ end Raise_Exception_No_Defer;
+
+ ---------------
+ -- To_Stderr --
+ ---------------
+
+ procedure To_Stderr (C : Character) is
+
+ type int is new Integer;
+
+ procedure put_char_stderr (C : int);
+ pragma Import (C, put_char_stderr, "put_char_stderr");
+
+ begin
+ put_char_stderr (Character'Pos (C));
+ end To_Stderr;
+
+ procedure To_Stderr (S : String) is
+ begin
+ for J in S'Range loop
+ if S (J) /= ASCII.CR then
+ To_Stderr (S (J));
+ end if;
+ end loop;
+ end To_Stderr;
+
+ -------------------------
+ -- Wide_Exception_Name --
+ -------------------------
+
+ WC_Encoding : Character;
+ pragma Import (C, WC_Encoding, "__gl_wc_encoding");
+ -- Encoding method for source, as exported by binder
+
+ function Wide_Exception_Name
+ (Id : Exception_Id) return Wide_String is
+ begin
+ return String_To_Wide_String
+ (Exception_Name (Id), Get_WC_Encoding_Method (WC_Encoding));
+ end Wide_Exception_Name;
+
+ function Wide_Exception_Name
+ (X : Exception_Occurrence) return Wide_String is
+ begin
+ return String_To_Wide_String
+ (Exception_Name (X), Get_WC_Encoding_Method (WC_Encoding));
+ end Wide_Exception_Name;
+
+ ----------------------------
+ -- Wide_Wide_Exception_Name --
+ -----------------------------
+
+ function Wide_Wide_Exception_Name
+ (Id : Exception_Id) return Wide_Wide_String
+ is
+ begin
+ return String_To_Wide_Wide_String
+ (Exception_Name (Id), Get_WC_Encoding_Method (WC_Encoding));
+ end Wide_Wide_Exception_Name;
+
+ function Wide_Wide_Exception_Name
+ (X : Exception_Occurrence) return Wide_Wide_String
+ is
+ begin
+ return String_To_Wide_Wide_String
+ (Exception_Name (X), Get_WC_Encoding_Method (WC_Encoding));
+ end Wide_Wide_Exception_Name;
+
+ --------------------------
+ -- Code_Address_For_ZZZ --
+ --------------------------
+
+ -- 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!
+
+ function Code_Address_For_ZZZ return System.Address is
+ begin
+ <<Start_Of_ZZZ>>
+ return Start_Of_ZZZ'Address;
+ end Code_Address_For_ZZZ;
+
+end Ada.Exceptions;
diff --git a/gcc/ada/a-except-2005.ads b/gcc/ada/a-except-2005.ads
new file mode 100644
index 00000000000..ff06e9801a0
--- /dev/null
+++ b/gcc/ada/a-except-2005.ads
@@ -0,0 +1,335 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . E X C E P T I O N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005, 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This version is used for all Ada 2005 builds. It differs from a-except.ads
+-- only with respect to the addition of Wide_[Wide]Exception_Name functions.
+-- The additional entities are marked with pragma Ada_05, so this extended
+-- unit is also perfectly suitable for use in Ada 95 or Ada 83 mode.
+
+-- The reason for this splitting off of a separate version is that bootstrap
+-- compilers often will be used that do not support Ada 2005 features, and
+-- Ada.Exceptions is part of the compiler sources.
+
+-- The base version of this unit Ada.Exceptions omits the Wide version of
+-- Exception_Name and is used to build the compiler and other basic tools.
+
+pragma Polling (Off);
+-- We must turn polling off for this unit, because otherwise we get
+-- elaboration circularities with ourself.
+
+with System;
+with System.Parameters;
+with System.Standard_Library;
+with System.Traceback_Entries;
+
+package Ada.Exceptions is
+ pragma Warnings (Off);
+ pragma Preelaborate_05;
+ pragma Warnings (On);
+ -- In accordance with Ada 2005 AI-362. The warnings pragmas are so that we
+ -- can compile this using older compiler versions, which will ignore the
+ -- pragma, which is fine for the bootstrap.
+
+ type Exception_Id is private;
+ Null_Id : constant Exception_Id;
+
+ type Exception_Occurrence is limited private;
+ type Exception_Occurrence_Access is access all Exception_Occurrence;
+
+ Null_Occurrence : constant Exception_Occurrence;
+
+ function Exception_Name (Id : Exception_Id) return String;
+
+ function Exception_Name (X : Exception_Occurrence) return String;
+
+ function Wide_Exception_Name
+ (Id : Exception_Id) return Wide_String;
+ pragma Ada_05 (Wide_Exception_Name);
+
+ function Wide_Exception_Name
+ (X : Exception_Occurrence) return Wide_String;
+ pragma Ada_05 (Wide_Exception_Name);
+
+ function Wide_Wide_Exception_Name
+ (Id : Exception_Id) return Wide_Wide_String;
+ pragma Ada_05 (Wide_Wide_Exception_Name);
+
+ function Wide_Wide_Exception_Name
+ (X : Exception_Occurrence) return Wide_Wide_String;
+ pragma Ada_05 (Wide_Wide_Exception_Name);
+
+ procedure Raise_Exception (E : Exception_Id; Message : String := "");
+ -- Note: it would be really nice to give a pragma No_Return for this
+ -- procedure, but it would be wrong, since Raise_Exception does return
+ -- if given the null exception. However we do special case the name in
+ -- the test in the compiler for issuing a warning for a missing return
+ -- after this call. Program_Error seems reasonable enough in such a case.
+ -- See also the routine Raise_Exception_Always in the private part.
+
+ function Exception_Message (X : Exception_Occurrence) return String;
+
+ procedure Reraise_Occurrence (X : Exception_Occurrence);
+ -- Note: it would be really nice to give a pragma No_Return for this
+ -- procedure, but it would be wrong, since Reraise_Occurrence does return
+ -- if the argument is the null exception occurrence. See also procedure
+ -- Reraise_Occurrence_Always in the private part of this package.
+
+ function Exception_Identity (X : Exception_Occurrence) return Exception_Id;
+
+ function Exception_Information (X : Exception_Occurrence) return String;
+ -- The format of the exception information is as follows:
+ --
+ -- exception name (as in Exception_Name)
+ -- message (or a null line if no message)
+ -- PID=nnnn
+ -- 0xyyyyyyyy 0xyyyyyyyy ...
+ --
+ -- The lines are separated by a ASCII.LF character
+ -- The nnnn is the partition Id given as decimal digits.
+ -- The 0x... line represents traceback program counter locations,
+ -- in order with the first one being the exception location.
+
+ -- Note on ordering: the compiler uses the Save_Occurrence procedure, but
+ -- not the function from Rtsfind, so it is important that the procedure
+ -- come first, since Rtsfind finds the first matching entity.
+
+ procedure Save_Occurrence
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence);
+
+ function Save_Occurrence
+ (Source : Exception_Occurrence)
+ return Exception_Occurrence_Access;
+
+private
+ package SSL renames System.Standard_Library;
+ package SP renames System.Parameters;
+
+ subtype EOA is Exception_Occurrence_Access;
+
+ Exception_Msg_Max_Length : constant := SP.Default_Exception_Msg_Max_Length;
+
+ ------------------
+ -- Exception_Id --
+ ------------------
+
+ subtype Code_Loc is System.Address;
+ -- Code location used in building exception tables and for call addresses
+ -- when propagating an exception. Values of this type are created by using
+ -- Label'Address or extracted from machine states using Get_Code_Loc.
+
+ Null_Loc : constant Code_Loc := System.Null_Address;
+ -- Null code location, used to flag outer level frame
+
+ type Exception_Id is new SSL.Exception_Data_Ptr;
+
+ function EId_To_String (X : Exception_Id) return String;
+ function String_To_EId (S : String) return Exception_Id;
+ pragma Stream_Convert (Exception_Id, String_To_EId, EId_To_String);
+ -- Functions for implementing Exception_Id stream attributes
+
+ Null_Id : constant Exception_Id := null;
+
+ -------------------------
+ -- Private Subprograms --
+ -------------------------
+
+ function Current_Target_Exception return Exception_Occurrence;
+ pragma Export
+ (Ada, Current_Target_Exception,
+ "__gnat_current_target_exception");
+ -- This routine should return the current raised exception on targets
+ -- which have built-in exception handling such as the Java Virtual
+ -- Machine. For other targets this routine is simply ignored. Currently,
+ -- only JGNAT uses this. See 4jexcept.ads for details. The pragma Export
+ -- allows this routine to be accessed elsewhere in the run-time, even
+ -- though it is in the private part of this package (it is not allowed
+ -- to be in the visible part, since this is set by the reference manual).
+
+ function Exception_Name_Simple (X : Exception_Occurrence) return String;
+ -- Like Exception_Name, but returns the simple non-qualified name of the
+ -- exception. This is used to implement the Exception_Name function in
+ -- Current_Exceptions (the DEC compatible unit). It is called from the
+ -- compiler generated code (using Rtsfind, which does not respect the
+ -- private barrier, so we can place this function in the private part
+ -- where the compiler can find it, but the spec is unchanged.)
+
+ procedure Raise_Exception_Always (E : Exception_Id; Message : String := "");
+ pragma No_Return (Raise_Exception_Always);
+ pragma Export (Ada, Raise_Exception_Always, "__gnat_raise_exception");
+ -- This differs from Raise_Exception only in that the caller has determined
+ -- that for sure the parameter E is not null, and that therefore the call
+ -- to this procedure cannot return. The expander converts Raise_Exception
+ -- calls to Raise_Exception_Always if it can determine this is the case.
+ -- The Export allows this routine to be accessed from Pure units.
+
+ procedure Raise_From_Signal_Handler
+ (E : Exception_Id;
+ M : System.Address);
+ pragma Export
+ (Ada, Raise_From_Signal_Handler,
+ "ada__exceptions__raise_from_signal_handler");
+ pragma No_Return (Raise_From_Signal_Handler);
+ -- This routine is used to raise an exception from a signal handler. The
+ -- signal handler has already stored the machine state (i.e. the state that
+ -- corresponds to the location at which the signal was raised). E is the
+ -- Exception_Id specifying what exception is being raised, and M is a
+ -- pointer to a null-terminated string which is the message to be raised.
+ -- Note that this routine never returns, so it is permissible to simply
+ -- jump to this routine, rather than call it. This may be appropriate for
+ -- systems where the right way to get out of signal handler is to alter the
+ -- PC value in the machine state or in some other way ask the operating
+ -- system to return here rather than to the original location.
+
+ procedure Reraise_Occurrence_Always (X : Exception_Occurrence);
+ pragma No_Return (Reraise_Occurrence_Always);
+ -- This differs from Raise_Occurrence only in that the caller guarantees
+ -- that for sure the parameter X is not the null occurrence, and that
+ -- therefore this procedure cannot return. The expander uses this routine
+ -- in the translation of a raise statement with no parameter (reraise).
+
+ procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence);
+ pragma No_Return (Reraise_Occurrence_No_Defer);
+ -- Exactly like Reraise_Occurrence, except that abort is not deferred
+ -- before the call and the parameter X is known not to be the null
+ -- occurrence. This is used in generated code when it is known that
+ -- abort is already deferred.
+
+ -----------------------
+ -- Polling Interface --
+ -----------------------
+
+ -- The GNAT compiler has an option to generate polling calls to the Poll
+ -- routine in this package. Specifying the -gnatP option for a compilation
+ -- causes a call to Ada.Exceptions.Poll to be generated on every subprogram
+ -- entry and on every iteration of a loop, thus avoiding the possibility of
+ -- a case of unbounded time between calls.
+
+ -- This polling interface may be used for instrumentation or debugging
+ -- purposes (e.g. implementing watchpoints in software or in the debugger).
+
+ -- In the GNAT technology itself, this interface is used to implement
+ -- immediate aynschronous transfer of control and immediate abort on
+ -- targets which do not provide for one thread interrupting another.
+
+ -- 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!
+
+ procedure Poll;
+ -- Check for asynchronous abort. Note that we do not inline the body.
+ -- This makes the interface more useful for debugging purposes.
+
+ --------------------------
+ -- Exception_Occurrence --
+ --------------------------
+
+ package TBE renames System.Traceback_Entries;
+
+ Max_Tracebacks : constant := 50;
+ -- Maximum number of trace backs stored in exception occurrence
+
+ type Tracebacks_Array is array (1 .. Max_Tracebacks) of TBE.Traceback_Entry;
+ -- Traceback array stored in exception occurrence
+
+ type Exception_Occurrence is record
+ Id : Exception_Id;
+ -- Exception_Identity for this exception occurrence
+ -- WARNING System.System.Finalization_Implementation.Finalize_List
+ -- relies on the fact that this field is always first in the exception
+ -- occurrence
+
+ Msg_Length : Natural := 0;
+ -- Length of message (zero = no message)
+
+ Msg : String (1 .. Exception_Msg_Max_Length);
+ -- Characters of message
+
+ Cleanup_Flag : Boolean := False;
+ -- The cleanup flag is normally False, it is set True for an exception
+ -- occurrence passed to a cleanup routine, and will still be set True
+ -- when the cleanup routine does a Reraise_Occurrence call using this
+ -- exception occurrence. This is used to avoid recording a bogus trace
+ -- back entry from this reraise call.
+
+ Exception_Raised : Boolean := False;
+ -- Set to true to indicate that this exception occurrence has actually
+ -- been raised. When an exception occurrence is first created, this is
+ -- set to False, then when it is processed by Raise_Current_Exception,
+ -- it is set to True. If Raise_Current_Exception is used to raise an
+ -- exception for which this flag is already True, then it knows that
+ -- it is dealing with the reraise case (which is useful to distinguish
+ -- for exception tracing purposes).
+
+ Pid : Natural := 0;
+ -- Partition_Id for partition raising exception
+
+ Num_Tracebacks : Natural range 0 .. Max_Tracebacks := 0;
+ -- Number of traceback entries stored
+
+ Tracebacks : Tracebacks_Array;
+ -- Stored tracebacks (in Tracebacks (1 .. Num_Tracebacks))
+
+ Private_Data : System.Address := System.Null_Address;
+ -- Field used by low level exception mechanism to store specific data.
+ -- Currently used by the GCC exception mechanism to store a pointer to
+ -- a GNAT_GCC_Exception.
+ end record;
+
+ function "=" (Left, Right : Exception_Occurrence) return Boolean
+ is abstract;
+ -- Don't allow comparison on exception occurrences, we should not need
+ -- this, and it would not work right, because of the Msg and Tracebacks
+ -- fields which have unused entries not copied by Save_Occurrence.
+
+ function EO_To_String (X : Exception_Occurrence) return String;
+ function String_To_EO (S : String) return Exception_Occurrence;
+ pragma Stream_Convert (Exception_Occurrence, String_To_EO, EO_To_String);
+ -- Functions for implementing Exception_Occurrence stream attributes
+
+ Null_Occurrence : constant Exception_Occurrence := (
+ Id => null,
+ Msg_Length => 0,
+ Msg => (others => ' '),
+ Cleanup_Flag => False,
+ Exception_Raised => False,
+ Pid => 0,
+ Num_Tracebacks => 0,
+ Tracebacks => (others => TBE.Null_TB_Entry),
+ Private_Data => System.Null_Address);
+
+end Ada.Exceptions;
diff --git a/gcc/ada/a-except.adb b/gcc/ada/a-except.adb
index fb14eda5b08..2539501f172 100644
--- a/gcc/ada/a-except.adb
+++ b/gcc/ada/a-except.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
@@ -31,6 +31,15 @@
-- --
------------------------------------------------------------------------------
+-- This version of Ada.Exceptions is a full Ada 95 version, but lacks the
+-- additional definitions of Exception_Name returning Wide_[Wide_]String.
+-- It is used for building the compiler and the basic tools, since these
+-- builds may be done with bootstrap compilers that cannot handle these
+-- additions. The full version of Ada.Exceptions can be found in the files
+-- a-except-2005.ads/adb, and is used for all other builds where full Ada
+-- 2005 functionality is required. in particular, it is used for building
+-- run times on all targets.
+
pragma Polling (Off);
-- We must turn polling off for this unit, because otherwise we get
-- elaboration circularities with System.Exception_Tables.
@@ -54,45 +63,11 @@ package body Ada.Exceptions is
-- from C clients using the given external name, even though they are not
-- technically visible in the Ada sense.
- function Code_Address_For_AAA return System.Address;
- function Code_Address_For_ZZZ return System.Address;
- -- Return start and end of procedures in this package
- --
- -- These procedures are used to provide exclusion bounds in
- -- calls to Call_Chain at exception raise points from this unit. The
- -- purpose is to arrange for the exception tracebacks not to include
- -- frames from routines involved in the raise process, as these are
- -- meaningless from the user's standpoint.
- --
- -- For these bounds to be meaningful, we need to ensure that the object
- -- code for the routines involved in processing a raise is located after
- -- the object code Code_Address_For_AAA and before the object code
- -- Code_Address_For_ZZZ. This will indeed be the case as long as the
- -- following rules are respected:
- --
- -- 1) The bodies of the subprograms involved in processing a raise
- -- are located after the body of Code_Address_For_AAA and before the
- -- body of Code_Address_For_ZZZ.
- --
- -- 2) No pragma Inline applies to any of these subprograms, as this
- -- could delay the corresponding assembly output until the end of
- -- the unit.
-
- procedure Call_Chain (Excep : EOA);
- -- Store up to Max_Tracebacks in Excep, corresponding to the current
- -- call chain.
-
- procedure Process_Raise_Exception
- (E : Exception_Id;
- From_Signal_Handler : Boolean);
+ procedure Process_Raise_Exception (E : Exception_Id);
pragma No_Return (Process_Raise_Exception);
-- This is the lowest level raise routine. It raises the exception
-- referenced by Current_Excep.all in the TSD, without deferring abort
-- (the caller must ensure that abort is deferred on entry).
- --
- -- This is the common implementation for Raise_Current_Excep and
- -- Raise_From_Signal_Handler. The origin of the call is indicated by the
- -- From_Signal_Handler argument.
procedure To_Stderr (S : String);
pragma Export (Ada, To_Stderr, "__gnat_to_stderr");
@@ -227,34 +202,11 @@ package body Ada.Exceptions is
package Exception_Propagation is
- use Exception_Traces;
- -- Imports Notify_Unhandled_Exception and
- -- Unhandled_Exception_Terminate
-
- ------------------------------------
- -- Exception propagation routines --
- ------------------------------------
-
procedure Setup_Exception
(Excep : EOA;
Current : EOA;
Reraised : Boolean := False);
- -- Perform the necessary operations to prepare the propagation of Excep
- -- in a task where Current is the current occurrence. Excep is assumed
- -- to be a valid (non null) pointer.
- --
- -- This should be called before any (re-)setting of the current
- -- occurrence. Any such (re-)setting shall take care *not* to clobber
- -- the Private_Data component.
- --
- -- Having Current provided as an argument (instead of retrieving it via
- -- Get_Current_Excep internally) is required to allow one task to setup
- -- an exception for another task, which is used by Transfer_Occurrence.
-
- procedure Propagate_Exception (From_Signal_Handler : Boolean);
- pragma No_Return (Propagate_Exception);
- -- This procedure propagates the exception represented by the occurrence
- -- referenced by Current_Excep in the TSD for the current task.
+ -- Dummy routine used to share a-exexda.adb, do nothing.
end Exception_Propagation;
@@ -278,8 +230,7 @@ package body Ada.Exceptions is
procedure Raise_Current_Excep (E : Exception_Id);
pragma No_Return (Raise_Current_Excep);
pragma Export (C, Raise_Current_Excep, "__gnat_raise_nodefer_with_msg");
- -- This is a simple wrapper to Process_Raise_Exception setting the
- -- From_Signal_Handler argument to False.
+ -- This is a simple wrapper to Process_Raise_Exception.
--
-- This external name for Raise_Current_Excep is historical, and probably
-- should be changed but for now we keep it, because gdb and gigi know
@@ -453,6 +404,8 @@ package body Ada.Exceptions is
procedure Rcheck_28 (File : System.Address; Line : Integer);
procedure Rcheck_29 (File : System.Address; Line : Integer);
procedure Rcheck_30 (File : System.Address; Line : Integer);
+ procedure Rcheck_31 (File : System.Address; Line : Integer);
+ procedure Rcheck_32 (File : System.Address; Line : Integer);
pragma Export (C, Rcheck_00, "__gnat_rcheck_00");
pragma Export (C, Rcheck_01, "__gnat_rcheck_01");
@@ -485,6 +438,8 @@ package body Ada.Exceptions is
pragma Export (C, Rcheck_28, "__gnat_rcheck_28");
pragma Export (C, Rcheck_29, "__gnat_rcheck_29");
pragma Export (C, Rcheck_30, "__gnat_rcheck_30");
+ pragma Export (C, Rcheck_31, "__gnat_rcheck_31");
+ pragma Export (C, Rcheck_32, "__gnat_rcheck_32");
-- None of these procedures ever returns (they raise an exception!). By
-- using pragma No_Return, we ensure that any junk code after the call,
@@ -521,6 +476,7 @@ package body Ada.Exceptions is
pragma No_Return (Rcheck_28);
pragma No_Return (Rcheck_29);
pragma No_Return (Rcheck_30);
+ pragma No_Return (Rcheck_32);
---------------------------------------------
-- Reason Strings for Run-Time Check Calls --
@@ -539,30 +495,32 @@ package body Ada.Exceptions is
Rmsg_05 : constant String := "index check failed" & NUL;
Rmsg_06 : constant String := "invalid data" & NUL;
Rmsg_07 : constant String := "length check failed" & NUL;
- Rmsg_08 : constant String := "null-exclusion check failed" & NUL;
- Rmsg_09 : constant String := "overflow check failed" & NUL;
- Rmsg_10 : constant String := "partition check failed" & NUL;
- Rmsg_11 : constant String := "range check failed" & NUL;
- Rmsg_12 : constant String := "tag check failed" & NUL;
- Rmsg_13 : constant String := "access before elaboration" & NUL;
- Rmsg_14 : constant String := "accessibility check failed" & NUL;
- Rmsg_15 : constant String := "all guards closed" & NUL;
- Rmsg_16 : constant String := "duplicated entry address" & NUL;
- Rmsg_17 : constant String := "explicit raise" & NUL;
- Rmsg_18 : constant String := "finalize/adjust raised exception" & NUL;
- Rmsg_19 : constant String := "misaligned address value" & NUL;
- Rmsg_20 : constant String := "missing return" & NUL;
- Rmsg_21 : constant String := "overlaid controlled object" & NUL;
- Rmsg_22 : constant String := "potentially blocking operation" & NUL;
- Rmsg_23 : constant String := "stubbed subprogram called" & NUL;
- Rmsg_24 : constant String := "unchecked union restriction" & NUL;
- Rmsg_25 : constant String := "illegal use of"
- & " remote access-to-class-wide type, see RM E.4(18)" & NUL;
- Rmsg_26 : constant String := "empty storage pool" & NUL;
- Rmsg_27 : constant String := "explicit raise" & NUL;
- Rmsg_28 : constant String := "infinite recursion" & NUL;
- Rmsg_29 : constant String := "object too large" & NUL;
- Rmsg_30 : constant String := "restriction violation" & NUL;
+ Rmsg_08 : constant String := "null Exception_Id" & NUL;
+ Rmsg_09 : constant String := "null-exclusion check failed" & NUL;
+ Rmsg_10 : constant String := "overflow check failed" & NUL;
+ Rmsg_11 : constant String := "partition check failed" & NUL;
+ Rmsg_12 : constant String := "range check failed" & NUL;
+ Rmsg_13 : constant String := "tag check failed" & NUL;
+ Rmsg_14 : constant String := "access before elaboration" & NUL;
+ Rmsg_15 : constant String := "accessibility check failed" & NUL;
+ Rmsg_16 : constant String := "all guards closed" & NUL;
+ Rmsg_17 : constant String := "duplicated entry address" & NUL;
+ Rmsg_18 : constant String := "explicit raise" & NUL;
+ Rmsg_19 : constant String := "finalize/adjust raised exception" & NUL;
+ Rmsg_20 : constant String := "implicit return with No_Return" & NUL;
+ Rmsg_21 : constant String := "misaligned address value" & NUL;
+ Rmsg_22 : constant String := "missing return" & NUL;
+ Rmsg_23 : constant String := "overlaid controlled object" & NUL;
+ Rmsg_24 : constant String := "potentially blocking operation" & NUL;
+ Rmsg_25 : constant String := "stubbed subprogram called" & NUL;
+ Rmsg_26 : constant String := "unchecked union restriction" & NUL;
+ Rmsg_27 : constant String := "illegal use of remote access-to-" &
+ "class-wide type, see RM E.4(18)" & NUL;
+ Rmsg_28 : constant String := "empty storage pool" & NUL;
+ Rmsg_29 : constant String := "explicit raise" & NUL;
+ Rmsg_30 : constant String := "infinite recursion" & NUL;
+ Rmsg_31 : constant String := "object too large" & NUL;
+ Rmsg_32 : constant String := "restriction violation" & NUL;
-----------------------
-- Polling Interface --
@@ -579,34 +537,6 @@ package body Ada.Exceptions is
-- The actual polling routine is separate, so that it can easily
-- be replaced with a target dependent version.
- --------------------------
- -- Code_Address_For_AAA --
- --------------------------
-
- -- 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!
-
- function Code_Address_For_AAA return System.Address is
- begin
- -- We are using a label instead of merely using
- -- Code_Address_For_AAA'Address because on some platforms the latter
- -- does not yield the address we want, but the address of a stub or of
- -- a descriptor instead. This is the case at least on Alpha-VMS and
- -- PA-HPUX.
-
- <<Start_Of_AAA>>
- return Start_Of_AAA'Address;
- end Code_Address_For_AAA;
-
- ----------------
- -- Call_Chain --
- ----------------
-
- procedure Call_Chain (Excep : EOA) is separate;
- -- The actual Call_Chain routine is separate, so that it can easily
- -- be dummied out when no exception traceback information is needed.
-
------------------------------
-- Current_Target_Exception --
------------------------------
@@ -728,14 +658,21 @@ package body Ada.Exceptions is
-- This package can be easily dummied out if we do not want the
-- basic support for exception messages (such as in Ada 83).
- ---------------------------
- -- Exception_Propagation --
- ---------------------------
+ package body Exception_Propagation is
+
+ procedure Setup_Exception
+ (Excep : EOA;
+ Current : EOA;
+ Reraised : Boolean := False)
+ is
+ pragma Warnings (Off, Excep);
+ pragma Warnings (Off, Current);
+ pragma Warnings (Off, Reraised);
+ begin
+ null;
+ end Setup_Exception;
- package body Exception_Propagation is separate;
- -- Depending on the actual exception mechanism used (front-end or
- -- back-end based), the implementation will differ, which is why this
- -- package is separated.
+ end Exception_Propagation;
----------------------
-- Exception_Traces --
@@ -759,12 +696,17 @@ package body Ada.Exceptions is
-- Process_Raise_Exception --
-----------------------------
- procedure Process_Raise_Exception
- (E : Exception_Id;
- From_Signal_Handler : Boolean)
- is
+ procedure Process_Raise_Exception (E : Exception_Id) is
pragma Inspection_Point (E);
-- This is so the debugger can reliably inspect the parameter
+
+ Jumpbuf_Ptr : constant Address := Get_Jmpbuf_Address.all;
+ Excep : constant EOA := Get_Current_Excep.all;
+
+ procedure builtin_longjmp (buffer : Address; Flag : Integer);
+ pragma No_Return (builtin_longjmp);
+ pragma Import (C, builtin_longjmp, "_gnat_builtin_longjmp");
+
begin
-- WARNING: There should be no exception handler for this body
-- because this would cause gigi to prepend a setup for a new
@@ -773,7 +715,23 @@ package body Ada.Exceptions is
-- one for the exception we are handling, which would completely break
-- the whole design of this procedure.
- Exception_Propagation.Propagate_Exception (From_Signal_Handler);
+ -- If the jump buffer pointer is non-null, transfer control using
+ -- it. Otherwise announce an unhandled exception (note that this
+ -- means that we have no finalizations to do other than at the outer
+ -- level). Perform the necessary notification tasks in both cases.
+
+ if Jumpbuf_Ptr /= Null_Address then
+ if not Excep.Exception_Raised then
+ Excep.Exception_Raised := True;
+ Exception_Traces.Notify_Handled_Exception;
+ end if;
+
+ builtin_longjmp (Jumpbuf_Ptr, 1);
+
+ else
+ Exception_Traces.Notify_Unhandled_Exception;
+ Exception_Traces.Unhandled_Exception_Terminate;
+ end if;
end Process_Raise_Exception;
----------------------------
@@ -826,7 +784,7 @@ package body Ada.Exceptions is
-- pragma Volatile is peculiar!
begin
- Process_Raise_Exception (E => E, From_Signal_Handler => False);
+ Process_Raise_Exception (E);
end Raise_Current_Excep;
---------------------
@@ -843,6 +801,14 @@ package body Ada.Exceptions is
Abort_Defer.all;
Raise_Current_Excep (E);
end if;
+
+ -- Note: if E is null, then we simply return, which is correct Ada 95
+ -- semantics. If we are operating in Ada 2005 mode, then the expander
+ -- generates a raise Constraint_Error immediately following the call
+ -- to provide the required Ada 2005 semantics (see AI-329). We do it
+ -- this way to avoid having run time dependencies on the Ada version.
+
+ return;
end Raise_Exception;
----------------------------
@@ -870,7 +836,7 @@ package body Ada.Exceptions is
begin
Exception_Data.Set_Exception_C_Msg (E, M);
Abort_Defer.all;
- Process_Raise_Exception (E => E, From_Signal_Handler => True);
+ Process_Raise_Exception (E);
end Raise_From_Signal_Handler;
-------------------------
@@ -951,8 +917,6 @@ package body Ada.Exceptions is
Excep : constant EOA := Get_Current_Excep.all;
begin
- Exception_Propagation.Setup_Exception (Excep, Excep);
-
Excep.Exception_Raised := False;
Excep.Id := E;
Excep.Num_Tracebacks := 0;
@@ -1033,7 +997,7 @@ package body Ada.Exceptions is
procedure Rcheck_13 (File : System.Address; Line : Integer) is
begin
- Raise_Program_Error_Msg (File, Line, Rmsg_13'Address);
+ Raise_Constraint_Error_Msg (File, Line, Rmsg_13'Address);
end Rcheck_13;
procedure Rcheck_14 (File : System.Address; Line : Integer) is
@@ -1098,12 +1062,12 @@ package body Ada.Exceptions is
procedure Rcheck_26 (File : System.Address; Line : Integer) is
begin
- Raise_Storage_Error_Msg (File, Line, Rmsg_26'Address);
+ Raise_Program_Error_Msg (File, Line, Rmsg_26'Address);
end Rcheck_26;
procedure Rcheck_27 (File : System.Address; Line : Integer) is
begin
- Raise_Storage_Error_Msg (File, Line, Rmsg_27'Address);
+ Raise_Program_Error_Msg (File, Line, Rmsg_27'Address);
end Rcheck_27;
procedure Rcheck_28 (File : System.Address; Line : Integer) is
@@ -1121,6 +1085,16 @@ package body Ada.Exceptions is
Raise_Storage_Error_Msg (File, Line, Rmsg_30'Address);
end Rcheck_30;
+ procedure Rcheck_31 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_31'Address);
+ end Rcheck_31;
+
+ procedure Rcheck_32 (File : System.Address; Line : Integer) is
+ begin
+ Raise_Storage_Error_Msg (File, Line, Rmsg_32'Address);
+ end Rcheck_32;
+
-------------
-- Reraise --
-------------
@@ -1130,7 +1104,6 @@ package body Ada.Exceptions is
begin
Abort_Defer.all;
- Exception_Propagation.Setup_Exception (Excep, Excep, Reraised => True);
Raise_Current_Excep (Excep.Id);
end Reraise;
@@ -1142,8 +1115,6 @@ package body Ada.Exceptions is
begin
if X.Id /= null then
Abort_Defer.all;
- Exception_Propagation.Setup_Exception
- (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
Raise_Current_Excep (X.Id);
end if;
@@ -1156,8 +1127,6 @@ package body Ada.Exceptions is
procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
begin
Abort_Defer.all;
- Exception_Propagation.Setup_Exception
- (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
Raise_Current_Excep (X.Id);
end Reraise_Occurrence_Always;
@@ -1168,8 +1137,6 @@ package body Ada.Exceptions is
procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
begin
- Exception_Propagation.Setup_Exception
- (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
Raise_Current_Excep (X.Id);
end Reraise_Occurrence_No_Defer;
@@ -1230,7 +1197,6 @@ package body Ada.Exceptions is
-- fixed TSD occurrence, which is very different from Get_Current_Excep
-- here because this subprogram is called from the called task.
- Exception_Propagation.Setup_Exception (Target, Target);
Save_Occurrence_No_Private (Target.all, Source);
end Transfer_Occurrence;
@@ -1288,18 +1254,4 @@ package body Ada.Exceptions is
end loop;
end To_Stderr;
- --------------------------
- -- Code_Address_For_ZZZ --
- --------------------------
-
- -- 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!
-
- function Code_Address_For_ZZZ return System.Address is
- begin
- <<Start_Of_ZZZ>>
- return Start_Of_ZZZ'Address;
- end Code_Address_For_ZZZ;
-
end Ada.Exceptions;
diff --git a/gcc/ada/a-except.ads b/gcc/ada/a-except.ads
index fae4d4a4386..e010c56a9f0 100644
--- a/gcc/ada/a-except.ads
+++ b/gcc/ada/a-except.ads
@@ -35,6 +35,15 @@
-- --
------------------------------------------------------------------------------
+-- This version of Ada.Exceptions is a full Ada 95 version, but lacks the
+-- additional definitions of Exception_Name returning Wide_[Wide_]String.
+-- It is used for building the compiler and the basic tools, since these
+-- builds may be done with bootstrap compilers that cannot handle these
+-- additions. The full version of Ada.Exceptions can be found in the files
+-- a-except-2005.ads/adb, and is used for all other builds where full Ada
+-- 2005 functionality is required. in particular, it is used for building
+-- run times on all targets.
+
pragma Polling (Off);
-- We must turn polling off for this unit, because otherwise we get
-- elaboration circularities with ourself.
diff --git a/gcc/ada/a-exexpr-gcc.adb b/gcc/ada/a-exexpr-gcc.adb
index 22f057d18a4..fdec8d03995 100644
--- a/gcc/ada/a-exexpr-gcc.adb
+++ b/gcc/ada/a-exexpr-gcc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
@@ -532,7 +532,11 @@ package body Exception_Propagation is
-- Unwind_RaiseException to actually throw, taking care of handling
-- the two phase scheme it implements.
- procedure Propagate_Exception (From_Signal_Handler : Boolean) is
+ procedure Propagate_Exception
+ (E : Exception_Id;
+ From_Signal_Handler : Boolean)
+ is
+ pragma Inspection_Point (E);
pragma Unreferenced (From_Signal_Handler);
Excep : constant EOA := Get_Current_Excep.all;
diff --git a/gcc/ada/a-exexpr.adb b/gcc/ada/a-exexpr.adb
index 165b5cef3d8..1a300b57e5b 100644
--- a/gcc/ada/a-exexpr.adb
+++ b/gcc/ada/a-exexpr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006 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- --
@@ -69,7 +69,12 @@ package body Exception_Propagation is
-- Propagate_Exception --
-------------------------
- procedure Propagate_Exception (From_Signal_Handler : Boolean) is
+ procedure Propagate_Exception
+ (E : Exception_Id;
+ From_Signal_Handler : Boolean)
+ is
+ pragma Inspection_Point (E);
+
Jumpbuf_Ptr : constant Address := Get_Jmpbuf_Address.all;
Excep : constant EOA := Get_Current_Excep.all;
begin
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index 5d8fc0d273d..08459060345 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006, 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- --
@@ -26,7 +26,7 @@
with ALI; use ALI;
with Csets;
-with Gnatvsn;
+with Gnatvsn; use Gnatvsn;
with Makeutl;
with MLib.Tgt; use MLib.Tgt;
with Namet; use Namet;
@@ -1288,8 +1288,11 @@ package body Clean is
begin
if not Copyright_Displayed then
Copyright_Displayed := True;
- Put_Line ("GNATCLEAN " & Gnatvsn.Gnat_Version_String
- & " Copyright 2003-2005 Free Software Foundation, Inc.");
+ Put_Line
+ ("GNATCLEAN " & Gnatvsn.Gnat_Version_String
+ & " Copyright 2003-"
+ & Current_Year
+ & " Free Software Foundation, Inc.");
end if;
end Display_Copyright;
@@ -1308,7 +1311,6 @@ package body Clean is
procedure Extract_From_Q (Lib_File : out File_Name_Type) is
Lib : constant File_Name_Type := Q.Table (Q_Front);
-
begin
Q_Front := Q_Front + 1;
Lib_File := Lib;
@@ -1501,12 +1503,27 @@ package body Clean is
if not Initialized then
Initialized := True;
+ -- Get default search directories to locate system.ads when calling
+ -- Targparm.Get_Target_Parameters.
+
+ Osint.Add_Default_Search_Dirs;
+
-- Initialize some packages
Csets.Initialize;
Namet.Initialize;
Snames.Initialize;
Prj.Initialize (Project_Tree);
+
+ -- Check if the platform is VMS and, if it is, change some variables
+
+ Targparm.Get_Target_Parameters;
+
+ if OpenVMS_On_Target then
+ Debug_Suffix (Debug_Suffix'First) := '_';
+ Repinfo_Suffix (Repinfo_Suffix'First) := '_';
+ B_Start := new String'("b__");
+ end if;
end if;
-- Reset global variables
@@ -1897,11 +1914,4 @@ package body Clean is
New_Line;
end if;
end Usage;
-
-begin
- if OpenVMS_On_Target then
- Debug_Suffix (Debug_Suffix'First) := '_';
- Repinfo_Suffix (Repinfo_Suffix'First) := '_';
- B_Start := new String'("b__");
- end if;
end Clean;
diff --git a/gcc/ada/s-wchcon.adb b/gcc/ada/s-wchcon.adb
new file mode 100755
index 00000000000..ad55243fc3c
--- /dev/null
+++ b/gcc/ada/s-wchcon.adb
@@ -0,0 +1,51 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . W C H _ C O N --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2005, 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.WCh_Con is
+
+ ----------------------------
+ -- Get_WC_Encoding_Method --
+ ----------------------------
+
+ function Get_WC_Encoding_Method (C : Character) return WC_Encoding_Method is
+ begin
+ for Method in WC_Encoding_Method loop
+ if C = WC_Encoding_Letters (Method) then
+ return Method;
+ end if;
+ end loop;
+
+ raise Constraint_Error;
+ end Get_WC_Encoding_Method;
+
+end System.WCh_Con;
diff --git a/gcc/ada/s-wchcon.ads b/gcc/ada/s-wchcon.ads
index b5fdba04bfd..d0c9b8f307b 100644
--- a/gcc/ada/s-wchcon.ads
+++ b/gcc/ada/s-wchcon.ads
@@ -182,4 +182,8 @@ package System.WCh_Con is
-- The longest number of characters that can be used for a wide character
-- or wide wide character sequence for any of the active encoding methods.
+ function Get_WC_Encoding_Method (C : Character) return WC_Encoding_Method;
+ -- Given a character C, returns corresponding encoding method (see array
+ -- WC_Encoding_Letters above). Raises Constraint_Error if not in list.
+
end System.WCh_Con;
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index a2a9927be01..f29ec011b1a 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
@@ -725,7 +725,7 @@ package Types is
-----------------------------------
-- This section contains declarations of exceptions that are used
- -- throughout the compiler.
+ -- throughout the compiler or in other GNAT tools.
Unrecoverable_Error : exception;
-- This exception is raised to immediately terminate the compilation
@@ -734,6 +734,14 @@ package Types is
-- reached, or a required file is not found). Also raised when the
-- compiler finds itself in trouble after an error (see Comperr).
+ Terminate_Program : exception;
+ -- This exception is raised to immediately terminate the tool being
+ -- executed. Each tool where this exception may be raised must have
+ -- a single exception handler that contains only a null statement and
+ -- that is the last statement of the program. If needed, procedure
+ -- Set_Exit_Status is called with the appropriate exit status before
+ -- raising Terminate_Program.
+
---------------------------------
-- Parameter Mechanism Control --
---------------------------------
@@ -774,42 +782,45 @@ package Types is
-- the definition of last_reason_code.
-- 3. Add a new routine in Ada.Exceptions with the appropriate call
- -- and static string constant
-
- type RT_Exception_Code is (
- CE_Access_Check_Failed,
- CE_Access_Parameter_Is_Null,
- CE_Discriminant_Check_Failed,
- CE_Divide_By_Zero,
- CE_Explicit_Raise,
- CE_Index_Check_Failed,
- CE_Invalid_Data,
- CE_Length_Check_Failed,
- CE_Null_Not_Allowed,
- CE_Overflow_Check_Failed,
- CE_Partition_Check_Failed,
- CE_Range_Check_Failed,
- CE_Tag_Check_Failed,
-
- PE_Access_Before_Elaboration,
- PE_Accessibility_Check_Failed,
- PE_All_Guards_Closed,
- PE_Duplicated_Entry_Address,
- PE_Explicit_Raise,
- PE_Finalize_Raised_Exception,
- PE_Misaligned_Address_Value,
- PE_Missing_Return,
- PE_Overlaid_Controlled_Object,
- PE_Potentially_Blocking_Operation,
- PE_Stubbed_Subprogram_Called,
- PE_Unchecked_Union_Restriction,
- PE_Illegal_RACW_E_4_18,
-
- SE_Empty_Storage_Pool,
- SE_Explicit_Raise,
- SE_Infinite_Recursion,
- SE_Object_Too_Large,
- SE_Restriction_Violation);
+ -- and static string constant. Note that there is more than one
+ -- version of a-except.adb which must be modified.
+
+ type RT_Exception_Code is
+ (CE_Access_Check_Failed, -- 00
+ CE_Access_Parameter_Is_Null, -- 01
+ CE_Discriminant_Check_Failed, -- 02
+ CE_Divide_By_Zero, -- 03
+ CE_Explicit_Raise, -- 04
+ CE_Index_Check_Failed, -- 05
+ CE_Invalid_Data, -- 06
+ CE_Length_Check_Failed, -- 07
+ CE_Null_Exception_Id, -- 08
+ CE_Null_Not_Allowed, -- 09
+ CE_Overflow_Check_Failed, -- 10
+ CE_Partition_Check_Failed, -- 11
+ CE_Range_Check_Failed, -- 12
+ CE_Tag_Check_Failed, -- 13
+
+ PE_Access_Before_Elaboration, -- 14
+ PE_Accessibility_Check_Failed, -- 15
+ PE_All_Guards_Closed, -- 16
+ PE_Duplicated_Entry_Address, -- 17
+ PE_Explicit_Raise, -- 18
+ PE_Finalize_Raised_Exception, -- 19
+ PE_Implicit_Return, -- 20
+ PE_Misaligned_Address_Value, -- 21
+ PE_Missing_Return, -- 22
+ PE_Overlaid_Controlled_Object, -- 23
+ PE_Potentially_Blocking_Operation, -- 24
+ PE_Stubbed_Subprogram_Called, -- 25
+ PE_Unchecked_Union_Restriction, -- 26
+ PE_Illegal_RACW_E_4_18, -- 27
+
+ SE_Empty_Storage_Pool, -- 28
+ SE_Explicit_Raise, -- 29
+ SE_Infinite_Recursion, -- 30
+ SE_Object_Too_Large, -- 31
+ SE_Restriction_Violation); -- 32
subtype RT_CE_Exceptions is RT_Exception_Code range
CE_Access_Check_Failed ..
diff --git a/gcc/ada/types.h b/gcc/ada/types.h
index d1881127241..94f9b248042 100644
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -338,28 +338,32 @@ typedef Int Mechanism_Type;
#define CE_Index_Check_Failed 5
#define CE_Invalid_Data 6
#define CE_Length_Check_Failed 7
-#define CE_Null_Not_Allowed 8
-#define CE_Overflow_Check_Failed 9
-#define CE_Partition_Check_Failed 10
-#define CE_Range_Check_Failed 11
-#define CE_Tag_Check_Failed 12
-#define PE_Access_Before_Elaboration 13
-#define PE_Accessibility_Check_Failed 14
-#define PE_All_Guards_Closed 15
-#define PE_Duplicated_Entry_Address 16
-#define PE_Explicit_Raise 17
-#define PE_Finalize_Raised_Exception 18
-#define PE_Misaligned_Address_Value 19
-#define PE_Missing_Return 20
-#define PE_Overlaid_Controlled_Object 21
-#define PE_Potentially_Blocking_Operation 22
-#define PE_Stubbed_Subprogram_Called 23
-#define PE_Unchecked_Union_Restriction 24
-#define PE_Illegal_RACW_E_4_18 25
-#define SE_Empty_Storage_Pool 26
-#define SE_Explicit_Raise 27
-#define SE_Infinite_Recursion 28
-#define SE_Object_Too_Large 29
-#define SE_Restriction_Violation 30
-
-#define LAST_REASON_CODE 30
+#define CE_Null_Exception_Id 9
+#define CE_Null_Not_Allowed 9
+#define CE_Overflow_Check_Failed 10
+#define CE_Partition_Check_Failed 11
+#define CE_Range_Check_Failed 12
+#define CE_Tag_Check_Failed 13
+
+#define PE_Access_Before_Elaboration 14
+#define PE_Accessibility_Check_Failed 15
+#define PE_All_Guards_Closed 16
+#define PE_Duplicated_Entry_Address 17
+#define PE_Explicit_Raise 18
+#define PE_Finalize_Raised_Exception 19
+#define PE_Implicit_Return 20
+#define PE_Misaligned_Address_Value 21
+#define PE_Missing_Return 22
+#define PE_Overlaid_Controlled_Object 23
+#define PE_Potentially_Blocking_Operation 24
+#define PE_Stubbed_Subprogram_Called 25
+#define PE_Unchecked_Union_Restriction 26
+#define PE_Illegal_RACW_E_4_18 27
+
+#define SE_Empty_Storage_Pool 28
+#define SE_Explicit_Raise 29
+#define SE_Infinite_Recursion 30
+#define SE_Object_Too_Large 31
+#define SE_Restriction_Violation 32
+
+#define LAST_REASON_CODE 31