Debian Codegraph @

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

raw
1 -- LA140041.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 function depends on a
30 -- library level package.
31 --
32 -- TEST DESCRIPTION:
33 -- This test compiles a package specification, then a generic
34 -- function specification and body that withs the package,
35 -- followed by a procedure that makes a call to an instance of
36 -- the generic function. Then, the package specification is
37 -- recompiled, making the body of function LA14004_1 obsolete.
38 -- Unless automatic recompilation is supported this test should fail
39 -- to link. Otherwise, the test should recompile and link
40 -- the correct version of the withed package and report
41 -- "PASSED" at execution time.
42 --
43 -- SPECIAL REQUIREMENTS:
44 -- To build this test:
45 -- 1) Compile the file LA140040 (and include the results in the
46 -- program library).
47 -- 2) Compile the file LA140041 (and include the results in the
48 -- program library).
49 -- 3) Compile the file LA140042 (and include the results in the
50 -- program library).
51 -- 4) Attempt to build an executable image.
52 -- 5) If an executable image results, run it.
53 --
54 -- TEST FILES:
55 -- This test consists of the following files:
56 -- LA140040.A
57 -- -> LA140041.AM
58 -- LA140042.A
59 --
60 -- PASS/FAIL CRITERIA:
61 -- Expect a link-time error message that the body of generic
62 -- function LA14004_1 is missing or obsolete. If automatic
63 -- recompilation is supported, and an executable image is
64 -- built, expect a "PASSED" message from execution.
65 --
66 -- CHANGE HISTORY:
67 -- 09 MAY 95 SAIC Initial version
68 -- 10 DEC 96 SAIC Reorganized to permit automatic recompilation.
69 --
70 --!
71
72 generic
73 function LA14004_1 return integer;
74
75 with LA14004_0; -- Revision and recompilation of LA14004_0
76 -- will require resolution of this semantic
77 -- dependency
78 function LA14004_1 return integer is
79 begin
80 return LA14004_0.TC_Var;
81 end LA14004_1;
82
83
84
85 with Report; use Report;
86 with LA14004_1;
87 procedure LA140041 is
88 TC_Val : integer := 0;
89
90 function F_LA14004_1 is new LA14004_1;
91 begin
92 Test ("LA14004", "Check that a compilation unit may " &
93 "not depend semantically on two " &
94 "different versions of the same " &
95 "compilation unit. Check the case " &
96 "where a generic function depends on a "&
97 "library level package");
98
99 TC_Val := F_LA14004_1;
100
101 if TC_Val = 100 then
102 Failed ("Obsolete unit used in elaboration");
103 elsif TC_Val /= -10 then
104 Failed ("Incorrect test value returned");
105 end if;
106
107 Result;
108 end LA140041;