2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / ada / acats / tests / l / la140211.am
blobf6b17576d31fd7ab6fc1e497d71c4ffc4a587a47
1 -- LA140211.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.
16 --                                    DISCLAIMER
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 --*
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 package depends on another
30 --      generic package that is changed.
32 -- TEST DESCRIPTION:
33 --      This test compiles a generic package, a second generic 
34 --      package that withs the first and a main procedure that  
35 --      withs the second package.  Then, a new version of the  
36 --      first package is compiled (in a separate file, simulating 
37 --      editing and modification to the unit).  Unless automatic 
38 --      recompilation is supported, this test should fail to link.  
39 --      Otherwise, the test should recompile and link the correct 
40 --      version of the withed function and report "PASSED" at 
41 --      execution time.
43 -- SPECIAL REQUIREMENTS:
44 --      To build this test:
45 --         1) Compile the file LA140210 (and include the results in the
46 --            program library).
47 --         2) Compile the file LA140211 (and include the results in the
48 --            program library).
49 --         3) Compile the file LA140212 (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.
54 -- TEST FILES:
55 --      This test consists of the following files:
56 --         LA140210.A
57 --      -> LA140211.AM
58 --         LA140212.A
60 -- PASS/FAIL CRITERIA:    
61 --      The test passes if a link time error message reports that 
62 --      LA14021_1 is missing or obsolete and no executable image
63 --      results.  The test also passes if an executable image is produced
64 --      and reports "PASSED" (in the case where the implementation supports
65 --      automatic recompilation).            
67 -- CHANGE HISTORY:
68 --     01 MAY 95   ACVC 1.12   LA5008R baseline version
69 --     23 JUN 95   SAIC        Initial version
70 --     18 NOV 96   SAIC        Modified unit names and prologue to conform
71 --                             to coding conventions.
72 --     07 DEC 96   SAIC        Moved LA14021_0 to a separate file.
74 --!
76 package LA14021_1 is
77      type data_record is tagged 
78           record
79           info : character;
80           end record;
81      subtype loop_count is integer range 1..100;
82      type data_type is new data_record  with
83           record
84                 serial : integer := 0;
85           end record;
86 end LA14021_1;
88 ---------------------------------------------------------
90 with LA14021_1;
91 with LA14021_0;
92 generic     
93      type data_rec is new LA14021_1.data_record with private;
94 package LA14021_2 is
95      package util is new LA14021_0 (character, LA14021_1.loop_count);
96      procedure flip_flop (rec1, rec2 : in out data_rec);
97 end LA14021_2;
99 ---------------------------------------------------------
101 package body LA14021_2 is
102      procedure flip_flop (rec1, rec2 : in out data_rec) is
103      begin
104           util.swap (rec1.info, rec2.info);
105     end flip_flop;
106 end LA14021_2;
108 ---------------------------------------------------------
110 with Report; use Report;
111 with LA14021_1;
112 with LA14021_2;
114 procedure LA140211 is
115      package util is new LA14021_2 (LA14021_1.data_type);
116      datum_1 : LA14021_1.data_type := LA14021_1.data_type'('a', 1);
117      datum_2 : LA14021_1.data_type := LA14021_1.data_type'('b', 2);
118 begin
119      Test ("LA14021", "Check that a compilation unit may " &
120                       "not depend semantically on two " &
121                       "different versions of the same " &
122                       "compilation unit.  Check the case " &
123                       "where a generic package depends on " &
124                       "another generic package that is changed");
126      util.flip_flop (datum_1, datum_2);
127      if datum_1.info = 'b' then
128           Failed ("Revised unit not used");
129      elsif datum_1.info /= 'a' then 
130           Failed ("Incorrect value returned");
131      end if;
133      Result;
134 end LA140211;