3 -- Grant of Unlimited Rights
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
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.
27 -- Check that a compilation unit may not depend semantically
28 -- on two different versions of the same compilation unit.
29 -- Check the case where a separate procedure depends
30 -- on a withed generic package that is changed.
33 -- This test declares a package which contains a generic procedure GP,
34 -- the body of which is a subunit. The package also contains a procedure
35 -- P which instantiates GP and calls the instance. The instance itself
36 -- calls a procedure which is declared within the instance of a generic
37 -- package X. The test compiles each of these compilation units and the
38 -- main procedure, then compiles a new version of the generic package X
39 -- (in a separate file, simulating an editing modification to the unit).
40 -- Unless automatic recompilation is supported, this test should fail to
41 -- link. Otherwise, the test should recompile and link the correct
42 -- version of the generic package X and report "PASSED" at execution time.
44 -- SPECIAL REQUIREMENTS:
45 -- To build this test:
46 -- 1) Compile the file LA140160 (and include the results in the
48 -- 2) Compile the file LA140161 (and include the results in the
50 -- 3) Compile the file LA140162 (and include the results in the
52 -- 4) Compile the file LA140163 (and include the results in the
54 -- 5) Attempt to build an executable image.
55 -- 6) If an executable image results, run it.
58 -- This test consists of the following files:
64 -- PASS/FAIL CRITERIA:
65 -- The test passes if a link time error message reports that
66 -- LA14016_4.gen_def is missing or obsolete and no executable
67 -- image results. The test also passes if an executable image is
68 -- produced and reports "PASSED" (in the case where the implementation
69 -- supports automatic recompilation).
73 -- 01 MAY 95 ACVC 1.12 LA5008L baseline version
74 -- 16 JUN 95 SAIC Initial version
75 -- 07 DEC 96 SAIC Modified unit names and prologue to conform
76 -- to coding conventions. Restructured subunits
77 -- to prevent potential Program_Error due to
78 -- premature instantiation of gen_def. Moved
79 -- LA14016_1 to a separate file. Added pragma
80 -- Elaborate to context clause of LA14016_3.
85 package body LA14016_1 is
86 procedure inc (param : in out new_t) is
88 param.count := param.count + 1;
90 function status (param : new_t) return LA14016_0.status_code is
92 return LA14016_0.status_code(param.count);
96 ---------------------------------------------------------
100 type extended is new LA14016_0.tagged_type with
102 status : LA14016_0.status_code := 10;
104 function status (param : extended) return LA14016_0.status_code;
107 ---------------------------------------------------------
109 package body LA14016_2 is
110 function status (param : extended) return LA14016_0.status_code is
116 ---------------------------------------------------------
121 pragma Elaborate (LA14016_1);
122 package LA14016_3 is new LA14016_1 (LA14016_2.extended,
123 LA14016_0.status_code);
125 ---------------------------------------------------------
130 procedure gen_caller (p1 : in out LA14016_3.new_t);
134 procedure gen_def (param : in out LA14016_3.new_t);
138 ---------------------------------------------------------
140 package body LA14016_4 is
141 procedure gen_def (param : in out LA14016_3.new_t) is separate;
142 procedure gen_caller (p1 : in out LA14016_3.new_t) is separate;
145 ---------------------------------------------------------
148 procedure gen_def (param : in out LA14016_3.new_t) is
150 param.status := LA14016_3.default_status; --originally 0
152 param.count := param.status;
153 LA14016_3.inc (param);
156 ---------------------------------------------------------
159 procedure gen_caller (p1 : in out LA14016_3.new_t) is
160 procedure default is new gen_def (101);
165 ---------------------------------------------------------
167 with Report; use Report;
172 procedure LA140162 is
173 E : LA14016_3.new_t; --status defaults to 10
175 Test ("LA14016","Check that a compilation unit may not depend " &
176 "semantically on two different versions of the " &
177 "same compilation unit. Check the case where a " &
178 "separate procedure depends on a withed generic " &
179 "package that is changed");
181 LA14016_4.gen_caller (E);
184 Failed ("Old generic used");
185 elsif E.status = 10 then
186 Failed ("Status not updated");
187 elsif E.status /= 5 then
188 Failed ("Wrong status value used");
192 Failed ("Count not properly handled");