1 |
149 |
jeremybenn |
-- LA140162.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
|
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.
|
31 |
|
|
--
|
32 |
|
|
-- TEST DESCRIPTION:
|
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.
|
43 |
|
|
--
|
44 |
|
|
-- SPECIAL REQUIREMENTS:
|
45 |
|
|
-- To build this test:
|
46 |
|
|
-- 1) Compile the file LA140160 (and include the results in the
|
47 |
|
|
-- program library).
|
48 |
|
|
-- 2) Compile the file LA140161 (and include the results in the
|
49 |
|
|
-- program library).
|
50 |
|
|
-- 3) Compile the file LA140162 (and include the results in the
|
51 |
|
|
-- program library).
|
52 |
|
|
-- 4) Compile the file LA140163 (and include the results in the
|
53 |
|
|
-- program library).
|
54 |
|
|
-- 5) Attempt to build an executable image.
|
55 |
|
|
-- 6) If an executable image results, run it.
|
56 |
|
|
--
|
57 |
|
|
-- TEST FILES:
|
58 |
|
|
-- This test consists of the following files:
|
59 |
|
|
-- LA140160.A
|
60 |
|
|
-- LA140161.A
|
61 |
|
|
-- -> LA140162.AM
|
62 |
|
|
-- LA140163.A
|
63 |
|
|
--
|
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).
|
70 |
|
|
--
|
71 |
|
|
--
|
72 |
|
|
-- CHANGE HISTORY:
|
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.
|
81 |
|
|
--
|
82 |
|
|
--
|
83 |
|
|
--!
|
84 |
|
|
|
85 |
|
|
package body LA14016_1 is
|
86 |
|
|
procedure inc (param : in out new_t) is
|
87 |
|
|
begin
|
88 |
|
|
param.count := param.count + 1;
|
89 |
|
|
end inc;
|
90 |
|
|
function status (param : new_t) return LA14016_0.status_code is
|
91 |
|
|
begin
|
92 |
|
|
return LA14016_0.status_code(param.count);
|
93 |
|
|
end status;
|
94 |
|
|
end LA14016_1;
|
95 |
|
|
|
96 |
|
|
---------------------------------------------------------
|
97 |
|
|
|
98 |
|
|
with LA14016_0;
|
99 |
|
|
package LA14016_2 is
|
100 |
|
|
type extended is new LA14016_0.tagged_type with
|
101 |
|
|
record
|
102 |
|
|
status : LA14016_0.status_code := 10;
|
103 |
|
|
end record;
|
104 |
|
|
function status (param : extended) return LA14016_0.status_code;
|
105 |
|
|
end LA14016_2;
|
106 |
|
|
|
107 |
|
|
---------------------------------------------------------
|
108 |
|
|
|
109 |
|
|
package body LA14016_2 is
|
110 |
|
|
function status (param : extended) return LA14016_0.status_code is
|
111 |
|
|
begin
|
112 |
|
|
return param.status;
|
113 |
|
|
end status;
|
114 |
|
|
end LA14016_2;
|
115 |
|
|
|
116 |
|
|
---------------------------------------------------------
|
117 |
|
|
|
118 |
|
|
with LA14016_0;
|
119 |
|
|
with LA14016_1;
|
120 |
|
|
with LA14016_2;
|
121 |
|
|
pragma Elaborate (LA14016_1);
|
122 |
|
|
package LA14016_3 is new LA14016_1 (LA14016_2.extended,
|
123 |
|
|
LA14016_0.status_code);
|
124 |
|
|
|
125 |
|
|
---------------------------------------------------------
|
126 |
|
|
|
127 |
|
|
with LA14016_3;
|
128 |
|
|
package LA14016_4 is
|
129 |
|
|
|
130 |
|
|
procedure gen_caller (p1 : in out LA14016_3.new_t);
|
131 |
|
|
|
132 |
|
|
generic
|
133 |
|
|
new_max : integer;
|
134 |
|
|
procedure gen_def (param : in out LA14016_3.new_t);
|
135 |
|
|
|
136 |
|
|
end LA14016_4;
|
137 |
|
|
|
138 |
|
|
---------------------------------------------------------
|
139 |
|
|
|
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;
|
143 |
|
|
end LA14016_4;
|
144 |
|
|
|
145 |
|
|
---------------------------------------------------------
|
146 |
|
|
|
147 |
|
|
separate (LA14016_4)
|
148 |
|
|
procedure gen_def (param : in out LA14016_3.new_t) is
|
149 |
|
|
begin
|
150 |
|
|
param.status := LA14016_3.default_status; --originally 0
|
151 |
|
|
--later change to 5
|
152 |
|
|
param.count := param.status;
|
153 |
|
|
LA14016_3.inc (param);
|
154 |
|
|
end gen_def;
|
155 |
|
|
|
156 |
|
|
---------------------------------------------------------
|
157 |
|
|
|
158 |
|
|
separate (LA14016_4)
|
159 |
|
|
procedure gen_caller (p1 : in out LA14016_3.new_t) is
|
160 |
|
|
procedure default is new gen_def (101);
|
161 |
|
|
begin
|
162 |
|
|
default (p1);
|
163 |
|
|
end gen_caller;
|
164 |
|
|
|
165 |
|
|
---------------------------------------------------------
|
166 |
|
|
|
167 |
|
|
with Report; use Report;
|
168 |
|
|
with LA14016_3;
|
169 |
|
|
with LA14016_4;
|
170 |
|
|
with LA14016_2;
|
171 |
|
|
|
172 |
|
|
procedure LA140162 is
|
173 |
|
|
E : LA14016_3.new_t; --status defaults to 10
|
174 |
|
|
begin
|
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");
|
180 |
|
|
|
181 |
|
|
LA14016_4.gen_caller (E);
|
182 |
|
|
|
183 |
|
|
if E.status = 0 then
|
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");
|
189 |
|
|
end if;
|
190 |
|
|
|
191 |
|
|
if E.count /= 6 then
|
192 |
|
|
Failed ("Count not properly handled");
|
193 |
|
|
end if;
|
194 |
|
|
|
195 |
|
|
Result;
|
196 |
|
|
end LA140162;
|