Debian Codegraph @

gcc/testsuite/ada/acats/tests/l/la140052.am

raw
1 -- LA140052.AM
2 --
3 -- Grant of Unlimited Rights
4 --
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
14 -- to do so.
15 --
16 -- DISCLAIMER
17 --
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
24 --*
25 --
26 -- OBJECTIVE:
27 -- Check that a compilation unit may not depend semantically on two
28 -- different versions of the same compilation unit. Check the case
29 -- where a generic package body depends on a generic package
30 -- specification.
31 --
32 -- TEST DESCRIPTION:
33 -- This test compiles a generic package specification and body,
34 -- followed by a procedure that makes a call to a procedure
35 -- contained inside the generic package. Then, the generic package
36 -- specification is recompiled, making the body of the generic
37 -- package obsolete. Unless automatic recompilation is
38 -- supported this test should fail to link. Otherwise, the test should
39 -- recompile and link the correct version of the units and report
40 -- "PASSED" at execution time.
41 --
42 -- SPECIAL REQUIREMENTS:
43 -- To build this test:
44 -- 1) Compile the file LA140050 (and include the results in the
45 -- program library).
46 -- 2) Compile the file LA140051 (and include the results in the
47 -- program library).
48 -- 3) Compile the file LA140052 (and include the results in the
49 -- program library).
50 -- 4) Compile the file LA140053 (and include the results in the
51 -- program library).
52 -- 5) Attempt to build an executable image.
53 -- 6) If an executable image results, run it.
54 --
55 -- TEST FILES:
56 -- This test consists of the following files:
57 -- LA140050.A
58 -- LA140051.A
59 -- -> LA140052.AM
60 -- LA140053.A
61 --
62 -- PASS/FAIL CRITERIA:
63 -- Expect a link-time error message that the body of generic
64 -- package LA14005_1 is missing or obsolete. If automatic
65 -- recompilation is supported, and an executable image is
66 -- built, expect a "PASSED" message from execution.
67 --
68 --
69 -- CHANGE HISTORY:
70 -- 01 MAY 95 ACVC 1.12 LA5008I baseline version
71 -- 09 MAY 95 SAIC Initial version
72 -- 08 NOV 96 SAIC Unit naming correction
73 -- 07 DEC 96 SAIC Moved spec of LA14005_1 to a separate file.
74 --
75 --!
76
77 package body LA14005_1 is
78 function return_flt return types.gen_flt is
79 begin
80 return types.gen_flt(types.TC_var);
81 end return_flt;
82 begin
83 types.TC_var := types.flt(TC_constant_flt);
84 end LA14005_1;
85
86 ---------------------------------------------------------
87
88 with Report; use Report;
89 with LA14005_0;
90 with LA14005_1;
91 procedure LA140052 is
92 subtype TC_flt is float digits 5;
93
94 package Y is new LA14005_0 (integer(100.0), integer(0.0), TC_flt);
95 package inst is new LA14005_1 (Y);
96 TC_var : TC_flt;
97 begin
98 Test ("LA14005", "Check that a compilation unit may not depend " &
99 "semantically on two different versions of the same " &
100 "compilation unit. Check the case where a generic package " &
101 "body depends on a generic package specification");
102
103 TC_var := TC_flt(inst.return_flt);
104
105 if TC_Var /= TC_flt(Y.min) then
106 Failed ("Obsolete unit used in elaboration");
107 end if;
108
109 Result;
110 end LA140052;