comparison gcc/testsuite/ada/acats/tests/l/la140172.am @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 -- LA140172.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 function semantically
30 -- depends on a library level generic function that is changed.
31 --
32 -- TEST DESCRIPTION:
33 -- This test compiles a generic function, and a procedure that
34 -- withs the function. Then, a new version of the generic
35 -- function body is compiled (in a separate file, simulating
36 -- and editing modification to the unit). Unless automatic
37 -- recompilation is supported, this test should fail to link.
38 -- Otherwise, the test should recompile and link the correct
39 -- version of the withed function and report "PASSED" at
40 -- execution time.
41 --
42 -- SPECIAL REQUIREMENTS:
43 -- To build this test:
44 -- 1) Compile the file LA140170 (and include the results in the
45 -- program library).
46 -- 2) Compile the file LA140171 (and include the results in the
47 -- program library).
48 -- 3) Compile the file LA140172 (and include the results in the
49 -- program library).
50 -- 4) Compile the file LA140173 (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 -- LA140170.A
58 -- LA140171.A
59 -- -> LA140172.AM
60 -- LA140173.A
61 --
62 -- PASS/FAIL CRITERIA:
63 -- The test passes if a link time error message reports that
64 -- LA14017_1.Inc is missing or obsolete and no executable image
65 -- results. The test also passes if an executable image is produced
66 -- and reports "PASSED" (in the case where the implementation supports
67 -- automatic recompilation).
68 --
69 --
70 -- CHANGE HISTORY:
71 -- 01 MAY 95 ACVC 1.12 LA5008M baseline version
72 -- 16 JUN 95 SAIC Initial version
73 -- 03 MAR 96 SAIC First revision after review
74 -- 17 NOV 96 SAIC Modified unit names and prologue to conform
75 -- to coding conventions.
76 -- 07 DEC 96 SAIC Moved LA14017_1 to a separate file.
77 --
78 --!
79
80 separate (LA14017_1) -- This dependency must be resolved
81 -- after LA140171.A is compiled.
82
83 function Inc (Param : integer) return integer is
84 begin
85 return Param + integer (count_factor);
86 end Inc;
87
88 -----------------------------------------------------
89
90
91 with Report; use Report;
92 with LA14017_1;
93 with LA14017_0;
94
95 procedure LA140172 is
96 type Access_integer is access integer;
97 TC_local : integer := 0;
98 P1, P2 : LA14017_0.swap_type_ptr;
99
100 function New_swap is new LA14017_1(swap_type => integer);
101 begin
102 Test ("LA14017", "Check that a compilation unit may not " &
103 "depend semantically on two different " &
104 "versions of the same compilation unit. " &
105 "Check the case where a separate " &
106 "function semantically depends on a " &
107 "library level generic function that is " &
108 "changed");
109
110 P1.p_all := 0;
111 P2 := P1;
112 TC_local := integer (New_swap(P1,P2,0));
113
114 if TC_local = 10 then
115 Failed ("Revised library level function not used");
116 elsif TC_local /= -10 then
117 Failed ("Incorrect value returned");
118 end if;
119
120 Result;
121 end LA140172;