-- CA15003.A
|
-- CA15003.A
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE
|
-- OBJECTIVE
|
-- Check the requirements of 10.1.5(4) and the modified 10.1.5(5)
|
-- Check the requirements of 10.1.5(4) and the modified 10.1.5(5)
|
-- from Technical Corrigendum 1. (Originally discussed as AI95-00136.)
|
-- from Technical Corrigendum 1. (Originally discussed as AI95-00136.)
|
-- Specifically:
|
-- Specifically:
|
-- Check that program unit pragma for a generic package are accepted
|
-- Check that program unit pragma for a generic package are accepted
|
-- when given at the beginning of the package specification.
|
-- when given at the beginning of the package specification.
|
-- Check that a program unit pragma can be given for a generic
|
-- Check that a program unit pragma can be given for a generic
|
-- instantiation by placing the pragma immediately after the instantation.
|
-- instantiation by placing the pragma immediately after the instantation.
|
--
|
--
|
-- TEST DESCRIPTION
|
-- TEST DESCRIPTION
|
-- This test checks the cases that are *not* forbidden by the RM,
|
-- This test checks the cases that are *not* forbidden by the RM,
|
-- and makes sure such legal cases actually work.
|
-- and makes sure such legal cases actually work.
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 29 JUN 1999 RAD Initial Version
|
-- 29 JUN 1999 RAD Initial Version
|
-- 08 JUL 1999 RLB Cleaned up and added to test suite.
|
-- 08 JUL 1999 RLB Cleaned up and added to test suite.
|
-- 27 AUG 1999 RLB Repaired errors introduced by me.
|
-- 27 AUG 1999 RLB Repaired errors introduced by me.
|
--
|
--
|
--!
|
--!
|
|
|
with System;
|
with System;
|
package CA15003A is
|
package CA15003A is
|
pragma Pure;
|
pragma Pure;
|
|
|
type Big_Int is range -System.Max_Int .. System.Max_Int;
|
type Big_Int is range -System.Max_Int .. System.Max_Int;
|
type Big_Positive is new Big_Int range 1..Big_Int'Last;
|
type Big_Positive is new Big_Int range 1..Big_Int'Last;
|
end CA15003A;
|
end CA15003A;
|
|
|
generic
|
generic
|
type Int is new Big_Int;
|
type Int is new Big_Int;
|
package CA15003A.Pure is
|
package CA15003A.Pure is
|
pragma Pure;
|
pragma Pure;
|
function F(X: access Int) return Int;
|
function F(X: access Int) return Int;
|
end CA15003A.Pure;
|
end CA15003A.Pure;
|
|
|
with CA15003A.Pure;
|
with CA15003A.Pure;
|
package CA15003A.Pure_Instance is new CA15003A.Pure(Int => Big_Positive);
|
package CA15003A.Pure_Instance is new CA15003A.Pure(Int => Big_Positive);
|
pragma Pure(CA15003A.Pure_Instance);
|
pragma Pure(CA15003A.Pure_Instance);
|
|
|
package body CA15003A.Pure is
|
package body CA15003A.Pure is
|
function F(X: access Int) return Int is
|
function F(X: access Int) return Int is
|
begin
|
begin
|
X.all := X.all + 1;
|
X.all := X.all + 1;
|
return X.all;
|
return X.all;
|
end F;
|
end F;
|
end CA15003A.Pure;
|
end CA15003A.Pure;
|
|
|
generic
|
generic
|
package CA15003A.Pure.Preelaborate is
|
package CA15003A.Pure.Preelaborate is
|
pragma Preelaborate;
|
pragma Preelaborate;
|
One: Int := 1;
|
One: Int := 1;
|
function F(X: access Int) return Int;
|
function F(X: access Int) return Int;
|
end CA15003A.Pure.Preelaborate;
|
end CA15003A.Pure.Preelaborate;
|
|
|
package body CA15003A.Pure.Preelaborate is
|
package body CA15003A.Pure.Preelaborate is
|
function F(X: access Int) return Int is
|
function F(X: access Int) return Int is
|
begin
|
begin
|
X.all := X.all + One;
|
X.all := X.all + One;
|
return X.all;
|
return X.all;
|
end F;
|
end F;
|
end CA15003A.Pure.Preelaborate;
|
end CA15003A.Pure.Preelaborate;
|
|
|
with CA15003A.Pure_Instance;
|
with CA15003A.Pure_Instance;
|
with CA15003A.Pure.Preelaborate;
|
with CA15003A.Pure.Preelaborate;
|
package CA15003A.Pure_Preelaborate_Instance is
|
package CA15003A.Pure_Preelaborate_Instance is
|
new CA15003A.Pure_Instance.Preelaborate;
|
new CA15003A.Pure_Instance.Preelaborate;
|
pragma Preelaborate(CA15003A.Pure_Preelaborate_Instance);
|
pragma Preelaborate(CA15003A.Pure_Preelaborate_Instance);
|
|
|
package CA15003A.Empty_Pure is
|
package CA15003A.Empty_Pure is
|
pragma Pure;
|
pragma Pure;
|
pragma Elaborate_Body;
|
pragma Elaborate_Body;
|
end CA15003A.Empty_Pure;
|
end CA15003A.Empty_Pure;
|
|
|
package body CA15003A.Empty_Pure is
|
package body CA15003A.Empty_Pure is
|
end CA15003A.Empty_Pure;
|
end CA15003A.Empty_Pure;
|
|
|
package CA15003A.Empty_Preelaborate is
|
package CA15003A.Empty_Preelaborate is
|
pragma Preelaborate;
|
pragma Preelaborate;
|
pragma Elaborate_Body;
|
pragma Elaborate_Body;
|
One: Big_Int := 1;
|
One: Big_Int := 1;
|
end CA15003A.Empty_Preelaborate;
|
end CA15003A.Empty_Preelaborate;
|
|
|
package body CA15003A.Empty_Preelaborate is
|
package body CA15003A.Empty_Preelaborate is
|
function F(X: access Big_Int) return Big_Int is
|
function F(X: access Big_Int) return Big_Int is
|
begin
|
begin
|
X.all := X.all + One;
|
X.all := X.all + One;
|
return X.all;
|
return X.all;
|
end F;
|
end F;
|
end CA15003A.Empty_Preelaborate;
|
end CA15003A.Empty_Preelaborate;
|
|
|
package CA15003A.Empty_Elaborate_Body is
|
package CA15003A.Empty_Elaborate_Body is
|
pragma Elaborate_Body;
|
pragma Elaborate_Body;
|
Three: aliased Big_Positive := 1;
|
Three: aliased Big_Positive := 1;
|
Two, Tres: Big_Positive'Base := 0;
|
Two, Tres: Big_Positive'Base := 0;
|
end CA15003A.Empty_Elaborate_Body;
|
end CA15003A.Empty_Elaborate_Body;
|
|
|
with Report; use Report; pragma Elaborate_All(Report);
|
with Report; use Report; pragma Elaborate_All(Report);
|
with CA15003A.Pure_Instance;
|
with CA15003A.Pure_Instance;
|
with CA15003A.Pure_Preelaborate_Instance;
|
with CA15003A.Pure_Preelaborate_Instance;
|
use CA15003A;
|
use CA15003A;
|
package body CA15003A.Empty_Elaborate_Body is
|
package body CA15003A.Empty_Elaborate_Body is
|
begin
|
begin
|
if Two /= Big_Positive'Base(Ident_Int(0)) then
|
if Two /= Big_Positive'Base(Ident_Int(0)) then
|
Failed ("Two should be zero now");
|
Failed ("Two should be zero now");
|
end if;
|
end if;
|
if Tres /= Big_Positive'Base(Ident_Int(0)) then
|
if Tres /= Big_Positive'Base(Ident_Int(0)) then
|
Failed ("Tres should be zero now");
|
Failed ("Tres should be zero now");
|
end if;
|
end if;
|
if Two /= Tres then
|
if Two /= Tres then
|
Failed ("Tres should be zero now");
|
Failed ("Tres should be zero now");
|
end if;
|
end if;
|
Two := Pure_Instance.F(Three'Access);
|
Two := Pure_Instance.F(Three'Access);
|
Tres := Pure_Preelaborate_Instance.F(Three'Access);
|
Tres := Pure_Preelaborate_Instance.F(Three'Access);
|
if Two /= Big_Positive(Ident_Int(2)) then
|
if Two /= Big_Positive(Ident_Int(2)) then
|
Failed ("Two should be 2 now");
|
Failed ("Two should be 2 now");
|
end if;
|
end if;
|
if Tres /= Big_Positive(Ident_Int(3)) then
|
if Tres /= Big_Positive(Ident_Int(3)) then
|
Failed ("Tres should be 3 now");
|
Failed ("Tres should be 3 now");
|
end if;
|
end if;
|
end CA15003A.Empty_Elaborate_Body;
|
end CA15003A.Empty_Elaborate_Body;
|
|
|
with Report; use Report;
|
with Report; use Report;
|
with CA15003A.Empty_Pure;
|
with CA15003A.Empty_Pure;
|
with CA15003A.Empty_Preelaborate;
|
with CA15003A.Empty_Preelaborate;
|
with CA15003A.Empty_Elaborate_Body; use CA15003A.Empty_Elaborate_Body;
|
with CA15003A.Empty_Elaborate_Body; use CA15003A.Empty_Elaborate_Body;
|
use type CA15003A.Big_Positive'Base;
|
use type CA15003A.Big_Positive'Base;
|
procedure CA15003 is
|
procedure CA15003 is
|
begin
|
begin
|
Test("CA15003", "Placement of Program Unit Pragmas in Generic Packages");
|
Test("CA15003", "Placement of Program Unit Pragmas in Generic Packages");
|
if Two /= 2 then
|
if Two /= 2 then
|
Failed ("Two should be 2 now");
|
Failed ("Two should be 2 now");
|
end if;
|
end if;
|
if Tres /= 3 then
|
if Tres /= 3 then
|
Failed ("Tres should be 3 now");
|
Failed ("Tres should be 3 now");
|
end if;
|
end if;
|
Result;
|
Result;
|
end CA15003;
|
end CA15003;
|
|
|