file_text stringlengths 1 2.1M ⌀ | language stringclasses 416
values | file_name stringlengths 1 185 ⌀ |
|---|---|---|
-- { dg-do compile }
procedure div_no_warning is
Flag : constant Boolean := False;
Var : Boolean := True;
function F return Boolean is
begin
return Var;
end F;
Int : Integer := 0;
begin
if Flag and then F then
Int := Int / 0;
end if;
end div_no_warning;
| Ada | div_no_warning.adb |
-- { dg-do run }
-- { dg-skip-if "divide does not trap" { powerpc*-*-* } }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
-- to disable it if this code hasn't been implemented yet.
procedure Div_Zero is
p... | Ada | div_zero.adb |
-- Copyright 2011-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | dn.adb |
-- Copyright 2011-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | dn.ads |
-- { dg-do compile }
package double_record_extension1 is
type T1(n: natural) is tagged record
s1: string (1..n);
end record;
type T2(j,k: natural) is new T1(j) with record
s2: string (1..k);
end record;
type T3 is new T2 (10, 10) with null record;
end double_record_extension1;
| Ada | double_record_extension1.ads |
-- { dg-do compile }
package double_record_extension2 is
type Base_Message_Type (Num_Bytes : Positive) is tagged record
Data_Block : String (1..Num_Bytes);
end record;
type Extended_Message_Type (Num_Bytes1 : Positive; Num_Bytes2 : Positive) is new Base_Message_Type (Num_Bytes1) with record
A: Strin... | Ada | double_record_extension2.ads |
-- { dg-do compile }
package Double_Record_Extension3 is
type Rec1 is tagged record
Id : Integer;
end record;
for Rec1 use record
Id at 8 range 0 .. 31;
end record;
type Rec2 (Size : Integer) is new Rec1 with record
Data : String (1 .. Size);
end record;
type Rec3 is new Rec2... | Ada | double_record_extension3.ads |
package body Dse_Step is
procedure Do_Step (This : in out Counter) is
begin
This.Value := This.Value + This.Step;
end;
procedure Step_From (Start : in My_Counter) is
Lc : My_Counter := Start;
begin
while Nsteps > 0 loop
Do_Step (Lc);
Nsteps := Nsteps - 1;
end l... | Ada | dse_step.adb |
package Dse_Step is
type Counter is record
Value : Natural;
Step : Natural;
end record;
pragma Suppress_Initialization (Counter);
procedure Do_Step (This : in out Counter);
pragma Inline (Do_Step);
type My_Counter is new Counter;
pragma Suppress_Initialization (My_Counter);
proc... | Ada | dse_step.ads |
-- Copyright 2005-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | dummy.adb |
-- { dg-do compile }
with Text_IO; use Text_IO;
procedure Dump (A : System.Address; Len : Storage_Offset) is
Arr : Storage_Array (1 .. Len);
for Arr'Address use A;
pragma Import (Ada, Arr);
H : constant array (Storage_Element range 0 .. 15) of Character :=
"0123456789abcdef";
begin
for J in ... | Ada | dump.adb |
with System.Storage_Elements; use System.Storage_Elements;
procedure Dump (A : System.Address; Len : Storage_Offset);
| Ada | dump.ads |
-- { dg-do compile }
-- { dg-options "-gnato" }
procedure Dynamic_Bound is
procedure Define (Count : Integer) is
type Count_T is new Integer range 0 .. Count * 1000;
type Obj_T is record
Count : Count_T;
end record;
type T is access Obj_T ;
procedure Create (S : in out T) is
begin
... | Ada | dynamic_bound.adb |
-- { dg-do compile }
-- { dg-options "-gnatE" }
package body Dynamic_Elab1 is
function Get_Plot return Plot is
procedure Fill (X : out Plot) is
begin
X.Data := Get_R;
end;
X : Plot;
begin
Fill(X);
return X;
end;
end Dynamic_Elab1;
| Ada | dynamic_elab1.adb |
with Dynamic_Elab_Pkg; use Dynamic_Elab_Pkg;
package Dynamic_Elab1 is
type Plot is record
Data : R;
end record;
pragma Pack (Plot);
function Get_Plot return Plot;
end Dynamic_Elab1;
| Ada | dynamic_elab1.ads |
-- { dg-do compile }
-- { dg-options "-gnatE" }
package body Dynamic_Elab2 is
function Get_Plot return Plot is
procedure Fill (X : out Plot) is
begin
X.Data := Get_R;
end;
X : Plot;
begin
Fill(X);
return X;
end;
end Dynamic_Elab2;
| Ada | dynamic_elab2.adb |
with Dynamic_Elab_Pkg; use Dynamic_Elab_Pkg;
package Dynamic_Elab2 is
type Plot is record
B : Boolean;
Data : R;
end record;
pragma Pack (Plot);
function Get_Plot return Plot;
end Dynamic_Elab2;
| Ada | dynamic_elab2.ads |
package Dynamic_Elab_Pkg is
type R is record
Code : Integer;
Val : Boolean;
end record;
function Get_R return R;
end Dynamic_Elab_Pkg;
| Ada | dynamic_elab_pkg.ads |
-- { dg-do run }
with Ada.Text_IO; use Ada.Text_IO;
with GNAT; use GNAT;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
procedure Dynhash is
procedure Destroy (Val : in out Integer) is null;
function Hash (Key : Integer) return Bucket_Range_Type;
package DHT is new Dynamic_Ha... | Ada | dynhash.adb |
-- { dg-do run }
with Ada.Text_IO; use Ada.Text_IO;
with GNAT; use GNAT;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
procedure Dynhash1 is
procedure Destroy (Val : in out Integer) is null;
function Hash (Key : Integer) return Bucket_Range_Type is
begin
return Bucket_R... | Ada | dynhash1.adb |
-- E28002B.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | e28002b.ada |
PRAGMA PAGE;
-- E28005D.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-... | Ada | e28005d.ada |
-- E52103Y.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | e52103y.ada |
-- EB4011A.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | eb4011a.ada |
-- EB4012A.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | eb4012a.ada |
-- EB4014A.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | eb4014a.ada |
-- EE3203A.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | ee3203a.ada |
-- EE3204A.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | ee3204a.ada |
-- EE3402B.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | ee3402b.ada |
-- EE3409F.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | ee3409f.ada |
-- EE3412C.ADA
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimit... | Ada | ee3412c.ada |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | einfo-utils.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | einfo-utils.ads |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | einfo.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | einfo.ads |
package elab1 is
-- the forward declaration is the trigger
type Stream;
type Stream_Ptr is access Stream;
type Stream is array (Positive range <>) of Character;
function Get_Size (S : Stream_Ptr) return Natural;
type Rec (Size : Natural) is
record
B : Boolean;
end record;
M... | Ada | elab1.ads |
-- { dg-do compile }
pragma Restrictions(No_Elaboration_Code);
with System;
package Elab1 is
type Ptrs_Type is array (Integer range 1 .. 2) of System.Address;
type Vars_Array is array (Integer range 1 .. 2) of Integer;
Vars : Vars_Array;
Val1 : constant Integer := 1;
Val2 : constant Integer := 2;
... | Ada | elab1_1.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
with elab1;
procedure elab2 is
A : elab1.My_Rec;
begin
null;
end;
| Ada | elab2.adb |
-- { dg-do compile }
with Elab2_Pkg; use Elab2_Pkg;
package Elab2 is
type Num is (One, Two);
type Rec2 (D : Index_Type := 0) is record
Data : Rec1(D);
end record;
type Rec3 (D : Num) is record
case D is
when One => R : Rec2;
when others => null;
end case;
end reco... | Ada | elab2.ads |
-- { dg-excess-errors "no code generated" }
package Elab2_Pkg is
function Get_Value (S : String) return Integer;
Max_Limit : constant array(1..2) of Integer :=
(1 => Get_Value ("One"), 2 => Get_Value ("Two"));
type Index_Type is new Natural range 0 .. Max_Limit(1);
type Array_Type is array (Index_... | Ada | elab2_pkg.ads |
-- { dg-do compile }
with Elab3_Pkg;
package body Elab3 is
package Inst is new Elab3_Pkg (False, ABE);
procedure ABE is begin null; end ABE;
end Elab3;
| Ada | elab3.adb |
-- { dg-do compile }
pragma Restrictions(No_Elaboration_Code);
package Elab3 is
type T_List is array (Positive range <>) of Integer;
type T_List_Access is access constant T_List;
type R is record
A : T_List_Access;
end record;
C : constant R := (A => null);
end Elab3;
| Ada | elab3.ads |
package Elab3 is
procedure ABE;
end Elab3;
| Ada | elab3_1.ads |
package body Elab3_Pkg is
procedure Elaborator is
begin
Proc;
end Elaborator;
begin
if Elaborate then
Elaborator;
end if;
end Elab3_Pkg;
| Ada | elab3_pkg.adb |
generic
Elaborate : Boolean := True;
with procedure Proc;
package Elab3_Pkg is
procedure Elaborator;
end Elab3_Pkg;
| Ada | elab3_pkg.ads |
-- { dg-do link }
with Elab4_Pkg;
procedure Elab4 is begin null; end Elab4;
| Ada | elab4.adb |
-- { dg-do compile }
pragma Restrictions(No_Elaboration_Code);
with Elab4_Proc;
package Elab4 is
procedure My_G is new Elab4_Proc;
end Elab4;
-- { dg-final { scan-assembler-not "elabs" } }
| Ada | elab4.ads |
with Ada.Text_IO; use Ada.Text_IO;
package body Elab4_Pkg is
--------------------------------------------------
-- Call to call, instantiation, task activation --
--------------------------------------------------
procedure Suppressed_Call_1 is
package Inst is new ABE_Gen;
T : ABE_Task;
be... | Ada | elab4_pkg.adb |
package Elab4_Pkg is
procedure ABE_Call;
generic
package ABE_Gen is
procedure Force_Body;
end ABE_Gen;
task type ABE_Task;
--------------------------------------------------
-- Call to call, instantiation, task activation --
--------------------------------------------------
functio... | Ada | elab4_pkg.ads |
procedure Elab4_Proc is
begin
null;
end;
| Ada | elab4_proc.adb |
-- { dg-excess-errors "no code generated" }
generic
procedure Elab4_Proc;
| Ada | elab4_proc.ads |
-- { dg-do link }
with Elab5_Pkg;
procedure Elab5 is begin null; end Elab5;
| Ada | elab5.adb |
with Ada.Text_IO; use Ada.Text_IO;
package body Elab5_Pkg is
--------------------------------------------------
-- Call to call, instantiation, task activation --
--------------------------------------------------
procedure Suppressed_Call_1 is
package Inst is new ABE_Gen;
T : ABE_Task;
be... | Ada | elab5_pkg.adb |
package Elab5_Pkg is
procedure ABE_Call;
generic
package ABE_Gen is
procedure Force_Body;
end ABE_Gen;
task type ABE_Task;
--------------------------------------------------
-- Call to call, instantiation, task activation --
--------------------------------------------------
functio... | Ada | elab5_pkg.ads |
-- { dg-do compile }
-- { dg-options "-gnatE" }
package body Elab6 is
procedure Force_Body is null;
package Inst is new Elab6_Pkg;
end Elab6;
| Ada | elab6.adb |
with Elab6_Pkg;
generic
package Elab6 is
procedure Force_Body;
end Elab6;
| Ada | elab6.ads |
package body Elab6_Pkg is
protected Prot_Obj is
entry Ent;
end Prot_Obj;
procedure Call_Ent is
begin
Prot_Obj.Ent;
end Call_Ent;
protected body Prot_Obj is
entry Ent when True is
begin
null;
end Ent;
end Prot_Obj;
end Elab6_Pkg;
| Ada | elab6_pkg.adb |
generic
package Elab6_Pkg is
procedure Call_Ent;
end Elab6_Pkg;
| Ada | elab6_pkg.ads |
-- { dg-do run }
-- { dg-options "-gnatE -gnatn" }
with Elab7_Pkg1;
procedure Elab7 is
begin
null;
end Elab7;
| Ada | elab7.adb |
with Elab7_Pkg2;
package body Elab7_Pkg1 is
procedure A is
begin
Elab7_Pkg2.A;
end A;
end Elab7_Pkg1;
| Ada | elab7_pkg1.adb |
package Elab7_Pkg1 is
procedure A;
end Elab7_Pkg1;
| Ada | elab7_pkg1.ads |
with Elab7_Pkg1;
package body Elab7_Pkg2 is
procedure From_Timerep is
Lf1 : Long_Float := 1.0;
Lf2 : Long_Float := Long_Float'Floor(Lf1);
begin
null;
end From_Timerep;
procedure A is
begin
Elab7_Pkg1.A;
end A;
end Elab7_Pkg2;
| Ada | elab7_pkg2.adb |
package Elab7_Pkg2 is
pragma Elaborate_Body;
procedure A;
end Elab7_Pkg2;
| Ada | elab7_pkg2.ads |
-- { dg-do compile }
-- { dg-options "-gnatN" }
with Elab8_Gen;
procedure Elab8 is
package My_G is new Elab8_Gen (Integer);
begin
My_G.Compare (0, 1);
end;
| Ada | elab8.adb |
with Elab8_Pkg;
package body Elab8_Gen is
procedure Compare (Arg1, Arg2 : T) is
begin
if Arg1 = Arg2 then
raise Program_Error;
end if;
end;
end Elab8_Gen;
| Ada | elab8_gen.adb |
generic
type T is private;
package Elab8_Gen is
procedure Compare (Arg1, Arg2 : T);
pragma Inline (Compare);
end Elab8_Gen;
| Ada | elab8_gen.ads |
package body Elab8_Pkg is
procedure Dummy is null;
end Elab8_Pkg;
| Ada | elab8_pkg.adb |
package Elab8_Pkg with SPARK_Mode is
pragma Elaborate_Body;
end Elab8_Pkg;
| Ada | elab8_pkg.ads |
package body elim1 is
procedure d (a : t) is
begin
null;
end;
end;
| Ada | elim1.adb |
pragma Eliminate (p, d);
package elim1 is
type t is tagged null record;
procedure d (a : t);
end;
| Ada | elim1.ads |
-- { dg-do run }
with elim1;
procedure elim2 is
begin
null;
end;
| Ada | elim2.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | elists.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | elists.ads |
-- { dg-do compile }
package Empty_Variants is
type Rec (D : Integer := 1) is record
case D is
when 1 =>
I : Integer;
when 2 .. 5 =>
J : Integer;
K : Integer;
when 6 =>
null;
when 7 .. 8 =>
null;
when... | Ada | empty_variants.ads |
-- { dg-do run }
-- { dg-options "-gnatp" }
procedure Empty_Vector_Length is
type Vector is array (Integer range <>) of Integer;
function Empty_Vector return Vector is
begin
return (2 .. Integer'First => 0);
end;
My_Vector : Vector := Empty_Vector;
My_Length : Integer := My_Vector'Length;
... | Ada | empty_vector_length.adb |
-- { dg-do compile }
package body Enclosing_Record_Reference is
R: aliased T;
function F1 (x: integer) return T is begin return R; end;
function F2 (x: T) return integer is begin return 0; end;
function F3 (x: T) return T is begin return R; end;
function F4 (x: intege... | Ada | enclosing_record_reference.adb |
package Enclosing_Record_Reference is
pragma elaborate_body;
type T is record
F1: access function(x: integer) return T;
F2: access function(x: T) return integer; --??
F3: access function(x: T) return T; --??
F4: access function(x: integer) return acce... | Ada | enclosing_record_reference.ads |
-- { dg-do run }
with Ada.Text_IO; use Ada.Text_IO;
with Encode_String1_Pkg;
with GNAT.Encode_String;
with System.WCh_Con; use System.WCh_Con;
procedure Encode_String1 is
High_WS : constant Wide_String (1000 .. 1009) := (others => '1');
High_WWS : constant Wide_Wide_String (1000 .. 1009) := (others =>... | Ada | encode_string1.adb |
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
procedure Encode_String1_Pkg (Val : S) is
begin
declare
Result : constant String := Encode (Val);
begin
Put_Line (Result);
end;
exception
when Ex : others =>
Put_Line ("ERROR: Unexpected exception " & Exceptio... | Ada | encode_string1_pkg.adb |
generic
type C is private;
type S is array (Positive range <>) of C;
with function Encode (Val : S) return String;
procedure Encode_String1_Pkg (Val : S);
| Ada | encode_string1_pkg.ads |
-- { dg-do compile }
-- { dg-options "-gnateF" }
PACKAGE BODY Entry1 IS
PROTECTED TYPE key_buffer IS
PROCEDURE clear;
ENTRY incr;
ENTRY put (val : IN Natural);
ENTRY get (val : OUT Natural);
PRIVATE
-- Stores Key states (key state controller)
-- purpose: exclusive acces... | Ada | entry1.adb |
PACKAGE Entry1 IS
FUNCTION pt (t : IN Float) RETURN Natural;
FUNCTION pt2 (t : IN Float) RETURN Natural;
END Entry1;
| Ada | entry1.ads |
-- { dg-do compile }
-- { dg-options "-gnatwu" }
with Ada.Numerics.Discrete_Random; use Ada.Numerics;
procedure Entry_Family is
protected Family is
entry Call (Boolean);
end Family;
protected body Family is
entry Call (for P in Boolean) when True is
begin
null;
end Call;
... | Ada | entry_family.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure entry_queues is
F1_Poe : Integer := 18;
function F1 return Integer is
begin
F1_Poe := F1_Poe - 1;
return F1_Poe;
end F1;
generic
type T is limited private;
with function Is_Ok (X : T) return Boolean;
procedure Check;
procedure Check ... | Ada | entry_queues.adb |
-- { dg-do compile }
procedure Entry_Queues2 is
F1 : Integer := 17;
generic
type T is limited private;
procedure Check;
procedure Check is
begin
declare
type Poe is new T;
begin
declare
type Arr is array (1 .. 2) of Poe;
... | Ada | entry_queues2.adb |
-- { dg-do compile }
procedure Entry_Queues3 is
generic
type Large_Range is range <>;
package Queue is
end;
package body Queue is
task T is
entry E(Large_Range);
end T ;
task body T is
begin
accept E(Large_Range'First) do
null;
end e ;
end T ;
... | Ada | entry_queues3.adb |
-- { dg-do run }
-- { dg-options "-O2" }
with Enum1_Pkg; use Enum1_Pkg;
procedure Enum1 is
function Cond return Boolean is
begin
return My_N = Two or My_N = Three;
end;
begin
if Cond then
raise Constraint_Error;
end if;
end;
| Ada | enum1.adb |
package Enum1_Pkg is
type Enum is (One, Two, Three);
subtype Sub_Enum is Enum;
My_N : Sub_Enum := One;
end Enum1_Pkg;
| Ada | enum1_pkg.ads |
-- { dg-do run }
-- { dg-options "-gnat05 -O2" }
with Enum2_Pkg; use Enum2_Pkg;
procedure Enum2 is
type Enum is (A, B, C, D);
Table : array (B .. C, 1 .. 1) of F_String := (others => (others => Null_String));
begin
Table := (others => (others => Null_String));
end;
| Ada | enum2.adb |
with Ada.Finalization; use Ada.Finalization;
package Enum2_Pkg is
type F_String is new Controlled with record
Data : access String;
end record;
Null_String : constant F_String := (Controlled with Data => null);
end Enum2_Pkg;
| Ada | enum2_pkg.ads |
-- { dg-do run }
procedure Enum3 is
type Enum is (Aaa, Bbb, Ccc);
for Enum use (1,2,4);
begin
for Lo in Enum loop
for Hi in Enum loop
declare
subtype S is Enum range Lo .. Hi;
type Vector is array (S) of Integer;
Vec : Vector;
begin
for I... | Ada | enum3.adb |
-- { dg-do run }
procedure Enum4 is
procedure Assert (Expected, Actual : String) is
begin
if Expected /= Actual then
raise Program_Error;
end if;
end Assert;
procedure Test_1 is
type Test_Enum is (Enum_1, Enum_2);
for Test_Enum use (Enum_1=> 8, Enum_2=> 12);
E... | Ada | enum4.adb |
-- { dg-do compile }
procedure Enum5 is
package Pack1 is
type Enum is (A, B, C);
end;
E1 : Pack1.Enum;
use all type Pack1.Enum;
begin
E1 := A;
end;
| Ada | enum5.adb |
-- { dg-do compile }
package body Enum_Rep is
procedure Foo is null;
end;
| Ada | enum_rep.adb |
with Interfaces;
package Enum_Rep is
type My_Type is range 00 .. 100;
subtype My_Subtype2 is Interfaces.Unsigned_32
range My_Type'First'Enum_Rep .. My_Type'Last'Enum_Rep;
My_Type_First : constant My_Type := My_Type'First;
My_Type_Last : constant My_Type := My_Type'Last;
subtype My_Subtype ... | Ada | enum_rep.ads |
-- { dg-do compile }
with Ada.Integer_Text_IO;
with Ada.Text_IO;
procedure Enum_Rep2 is
type T is
(E80, E81, E82, E83, E84, E85, E86, E87, E88, E89, E8A, E8B, E8C, E8D, E8E, E8F,
E90, E91, E92, E93, E94, E95, E96, E97, E98, E99, E9A, E9B, E9C, E9D, E9E, E9F,
EA0, EA1, EA2, EA3, EA4, EA5, EA6, EA... | Ada | enum_rep2.adb |
with Ada.Text_IO; use Ada.Text_IO;
procedure Enum_Val1 is
type Enum is (Two, Four);
for Enum use (2, 4);
Count : Natural := 0;
begin
for I in 10 .. 11 loop
begin
Put (Integer'Image (I) & ": ");
Put_Line (Enum'Image (Enum'Enum_Val (I)));
exception
when Constraint_Err... | Ada | enum_val1.adb |
-- Copyright 2018-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | enum_with_gap.adb |
-- Copyright 2018-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | enum_with_gap.ads |
-- Copyright 2018-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | enum_with_gap_main.adb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.