2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / ada / acats / tests / l / la140251.am
blob7f7a4791de3aa9b9dbdd198fac11a04e1adadcb6
1 -- LA140251.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 instantiation depends on
30 --      a non-generic package that is changed.
32 -- TEST DESCRIPTION:
33 --      This test compiles a package, a generic package, a 
34 --      generic instantiation that withs both of the first two
35 --      packages, and a main procedure that withs the instantiated 
36 --      generic package.  Then, a new version of the first   
37 --      package is compiled (in a separate file, simulating 
38 --      editing and modification to the unit).  Unless automatic 
39 --      recompilation is supported, this test should fail to link.  
40 --      Otherwise, the test should recompile and link the correct 
41 --      version of the withed package and report "PASSED" at 
42 --      execution time.
44 -- SPECIAL REQUIREMENTS:
45 --      To build this test:
46 --         1) Compile the file LA140250 (and include the results in the
47 --            program library).
48 --         2) Compile the file LA140251 (and include the results in the
49 --            program library).
50 --         3) Compile the file LA140252 (and include the results in the
51 --            program library).
52 --         4) Attempt to build an executable image.
53 --         5) If an executable image results, run it.
55 -- TEST FILES:
56 --      This test consists of the following files:
57 --         LA140250.A
58 --      -> LA140251.AM
59 --         LA140252.A
61 -- PASS/FAIL CRITERIA:    
62 --      The test passes if a link time error message reports that 
63 --      LA14025 is missing or obsolete, or that LA14025_2 is 
64 --      missing or obsolete (optional) and no executable image
65 --      results.  The test passes if an executable image is produced
66 --      and reports "PASSED" (in case the implementation supports
67 --      automatic recompilation).            
70 -- CHANGE HISTORY:
71 --     01 MAY 95   ACVC 1.12   LA5008V baseline version
72 --     06 JUL 95   SAIC        Initial version
73 --     08 NOV 96   SAIC        Unit naming correction
74 --     07 DEC 96   SAIC        Moved LA14025_0 to a separate file. Added
75 --                             pragma Elaborate to context clause of
76 --                             LA14025_2.
78 --!
80 with LA14025_0;
81 generic
82      type your_addition is (<>);
83 package LA14025_1 is          --extensions, utilities
84      type extended_record is new LA14025_0.data_rec with record
85           new_data : your_addition;
86      end record;
87      procedure stuff (param : your_addition);
88      function fetch (param : LA14025_0.byte) return LA14025_0.byte;
89 private
90      obj : extended_record;
91 end LA14025_1;
93 ---------------------------------------------
95 package body LA14025_1 is
96      procedure stuff (param : your_addition) is
97      begin
98           obj.new_data := param; 
99      end stuff;
101      function fetch (param : LA14025_0.byte) return LA14025_0.byte is
102      begin
103           return (param + obj.val);
104      end fetch;
105 end LA14025_1;
107 ---------------------------------------------
109 with LA14025_0;
110 with LA14025_1;
111 pragma Elaborate (LA14025_1);
112 package LA14025_2 is new LA14025_1 (LA14025_0.byte);
114 ---------------------------------------------
116 with Report; use Report;
117 with LA14025_2;
118 with LA14025_0;
119 procedure LA140251 is
120      TC_val : LA14025_0.byte := 0;
121      Temp_var : LA14025_2.extended_record;
122 begin
123      Test ("LA14025", "Check that a compilation unit may not " &
124                       "depend semantically on two different " &
125                       "versions of the same compilation unit.  " &
126                       "Check the case where a generic " &
127                       "instantiation depends on a non-generic " &
128                       "package that is changed");
130      LA14025_2.stuff(10);
131      
132      TC_val := LA14025_2.fetch (Temp_var.val);
134      if TC_val = 256 then
135           Failed ("Old version of package used");
136      elsif TC_val /= 128 then
137           Failed ("Incorrect value returned");
138      end if;
140      Result;
141 end LA140251;