annotate gcc/testsuite/ada/acats/tests/c3/c392c05.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C392C05.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that for a call to a dispatching subprogram the subprogram
kono
parents:
diff changeset
28 -- body which is executed is determined by the controlling tag for
kono
parents:
diff changeset
29 -- the case where the call has statically tagged controlling operands
kono
parents:
diff changeset
30 -- of the type T. Check this for various operands of tagged types:
kono
parents:
diff changeset
31 -- objects (declared or allocated), formal parameters, view conversions,
kono
parents:
diff changeset
32 -- function calls (both primitive and non-primitive).
kono
parents:
diff changeset
33 --
kono
parents:
diff changeset
34 -- TEST DESCRIPTION:
kono
parents:
diff changeset
35 -- This test uses foundation F392C00 to test the usages of statically
kono
parents:
diff changeset
36 -- tagged objects and values. The calls to Validate indicate the
kono
parents:
diff changeset
37 -- expected sequence of procedure calls since the previous call to
kono
parents:
diff changeset
38 -- Validate. Static tags can be determined at compile time, and
kono
parents:
diff changeset
39 -- hence this is a test of correct overload resolution for tagged types.
kono
parents:
diff changeset
40 -- A clever compiler which unrolls loops and does path analysis on
kono
parents:
diff changeset
41 -- access values will be able to perform the same kind of determination
kono
parents:
diff changeset
42 -- for all of the code in this test.
kono
parents:
diff changeset
43 --
kono
parents:
diff changeset
44 -- TEST FILES:
kono
parents:
diff changeset
45 -- The following files comprise this test:
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 -- F392C00.A (foundation code)
kono
parents:
diff changeset
48 -- C392C05.A
kono
parents:
diff changeset
49 --
kono
parents:
diff changeset
50 --
kono
parents:
diff changeset
51 -- CHANGE HISTORY:
kono
parents:
diff changeset
52 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
53 -- 19 Dec 94 SAIC Removed RM references from objective text.
kono
parents:
diff changeset
54 -- 24 Oct 95 SAIC Updated for ACVC 2.0.1
kono
parents:
diff changeset
55 -- 13 Feb 97 PWB.CTA Corrected assumption that "or" operands are
kono
parents:
diff changeset
56 -- evaluated in textual order.
kono
parents:
diff changeset
57 --!
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 with Report;
kono
parents:
diff changeset
60 with TCTouch;
kono
parents:
diff changeset
61 with F392C00_1;
kono
parents:
diff changeset
62 procedure C392C05 is -- Hardware_Store
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 package Switch renames F392C00_1;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 subtype Switch_Class is Switch.Toggle'Class;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 type Reference is access all Switch_Class;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 A_Switch : aliased Switch.Toggle;
kono
parents:
diff changeset
71 A_Dimmer : aliased Switch.Dimmer;
kono
parents:
diff changeset
72 An_Autodim : aliased Switch.Auto_Dimmer;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 type Light_Bank is array(Positive range <>) of Reference;
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 Lamps : Light_Bank(1..3);
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 begin -- Main test procedure.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 Report.Test ("C392C05", "Check that a dispatching subprogram call is "
kono
parents:
diff changeset
81 & "determined by the controlling tag for statically "
kono
parents:
diff changeset
82 & "tagged controlling operands" );
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 -- Check use of static tagged declared objects,
kono
parents:
diff changeset
85 -- and static tagged formal parameters
kono
parents:
diff changeset
86 -- Must call correct version of flip based on type of controlling op.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- Turn on the lights!
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 Switch.Flip( A_Switch );
kono
parents:
diff changeset
91 TCTouch.Validate( "A", "Declared Toggle" );
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 Switch.Flip( A_Dimmer );
kono
parents:
diff changeset
94 TCTouch.Validate( "GBA", "Declared Dimmer" );
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 Switch.Flip( An_Autodim );
kono
parents:
diff changeset
97 TCTouch.Validate( "KGBA", "Declared Auto_Dimmer" );
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 Lamps(1) := new Switch.Toggle;
kono
parents:
diff changeset
100 Lamps(2) := new Switch.Dimmer;
kono
parents:
diff changeset
101 Lamps(3) := new Switch.Auto_Dimmer;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- Check use of static tagged allocated objects,
kono
parents:
diff changeset
104 -- and static tagged formal parameters in a loop which may dynamically
kono
parents:
diff changeset
105 -- dispatch. If an optimizer unrolls the loop, it may then be statically
kono
parents:
diff changeset
106 -- determined, and no dispatching will occur. Either interpretation is
kono
parents:
diff changeset
107 -- correct.
kono
parents:
diff changeset
108 for Knob in Lamps'Range loop
kono
parents:
diff changeset
109 Switch.Flip( Lamps(Knob).all );
kono
parents:
diff changeset
110 end loop;
kono
parents:
diff changeset
111 TCTouch.Validate( "AGBAKGBA", "Allocated Objects" );
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- Check use of static tagged declared objects,
kono
parents:
diff changeset
114 -- calling non-primitive functions.
kono
parents:
diff changeset
115 if not Switch.TC_Non_Disp( A_Switch ) then
kono
parents:
diff changeset
116 Report.Failed( "Bad Value 1" );
kono
parents:
diff changeset
117 end if;
kono
parents:
diff changeset
118 TCTouch.Validate( "X", "Nonprimitive Function" );
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 if not Switch.TC_Non_Disp( A_Dimmer ) then
kono
parents:
diff changeset
121 Report.Failed( "Bad Value 2" );
kono
parents:
diff changeset
122 end if;
kono
parents:
diff changeset
123 TCTouch.Validate( "Y", "Nonprimitive Function" );
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 if not Switch.TC_Non_Disp( An_Autodim ) then
kono
parents:
diff changeset
126 Report.Failed( "Bad Value 3" );
kono
parents:
diff changeset
127 end if;
kono
parents:
diff changeset
128 TCTouch.Validate( "Z", "Nonprimitive Function" );
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 A_Switch := Switch.Create;
kono
parents:
diff changeset
131 A_Dimmer := Switch.Create;
kono
parents:
diff changeset
132 An_Autodim := Switch.Create;
kono
parents:
diff changeset
133 TCTouch.Validate( "123", "Primitive Function" );
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- View conversions
kono
parents:
diff changeset
136 Switch.Brighten( An_Autodim, 50 );
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 Switch.Flip( Switch.Toggle( A_Switch ) );
kono
parents:
diff changeset
139 Switch.Flip( Switch.Toggle( A_Dimmer ) );
kono
parents:
diff changeset
140 Switch.Flip( Switch.Dimmer( An_Autodim ) );
kono
parents:
diff changeset
141 TCTouch.Validate( "DAAGBA", "View Conversions" );
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 -- statically tagged controlling operands (specific types) provided to
kono
parents:
diff changeset
144 -- class-wide functions
kono
parents:
diff changeset
145 if Switch.On( A_Switch )
kono
parents:
diff changeset
146 or Switch.On( A_Dimmer )
kono
parents:
diff changeset
147 or Switch.On( An_Autodim ) then
kono
parents:
diff changeset
148 Report.Failed( "Bad Value 4" );
kono
parents:
diff changeset
149 end if;
kono
parents:
diff changeset
150 TCTouch.Validate( "BBB", "Class-wide" );
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 -- statically tagged controlling operands qualified expressions provided to
kono
parents:
diff changeset
153 -- primitive functions, also using context to determine call to a
kono
parents:
diff changeset
154 -- class-wide function.
kono
parents:
diff changeset
155 if Switch.Off( Switch.Toggle'( Switch.Create ) )
kono
parents:
diff changeset
156 or else Switch.Off( Switch.Dimmer'( Switch.Create ) )
kono
parents:
diff changeset
157 or else Switch.Off( Switch.Auto_Dimmer'( Switch.Create ) ) then
kono
parents:
diff changeset
158 Report.Failed( "Bad Value 5" );
kono
parents:
diff changeset
159 end if;
kono
parents:
diff changeset
160 TCTouch.Validate( "1C2C3C", "Qualified Expression/Class-Wide" );
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 Report.Result;
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 end C392C05;