Debian Codegraph @

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

raw
1 -- LA140262.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 package instantiation that is changed.
31 --
32 -- TEST DESCRIPTION:
33 -- This test compiles a generic package, a generic
34 -- instantiation of the generic package, another generic
35 -- package, a generic instantiation of the second generic
36 -- package that withs the first generic instantiation
37 -- packages, and a main procedure that withs the instantiated
38 -- generic package. Then, a new version of the first generic
39 -- package is compiled (in a separate file, simulating
40 -- editing and modification to the unit). Unless automatic
41 -- recompilation is supported, this test should fail to link.
42 -- Otherwise, the test should recompile and link the correct
43 -- version of the instantiation and report "PASSED" at
44 -- execution time.
45 --
46 -- SPECIAL REQUIREMENTS:
47 -- To build this test:
48 -- 1) Compile the file LA140260 (and include the results in the
49 -- program library).
50 -- 2) Compile the file LA140261 (and include the results in the
51 -- program library).
52 -- 3) Compile the file LA140262 (and include the results in the
53 -- program library).
54 -- 4) Compile the file LA140263 (and include the results in the
55 -- program library).
56 -- 5) Attempt to build an executable image.
57 -- 6) If an executable image results, run it.
58 --
59 -- TEST FILES:
60 -- This test consists of the following files:
61 -- LA140260.A
62 -- LA140261.A
63 -- -> LA140262.AM
64 -- LA140263.A
65 --
66 -- PASS/FAIL CRITERIA:
67 -- The test passes if a link time error message reports that
68 -- LA140260 is missing or obsolete, or that LA14026_5 is
69 -- missing or obsolete (optional) and no executable image
70 -- results. The test also passes if an executable image is produced
71 -- and reports "PASSED" (in the case where the implementation supports
72 -- automatic recompilation).
73 --
74 -- CHANGE HISTORY:
75 -- 01 MAY 95 ACVC 1.12 LA5008W baseline version
76 -- 06 JUL 95 SAIC Initial version
77 -- 18 NOV 96 SAIC Modified unit names and prologue to conform
78 -- to coding conventions.
79 -- 07 DEC 96 SAIC Moved LA14026_3 to a separate file. Added
80 -- pragma Elaborate to context clause of LA14026_5.
81 --
82 --!
83
84 with LA14026_0;
85 generic
86 type rec is new LA14026_0.basic_rec with private;
87 package LA14026_4 is
88 type extended_node;
89 type extended_node_ptr is access extended_node;
90 type extended_node is new rec with
91 record
92 next : extended_node_ptr := null;
93 end record;
94 procedure add_next (node : in out extended_node; ptr : extended_node_ptr);
95 end LA14026_4;
96
97 ---------------------------------------------------------
98
99 package body LA14026_4 is
100 procedure add_next (node : in out extended_node;
101 ptr : extended_node_ptr) is
102 begin
103 node.next := ptr;
104 end add_next;
105 end LA14026_4;
106
107 ---------------------------------------------------------
108
109 with LA14026_3, LA14026_4;
110 pragma Elaborate (LA14026_4);
111 package LA14026_5 is new LA14026_4 (LA14026_3.node_type);
112
113 ---------------------------------------------------------
114
115 with Report;
116 use Report;
117 with LA14026_5;
118
119 procedure LA140262 is
120 root : LA14026_5.extended_node_ptr := new LA14026_5.extended_node;
121 next : LA14026_5.extended_node_ptr := new LA14026_5.extended_node;
122 begin
123 Test ("LA14026","Check that a compilation unit may not depend " &
124 "semantically on two different versions of " &
125 "the same compilation unit. Check the case " &
126 "where a generic instantiation depends on " &
127 "a generic package instantiation that is " &
128 "changed");
129
130
131 LA14026_5.add_next (root.all, next);
132
133 if root.all.next.serial_no = 2 then
134 Failed ("Old version of unit used");
135 elsif root.all.next.serial_no /= 5 then
136 Failed ("Wrong value returned");
137 end if;
138
139 Result;
140 end LA140262;