diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-10 14:59:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-10 14:59:03 +0000 |
commit | 12b2266af600824b8460918bd694233b07dd3f67 (patch) | |
tree | 565cfbb286832550c168bf426ddaad6fbe1e11e8 /exception_test3 | |
parent | 2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | ada-examples-12b2266af600824b8460918bd694233b07dd3f67.tar.bz2 |
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile: Add new tests. Most of these eitehr demonstrate or verify a
particular functionality.
* cpuuse/Makefile, cpuuse/cpuuse.adb, exception_test2/Makefile,
exception_test2/exceptiontest2.adb, exception_test3/Makefile,
exception_test3/exceptiontest3.adb: New files.
Diffstat (limited to 'exception_test3')
-rw-r--r-- | exception_test3/Makefile | 23 | ||||
-rw-r--r-- | exception_test3/exceptiontest3.adb | 27 |
2 files changed, 50 insertions, 0 deletions
diff --git a/exception_test3/Makefile b/exception_test3/Makefile new file mode 100644 index 0000000..9eb4917 --- /dev/null +++ b/exception_test3/Makefile @@ -0,0 +1,23 @@ +# +# See README.Makefiles in the main ada-examples directory. +# + +PROGRAM=exceptiontest3 + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(PROJECT_ROOT)/make/leaf.cfg + +# stack size for the first Ada thread +CFLAGS +=-DGNAT_MAIN_STACKSPACE=100 + +# initialize the network stack -- assumes existence of networkconfig.h +# CFLAGS +=-DMAIN_USE_NETWORKING=1 + +# Should we prompt for command line arguments? +# DEFINES +=-DMAIN_USE_REQUIRES_COMMAND_LINE + +# If you want to hard-code the command line, define this to a string +# DEFINES += -DMAIN_COMMAND_LINE="ARGS" + +include ../Makefile.shared diff --git a/exception_test3/exceptiontest3.adb b/exception_test3/exceptiontest3.adb new file mode 100644 index 0000000..be4bd1b --- /dev/null +++ b/exception_test3/exceptiontest3.adb @@ -0,0 +1,27 @@ +--BEGIN exceptiontest3.adb +with Ada.Text_IO; use Ada.Text_IO; + +procedure ExceptionTest3 is + function F return Boolean is + begin + raise Constraint_Error; + return True; + end F; +begin + begin + if F then + Put_Line ("Not ok"); + else + Put_Line ("Not ok and bad value"); + end if; + exception + when Constraint_Error => + Put_Line ("Caught Constraint_Error -- inner"); + when others => + Put_Line ("not ok wrong exception"); + end; +exception + when others => + Put_Line ("Caught Constraint_Error -- outer -- not OK"); +end ExceptionTest3; +--END exceptiontest3.adb |