annotate gcc/testsuite/ada/acats/tests/cd/cd300050.am @ 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 -- CD30005.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 Address clauses are supported for imported subprograms.
kono
parents:
diff changeset
28 --
kono
parents:
diff changeset
29 -- TEST DESCRIPTION:
kono
parents:
diff changeset
30 -- This test imports a simple C function and specifies it's location.
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- The implementation may choose to implement
kono
parents:
diff changeset
33 -- Impdef.CD30005_1_Foreign_Address so as to dynamically call a C
kono
parents:
diff changeset
34 -- function that returns the appropriate address for the external
kono
parents:
diff changeset
35 -- function identified by Impdef.CD30005_1_External_Name.
kono
parents:
diff changeset
36 --
kono
parents:
diff changeset
37 -- TEST FILES:
kono
parents:
diff changeset
38 -- CD300050.AM
kono
parents:
diff changeset
39 -- CD300051.C -- the C function: (included below for reference)
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- SPECIAL REQUIREMENTS:
kono
parents:
diff changeset
42 -- The file CD300051.C must be compiled with a C compiler.
kono
parents:
diff changeset
43 -- Implementation dialects of C may require alteration of the C program
kono
parents:
diff changeset
44 -- syntax. The program is included here for reference:
kono
parents:
diff changeset
45 --
kono
parents:
diff changeset
46 -- int _cd30005_1( Value )
kono
parents:
diff changeset
47 -- {
kono
parents:
diff changeset
48 -- /* int Value */
kono
parents:
diff changeset
49 --
kono
parents:
diff changeset
50 -- return Value + 1;
kono
parents:
diff changeset
51 -- }
kono
parents:
diff changeset
52 --
kono
parents:
diff changeset
53 -- Implementations may require special linkage commands to include the
kono
parents:
diff changeset
54 -- C code.
kono
parents:
diff changeset
55 --
kono
parents:
diff changeset
56 -- APPLICABILITY CRITERIA:
kono
parents:
diff changeset
57 -- This test is not applicable to implementations not providing an interface
kono
parents:
diff changeset
58 -- to C language units. OTHERWISE:
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 -- All implementations must attempt to compile this test.
kono
parents:
diff changeset
61 --
kono
parents:
diff changeset
62 -- For implementations validating against Systems Programming Annex (C):
kono
parents:
diff changeset
63 -- this test must execute and report PASSED.
kono
parents:
diff changeset
64 --
kono
parents:
diff changeset
65 -- For implementations not validating against Annex C:
kono
parents:
diff changeset
66 -- this test may report compile time errors at one or more points
kono
parents:
diff changeset
67 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
kono
parents:
diff changeset
68 -- Otherwise, the test must execute and report PASSED.
kono
parents:
diff changeset
69 --
kono
parents:
diff changeset
70 --
kono
parents:
diff changeset
71 -- CHANGE HISTORY:
kono
parents:
diff changeset
72 -- 22 JUL 95 SAIC Initial version
kono
parents:
diff changeset
73 -- 30 APR 96 SAIC Added commentary for 2.1
kono
parents:
diff changeset
74 -- 09 MAY 96 SAIC Changed reporting for 2.1
kono
parents:
diff changeset
75 -- 04 NOV 96 SAIC Added use type System.Address
kono
parents:
diff changeset
76 -- 16 FEB 98 EDS Modified documentation.
kono
parents:
diff changeset
77 -- 29 JUN 98 EDS Modified main program name.
kono
parents:
diff changeset
78 --!
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 ----------------------------------------------------------------- CD30005_0
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 with Impdef;
kono
parents:
diff changeset
83 package CD30005_0 is
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 -- Check that Address clauses are supported for imported subprograms.
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 type External_Func_Ref is access function(N:Integer) return Integer;
kono
parents:
diff changeset
88 pragma Convention( C, External_Func_Ref );
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 function CD30005_1( I: Integer ) return Integer;
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 pragma Import( C, CD30005_1,
kono
parents:
diff changeset
94 Impdef.CD30005_1_External_Name ); -- N/A => ERROR.
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 for CD30005_1'Address use
kono
parents:
diff changeset
97 Impdef.CD30005_1_Foreign_Address; -- ANX-C RQMT.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 procedure TC_Check_Imports;
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 end CD30005_0;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 with Report;
kono
parents:
diff changeset
106 with System.Storage_Elements;
kono
parents:
diff changeset
107 with System.Address_To_Access_Conversions;
kono
parents:
diff changeset
108 package body CD30005_0 is
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 use type System.Address;
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 procedure TC_Check_Imports is
kono
parents:
diff changeset
113 S : External_Func_Ref := CD30005_1'Access;
kono
parents:
diff changeset
114 I,K : Integer := 99;
kono
parents:
diff changeset
115 begin
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 K := S.all(I);
kono
parents:
diff changeset
118 if K /= 100 then
kono
parents:
diff changeset
119 Report.Failed("C program returned" & Integer'Image(K));
kono
parents:
diff changeset
120 end if;
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 I := CD30005_1( I );
kono
parents:
diff changeset
123 if I /= 100 then
kono
parents:
diff changeset
124 Report.Failed("C program returned" & Integer'Image(I));
kono
parents:
diff changeset
125 end if;
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 if CD30005_1'Address /= Impdef.CD30005_1_Foreign_Address then
kono
parents:
diff changeset
128 Report.Failed("Address not that specified");
kono
parents:
diff changeset
129 end if;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 end TC_Check_Imports;
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 end CD30005_0;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 ------------------------------------------------------------------- CD300050
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 with Report;
kono
parents:
diff changeset
138 with CD30005_0;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 procedure CD300050 is
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 begin -- Main test procedure.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 Report.Test ("CD30005",
kono
parents:
diff changeset
145 "Check that Address clauses are supported for imported " &
kono
parents:
diff changeset
146 "subprograms" );
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 -- Check that Address clauses are supported for imported subprograms.
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 CD30005_0.TC_Check_Imports;
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 Report.Result;
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 end CD300050;