1 |
294 |
jeremybenn |
-- CA140232.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 generic instantiation depends on
|
30 |
|
|
-- a generic function that is changed.
|
31 |
|
|
--
|
32 |
|
|
-- TEST DESCRIPTION:
|
33 |
|
|
-- This test compiles a generic function, a generic
|
34 |
|
|
-- instantiation of the generic function, and a main
|
35 |
|
|
-- procedure that withs the instantiated generic
|
36 |
|
|
-- function. Then, a new version of the first generic
|
37 |
|
|
-- function is compiled (in a separate file, simulating
|
38 |
|
|
-- editing and modification to the unit). The test should
|
39 |
|
|
-- link the correct version of the withed function and
|
40 |
|
|
-- report "PASSED" at execution time.
|
41 |
|
|
--
|
42 |
|
|
-- Note that compilers are required by the standard to support
|
43 |
|
|
-- replacement of a generic body without recompilation of the
|
44 |
|
|
-- instantation. The ARG confirmed 10.1.4(10) with AI-00077.
|
45 |
|
|
--
|
46 |
|
|
-- To build this test:
|
47 |
|
|
-- 1) Compile the file CA140230 (and include the results in the
|
48 |
|
|
-- program library).
|
49 |
|
|
-- 2) Compile the file CA140231 (and include the results in the
|
50 |
|
|
-- program library).
|
51 |
|
|
-- 3) Compile the file CA140232 (and include the results in the
|
52 |
|
|
-- program library).
|
53 |
|
|
-- 4) Compile the file CA140233 (and include the results in the
|
54 |
|
|
-- program library).
|
55 |
|
|
-- 5) Build and run an executable image.
|
56 |
|
|
--
|
57 |
|
|
-- TEST FILES:
|
58 |
|
|
-- This test consists of the following files:
|
59 |
|
|
-- CA140230.A
|
60 |
|
|
-- CA140231.A
|
61 |
|
|
-- -> CA140232.AM
|
62 |
|
|
-- CA140233.A
|
63 |
|
|
--
|
64 |
|
|
-- CHANGE HISTORY:
|
65 |
|
|
-- 01 MAY 95 ACVC 1.12 LA5008T baseline version
|
66 |
|
|
-- 29 JUN 95 SAIC Initial version
|
67 |
|
|
-- 05 MAR 96 SAIC First revision after review
|
68 |
|
|
-- 18 NOV 96 SAIC Modified unit names and prologue to conform
|
69 |
|
|
-- to coding conventions.
|
70 |
|
|
-- 07 DEC 96 SAIC Moved CA14023_1 to a separate file.
|
71 |
|
|
-- 13 SEP 99 RLB Changed to C-test (by AI-00077).
|
72 |
|
|
-- 20 MAR 00 RLB Removed special requirements, because there
|
73 |
|
|
-- aren't any.
|
74 |
|
|
--
|
75 |
|
|
--!
|
76 |
|
|
|
77 |
|
|
with CA14023_0;
|
78 |
|
|
use CA14023_0;
|
79 |
|
|
|
80 |
|
|
generic
|
81 |
|
|
Min : Little_float := 0.0;
|
82 |
|
|
type Any_rec is new Data_rec with private;
|
83 |
|
|
function CA14023_2 (R1, R2 : Any_rec) return Little_float;
|
84 |
|
|
|
85 |
|
|
--------------------------------------------------------
|
86 |
|
|
|
87 |
|
|
with CA14023_1;
|
88 |
|
|
|
89 |
|
|
function CA14023_2 (R1, R2 : Any_rec) return Little_float is
|
90 |
|
|
function Max_val is new CA14023_1 (Little_float, Min);
|
91 |
|
|
begin
|
92 |
|
|
return max_val (R1.Data, R2.Data);
|
93 |
|
|
end CA14023_2;
|
94 |
|
|
|
95 |
|
|
--------------------------------------------------------
|
96 |
|
|
|
97 |
|
|
package CA14023_0.CA14023_3 is
|
98 |
|
|
type New_data_rec is new Data_rec with record
|
99 |
|
|
Other_val : integer := 100;
|
100 |
|
|
end record;
|
101 |
|
|
end CA14023_0.CA14023_3;
|
102 |
|
|
|
103 |
|
|
--------------------------------------------------------
|
104 |
|
|
|
105 |
|
|
with Report; use Report;
|
106 |
|
|
with CA14023_2;
|
107 |
|
|
with CA14023_0;
|
108 |
|
|
with CA14023_0.CA14023_3;
|
109 |
|
|
|
110 |
|
|
procedure CA140232 is
|
111 |
|
|
|
112 |
|
|
NDR1, NDR2 : CA14023_0.CA14023_3.New_data_rec;
|
113 |
|
|
Min_value : constant CA14023_0.Little_float := 0.0;
|
114 |
|
|
TC_result : CA14023_0.Little_float;
|
115 |
|
|
function Max_Data_Val is new CA14023_2 (Min_value,
|
116 |
|
|
CA14023_0.CA14023_3.New_data_rec);
|
117 |
|
|
begin
|
118 |
|
|
Test ("CA14023", "Check that a compilation unit may not " &
|
119 |
|
|
"depend semantically on two different " &
|
120 |
|
|
"versions of the same compilation unit. " &
|
121 |
|
|
"Check the case where a generic " &
|
122 |
|
|
"instantiation depends on a generic " &
|
123 |
|
|
"function that is changed");
|
124 |
|
|
|
125 |
|
|
NDR1.Data := 2.0;
|
126 |
|
|
NDR2.Data := 5.0;
|
127 |
|
|
|
128 |
|
|
TC_result := Max_Data_Val (NDR1, NDR2);
|
129 |
|
|
|
130 |
|
|
if TC_result = 5.0 then
|
131 |
|
|
Failed ("Revised generic not used");
|
132 |
|
|
elsif TC_result /= 0.0 then -- the minimum, floor
|
133 |
|
|
Failed ("Incorrect value returned"); -- value of 0.0 should
|
134 |
|
|
end if; -- be returned rather
|
135 |
|
|
-- than the min of the
|
136 |
|
|
-- two actual parameters
|
137 |
|
|
|
138 |
|
|
Result;
|
139 |
|
|
end CA140232;
|