-- CD10001.A
|
-- CD10001.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 that representation items may contain nonstatic expressions
|
-- Check that representation items may contain nonstatic expressions
|
-- in the case that each expression in the representation item is a
|
-- in the case that each expression in the representation item is a
|
-- name that statically denotes a constant declared before the entity.
|
-- name that statically denotes a constant declared before the entity.
|
--
|
--
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- For each of the specific items in the objective, this test checks
|
-- For each of the specific items in the objective, this test checks
|
-- an example of each of the categories of representation specification
|
-- an example of each of the categories of representation specification
|
-- that are applicable to that objective, to wit:
|
-- that are applicable to that objective, to wit:
|
-- address clause ....................... Expressions need not be static
|
-- address clause ....................... Expressions need not be static
|
-- alignment clause ..................... Expressions must be static
|
-- alignment clause ..................... Expressions must be static
|
-- bit order clause ..................... Not tested
|
-- bit order clause ..................... Not tested
|
-- component size clause ................ Expressions must be static
|
-- component size clause ................ Expressions must be static
|
-- enumeration representation clause .... Expressions must be static
|
-- enumeration representation clause .... Expressions must be static
|
-- external tag clause .................. Expressions must be static
|
-- external tag clause .................. Expressions must be static
|
-- Import, Export and Convention pragmas Not tested
|
-- Import, Export and Convention pragmas Not tested
|
-- input clause ......................... Not tested
|
-- input clause ......................... Not tested
|
-- output clause ........................ Not tested
|
-- output clause ........................ Not tested
|
-- Pack pragma .......................... Not tested
|
-- Pack pragma .......................... Not tested
|
-- read clause .......................... Not tested
|
-- read clause .......................... Not tested
|
-- record representation clause ......... Expressions must be static
|
-- record representation clause ......... Expressions must be static
|
-- size clause .......................... Expressions must be static
|
-- size clause .......................... Expressions must be static
|
-- small clause ......................... Expressions must be static
|
-- small clause ......................... Expressions must be static
|
-- storage pool clause .................. Not tested
|
-- storage pool clause .................. Not tested
|
-- storage size clause .................. Expressions must be static
|
-- storage size clause .................. Expressions must be static
|
-- write clause ......................... Not tested
|
-- write clause ......................... Not tested
|
--
|
--
|
-- APPLICABILITY CRITERIA:
|
-- APPLICABILITY CRITERIA:
|
-- All implementations must attempt to compile this test.
|
-- All implementations must attempt to compile this test.
|
--
|
--
|
-- For implementations validating against Systems Programming Annex (C):
|
-- For implementations validating against Systems Programming Annex (C):
|
-- this test must execute.
|
-- this test must execute.
|
--
|
--
|
-- For implementations not validating against Annex C:
|
-- For implementations not validating against Annex C:
|
-- if this test compiles without error messages at compilation,
|
-- if this test compiles without error messages at compilation,
|
-- it must bind and execute.
|
-- it must bind and execute.
|
--
|
--
|
-- PASS/FAIL CRITERIA:
|
-- PASS/FAIL CRITERIA:
|
-- For implementations validating against Systems Programming Annex (C):
|
-- For implementations validating against Systems Programming Annex (C):
|
-- this test must execute, report PASSED, and complete normally,
|
-- this test must execute, report PASSED, and complete normally,
|
-- otherwise the test FAILS
|
-- otherwise the test FAILS
|
--
|
--
|
-- For implementations not validating against Annex C:
|
-- For implementations not validating against Annex C:
|
-- PASSING behavior is:
|
-- PASSING behavior is:
|
-- this test executes, reports PASSED, and completes normally
|
-- this test executes, reports PASSED, and completes normally
|
-- or
|
-- or
|
-- this test executes and reports NOT_APPLICABLE
|
-- this test executes and reports NOT_APPLICABLE
|
-- or
|
-- or
|
-- this test produces at least one error message at compilation, and
|
-- this test produces at least one error message at compilation, and
|
-- the error message is associated with one of the items marked:
|
-- the error message is associated with one of the items marked:
|
-- -- N/A => ERROR.
|
-- -- N/A => ERROR.
|
--
|
--
|
-- All other behaviors are FAILING.
|
-- All other behaviors are FAILING.
|
--
|
--
|
|
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 11 JUL 95 SAIC Initial version
|
-- 11 JUL 95 SAIC Initial version
|
-- 10 MAR 97 PWB.CTA Made Nonstatic_Entity nonstatic; changed
|
-- 10 MAR 97 PWB.CTA Made Nonstatic_Entity nonstatic; changed
|
-- Tenths'Small from 1.0/32.0 to 1.0/10.0,
|
-- Tenths'Small from 1.0/32.0 to 1.0/10.0,
|
-- as expected by the later check; improved
|
-- as expected by the later check; improved
|
-- internal documentation.
|
-- internal documentation.
|
-- 16 FEB 98 EDS Modified test documentation.
|
-- 16 FEB 98 EDS Modified test documentation.
|
-- 24 NOV 98 RLB Changed Tenths'Small to 1.0/32.0, as this is
|
-- 24 NOV 98 RLB Changed Tenths'Small to 1.0/32.0, as this is
|
-- necessary so that all implementations can
|
-- necessary so that all implementations can
|
-- process this test. (3.5.9(21) means non-binary
|
-- process this test. (3.5.9(21) means non-binary
|
-- smalls are optional.)
|
-- smalls are optional.)
|
-- 11 MAR 99 RLB Merged versions. Most EDS changes removed (as
|
-- 11 MAR 99 RLB Merged versions. Most EDS changes removed (as
|
-- they made the test less applicable than the ACAA
|
-- they made the test less applicable than the ACAA
|
-- version).
|
-- version).
|
--!
|
--!
|
|
|
----------------------------------------------------------------- CD10001_0
|
----------------------------------------------------------------- CD10001_0
|
|
|
with System;
|
with System;
|
with System.Storage_Elements;
|
with System.Storage_Elements;
|
with Impdef;
|
with Impdef;
|
with SPPRT13;
|
with SPPRT13;
|
package CD10001_0 is
|
package CD10001_0 is
|
|
|
-- a few types and objects to work with.
|
-- a few types and objects to work with.
|
|
|
type Int is range -2048 .. 2047;
|
type Int is range -2048 .. 2047;
|
My_Int : Int := 1024;
|
My_Int : Int := 1024;
|
|
|
type Enumeration is (First, Second, Third, Fourth, Fifth);
|
type Enumeration is (First, Second, Third, Fourth, Fifth);
|
|
|
-- a few names that statically denote constants:
|
-- a few names that statically denote constants:
|
|
|
Nonstatic_Entity : constant System.Address := -- Non-static
|
Nonstatic_Entity : constant System.Address := -- Non-static
|
System.Storage_Elements."+"
|
System.Storage_Elements."+"
|
( SPPRT13.Variable_Address,
|
( SPPRT13.Variable_Address,
|
System.Storage_Elements.Storage_Offset'(0) );
|
System.Storage_Elements.Storage_Offset'(0) );
|
|
|
Tag_String : constant String := Impdef.External_Tag_Value; -- Static
|
Tag_String : constant String := Impdef.External_Tag_Value; -- Static
|
-- Check to ensure that Tag_String is static
|
-- Check to ensure that Tag_String is static
|
Tag_String_Length : constant := Tag_String'Length;
|
Tag_String_Length : constant := Tag_String'Length;
|
|
|
A_Reasonable_Size_Value : constant := System.Storage_Unit; -- Static
|
A_Reasonable_Size_Value : constant := System.Storage_Unit; -- Static
|
|
|
Zero : constant := 0; -- Static
|
Zero : constant := 0; -- Static
|
One : constant := 1; -- Static
|
One : constant := 1; -- Static
|
Two : constant := 2; -- Static
|
Two : constant := 2; -- Static
|
Three : constant := 3; -- Static
|
Three : constant := 3; -- Static
|
Four : constant := 4; -- Static
|
Four : constant := 4; -- Static
|
Five : constant := 5; -- Static
|
Five : constant := 5; -- Static
|
|
|
K : constant Int := My_Int; -- Non-Static
|
K : constant Int := My_Int; -- Non-Static
|
|
|
-- Check that representation items containing nonstatic expressions are
|
-- Check that representation items containing nonstatic expressions are
|
-- supported in the case that the representation item is a name that
|
-- supported in the case that the representation item is a name that
|
-- statically denotes a constant declared before the entity.
|
-- statically denotes a constant declared before the entity.
|
--
|
--
|
-- address clause
|
-- address clause
|
-- Expression must be static - RM 13.3(12)
|
-- Expression must be static - RM 13.3(12)
|
|
|
Object_Address : Enumeration;
|
Object_Address : Enumeration;
|
for Object_Address'Address use Nonstatic_Entity; -- N/A => ERROR.
|
for Object_Address'Address use Nonstatic_Entity; -- N/A => ERROR.
|
|
|
-- alignment clause
|
-- alignment clause
|
-- Expression must be static - RM 13.3(25)
|
-- Expression must be static - RM 13.3(25)
|
|
|
Object_Alignment : Enumeration;
|
Object_Alignment : Enumeration;
|
for Object_Alignment'Alignment use One; -- N/A => ERROR.
|
for Object_Alignment'Alignment use One; -- N/A => ERROR.
|
|
|
-- bit order clause
|
-- bit order clause
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- component size clause
|
-- component size clause
|
-- Expression must be static - RM 13.3(69)
|
-- Expression must be static - RM 13.3(69)
|
|
|
type Array_With_Components is array(1..10) of Enumeration;
|
type Array_With_Components is array(1..10) of Enumeration;
|
for Array_With_Components'Component_Size
|
for Array_With_Components'Component_Size
|
use A_Reasonable_Size_Value; -- N/A => ERROR.
|
use A_Reasonable_Size_Value; -- N/A => ERROR.
|
|
|
-- enumeration representation clause
|
-- enumeration representation clause
|
-- Expressions must be static - RM 13.4(6)
|
-- Expressions must be static - RM 13.4(6)
|
|
|
type Enumeration_1 is (First, Second, Third);
|
type Enumeration_1 is (First, Second, Third);
|
for Enumeration_1 use (First => One, Second => Two, Third => Three);
|
for Enumeration_1 use (First => One, Second => Two, Third => Three);
|
|
|
-- external tag clause
|
-- external tag clause
|
-- Expression must be static - RM 13.3(75)
|
-- Expression must be static - RM 13.3(75)
|
|
|
type Some_Tagged_Type is tagged null record;
|
type Some_Tagged_Type is tagged null record;
|
for Some_Tagged_Type'External_Tag use Tag_String; -- N/A => ERROR.
|
for Some_Tagged_Type'External_Tag use Tag_String; -- N/A => ERROR.
|
|
|
-- Import, Export and Convention pragmas
|
-- Import, Export and Convention pragmas
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- input clause
|
-- input clause
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- output clause
|
-- output clause
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- Pack pragma
|
-- Pack pragma
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- read clause
|
-- read clause
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
-- record representation clause
|
-- record representation clause
|
-- Expressions must be static - RM 13.3(10)
|
-- Expressions must be static - RM 13.3(10)
|
|
|
type Record_To_Layout is record
|
type Record_To_Layout is record
|
Bit_0 : Boolean;
|
Bit_0 : Boolean;
|
Bit_1 : Boolean;
|
Bit_1 : Boolean;
|
end record;
|
end record;
|
for Record_To_Layout use record -- N/A => ERROR.
|
for Record_To_Layout use record -- N/A => ERROR.
|
Bit_0 at Zero range Zero..Zero; -- N/A => ERROR.
|
Bit_0 at Zero range Zero..Zero; -- N/A => ERROR.
|
Bit_1 at Zero range Four..Four; -- N/A => ERROR.
|
Bit_1 at Zero range Four..Four; -- N/A => ERROR.
|
end record; -- N/A => ERROR.
|
end record; -- N/A => ERROR.
|
|
|
-- size clause
|
-- size clause
|
-- Expression must be static - RM 13.3(41)
|
-- Expression must be static - RM 13.3(41)
|
|
|
Object_Size : Enumeration;
|
Object_Size : Enumeration;
|
for Object_Size'Size use A_Reasonable_Size_Value; -- N/A => ERROR.
|
for Object_Size'Size use A_Reasonable_Size_Value; -- N/A => ERROR.
|
|
|
-- small clause
|
-- small clause
|
-- Expression must be static - RM 3.5.10(2)
|
-- Expression must be static - RM 3.5.10(2)
|
|
|
type Tenths is delta 0.1 range 0.0..10.0;
|
type Tenths is delta 0.1 range 0.0..10.0;
|
for Tenths'Small use 1.0 / (Two ** Five); -- N/A => ERROR.
|
for Tenths'Small use 1.0 / (Two ** Five); -- N/A => ERROR.
|
|
|
-- storage pool clause
|
-- storage pool clause
|
-- Not tested
|
-- Not tested
|
|
|
-- storage size clause
|
-- storage size clause
|
-- Expression may be non-static - RM 13.11(15)
|
-- Expression may be non-static - RM 13.11(15)
|
type Reference is access Record_To_Layout;
|
type Reference is access Record_To_Layout;
|
for Reference'Storage_Size use Four * K; -- N/A => ERROR.
|
for Reference'Storage_Size use Four * K; -- N/A => ERROR.
|
|
|
|
|
-- write clause
|
-- write clause
|
-- no interesting test can be specified
|
-- no interesting test can be specified
|
|
|
procedure TC_Check_Values;
|
procedure TC_Check_Values;
|
|
|
end CD10001_0;
|
end CD10001_0;
|
|
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
|
|
with TCTouch;
|
with TCTouch;
|
package body CD10001_0 is
|
package body CD10001_0 is
|
|
|
use type System.Address;
|
use type System.Address;
|
|
|
procedure Assert( Truth : Boolean; Message: String ) is
|
procedure Assert( Truth : Boolean; Message: String ) is
|
begin
|
begin
|
if not Truth then
|
if not Truth then
|
TCTouch.Implementation_Check( Message );
|
TCTouch.Implementation_Check( Message );
|
end if;
|
end if;
|
end Assert;
|
end Assert;
|
|
|
procedure TC_Check_Values is
|
procedure TC_Check_Values is
|
Record_Object : Record_To_Layout;
|
Record_Object : Record_To_Layout;
|
begin
|
begin
|
|
|
Assert(Object_Address'Address = Nonstatic_Entity,
|
Assert(Object_Address'Address = Nonstatic_Entity,
|
"Object not at specified address");
|
"Object not at specified address");
|
|
|
Assert(Object_Alignment'Alignment >= One,
|
Assert(Object_Alignment'Alignment >= One,
|
"Object not at specified alignment");
|
"Object not at specified alignment");
|
|
|
Assert(Array_With_Components'Component_Size = A_Reasonable_Size_Value,
|
Assert(Array_With_Components'Component_Size = A_Reasonable_Size_Value,
|
"Array Components not specified size");
|
"Array Components not specified size");
|
|
|
-- I don't see how to reliably check this one:
|
-- I don't see how to reliably check this one:
|
--
|
--
|
-- type Enumeration_1 is (First, Second, Third);
|
-- type Enumeration_1 is (First, Second, Third);
|
-- for Enumeration_1 use (First => One, Second => Two, Third => Three);
|
-- for Enumeration_1 use (First => One, Second => Two, Third => Three);
|
|
|
Assert(Some_Tagged_Type'External_Tag = Tag_String,
|
Assert(Some_Tagged_Type'External_Tag = Tag_String,
|
"External_Tag not specified value");
|
"External_Tag not specified value");
|
Assert(Record_Object.Bit_0'First_Bit = Zero,
|
Assert(Record_Object.Bit_0'First_Bit = Zero,
|
"Record object First_Bit not zero");
|
"Record object First_Bit not zero");
|
|
|
Assert(Record_Object.Bit_1'Last_Bit = Four,
|
Assert(Record_Object.Bit_1'Last_Bit = Four,
|
"Record object Last_Bit not four");
|
"Record object Last_Bit not four");
|
|
|
Assert(Object_Size'Size = A_Reasonable_Size_Value,
|
Assert(Object_Size'Size = A_Reasonable_Size_Value,
|
"Object size not specified value");
|
"Object size not specified value");
|
|
|
Assert(Tenths'Small = 1.0 / Two ** Five,
|
Assert(Tenths'Small = 1.0 / Two ** Five,
|
"Tenths small not specified value");
|
"Tenths small not specified value");
|
|
|
Assert(Reference'Storage_Size = 4096, -- Four * K,
|
Assert(Reference'Storage_Size = 4096, -- Four * K,
|
"Reference storage size not specified value");
|
"Reference storage size not specified value");
|
|
|
end TC_Check_Values;
|
end TC_Check_Values;
|
|
|
end CD10001_0;
|
end CD10001_0;
|
|
|
------------------------------------------------------------------- CD10001
|
------------------------------------------------------------------- CD10001
|
|
|
with Report;
|
with Report;
|
with CD10001_0;
|
with CD10001_0;
|
|
|
procedure CD10001 is
|
procedure CD10001 is
|
|
|
begin -- Main test procedure.
|
begin -- Main test procedure.
|
|
|
Report.Test ("CD10001", "Check that representation items containing " &
|
Report.Test ("CD10001", "Check that representation items containing " &
|
"nonstatic expressions are supported in the " &
|
"nonstatic expressions are supported in the " &
|
"case that the representation item is a name " &
|
"case that the representation item is a name " &
|
"that statically denotes a constant declared " &
|
"that statically denotes a constant declared " &
|
"before the entity" );
|
"before the entity" );
|
|
|
CD10001_0.TC_Check_Values;
|
CD10001_0.TC_Check_Values;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CD10001;
|
end CD10001;
|
|
|