From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/ada/acats/tests/c3/c393b12.a | 131 +++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 gcc/testsuite/ada/acats/tests/c3/c393b12.a (limited to 'gcc/testsuite/ada/acats/tests/c3/c393b12.a') diff --git a/gcc/testsuite/ada/acats/tests/c3/c393b12.a b/gcc/testsuite/ada/acats/tests/c3/c393b12.a new file mode 100644 index 000000000..5d1b46daa --- /dev/null +++ b/gcc/testsuite/ada/acats/tests/c3/c393b12.a @@ -0,0 +1,131 @@ +-- C393B12.A +-- +-- Grant of Unlimited Rights +-- +-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, +-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained +-- unlimited rights in the software and documentation contained herein. +-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making +-- this public release, the Government intends to confer upon all +-- recipients unlimited rights equal to those held by the Government. +-- These rights include rights to use, duplicate, release or disclose the +-- released technical data and computer software in whole or in part, in +-- any manner and for any purpose whatsoever, and to have or permit others +-- to do so. +-- +-- DISCLAIMER +-- +-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR +-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED +-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE +-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE +-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A +-- PARTICULAR PURPOSE OF SAID MATERIAL. +--* +-- +-- TEST OBJECTIVE: +-- Check that an extended type can be derived in the specification of a +-- generic package when the parent is an abstract type in a library +-- package. +-- +-- TEST DESCRIPTION: +-- Extend an abstract type in the visible part of a generic package. +-- Make all of the procedures which override abstract procedures +-- available as part of the generic interface. Instantiate the generic. +-- +-- TEST FILES: +-- This test depends on the following foundation code: +-- +-- F393B00.A Package Alert_Foundation +-- +-- +-- CHANGE HISTORY: +-- 06 Dec 94 SAIC ACVC 2.0 +-- 14 Oct 95 SAIC Update and repair for ACVC 2.0.1 +-- 27 Feb 97 PWB.CTA Add pragma Elaborate for C393B12_0. +--! + +----------------------------------------------------------------- C393B12_0 + +with F393B00; + -- Alert_Foundation +generic + type Generic_Status_Enum is (<>); + +package C393B12_0 is + -- Alert_Functions + + type Generic_Alert_Type is new F393B00.Alert with record + Status : Generic_Status_Enum := Generic_Status_Enum'First; + end record; + -- extension of an abstract type + + procedure Handle (GA : in out Generic_Alert_Type); + -- override of abstract procedure + + function Query_Status (GA : Generic_Alert_Type) + return Generic_Status_Enum; -- new primitive operation for + -- Generic_Alert_Type +end C393B12_0; + -- Alert_Functions + +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +package body C393B12_0 is + -- Alert_Functions + + procedure Handle (GA : in out Generic_Alert_Type) is + begin + GA.Status := Generic_Status_Enum'Last; + end Handle; + + function Query_Status (GA : Generic_Alert_Type) + return Generic_Status_Enum is + begin + return GA.Status; + end Query_Status; + +end C393B12_0; + +----------------------------------------------------------------- C393B12_1 + +package C393B12_1 is + type Status is (Low, Medium, High); +end C393B12_1; + +------------------------------------------------------- C393B12_1.C393B12_2 + +with C393B12_0; +pragma Elaborate (C393B12_0); +package C393B12_1.C393B12_2 is new C393B12_0 + -- Alert_Functions + (Generic_Status_Enum => Status); + +------------------------------------------------------------------- C393B12 + +with C393B12_1.C393B12_2; +with Report; +procedure C393B12 is + + use type C393B12_1.Status; + + package Alt_Alert renames C393B12_1.C393B12_2; + + GA : Alt_Alert.Generic_Alert_Type; + +begin + Report.Test ("C393B12", "Check that an extended type can be derived " & + "from an abstract type"); + + if Alt_Alert.Query_Status (GA) /= C393B12_1.Low then + Report.Failed ("Wrong initialization"); + end if; + + Alt_Alert.Handle (GA); + if Alt_Alert.Query_Status (GA) /= C393B12_1.High then + Report.Failed ("Wrong results from Handle"); + end if; + + Report.Result; + +end C393B12; -- cgit v1.2.3