This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix missing cases for restriction No_Obsolescent_Features

The restriction No_Obsolescent_Features missed the following
cases which should be handled:
 Ada 95 mode: J.1 J.2 J.3 J.6 J.9
 Ada 2005 mode: J.10 J.11 J.12 J.13 J.14
this patch corrects all these missing cases

The following test program generates error messages for
all lines marked with --  J.n (the test should be run in
both standard Ada 95 mode and with the -gnat05 switch to
select Ada 2005 mode, the latter will flag the lines
marked --  J.n (Ada 2005)

pragma Restrictions (No_Obsolescent_Features);

pragma Restrictions (No_Asynchronous_Control);        --  J.13 (Ada 2005)
pragma Restrictions (No_Unchecked_Deallocation);      --  J.13 (Ada 2005)
pragma Restrictions (No_Unchecked_Conversion);        --  J.13 (Ada 2005)

with Text_IO;                                         --  J.1

with Ada.Characters.Handling;
with System.Storage_Elements;

procedure Test_Obsolete is
   package SSE renames System.Storage_Elements;

   S : String := %aaa%;                               --  J.2

   type My_Fix is delta 0.001 range -100.0 .. 100.0;
   subtype My_Fix_Subtype is My_Fix delta 0.01;       --  J.3

   package Inner is
      type P is private;
      type P is (A, B, C);
   end Inner;

   B : Boolean := Inner.P'Constrained;                 --  J.4

   C : Character := ASCII.NUL;                         --  J.5

   procedure Raise_Numeric_Error (I : Integer) is
      if I = 0 then
         raise Numeric_Error;                          --  J.6
      end if;
   end Raise_Numeric_Error;

   I : Integer;
   for I use at SSE.To_Address (16#FFFF_0020#);        --  J.7

   task type Interrupt_Handler is
      entry Done;
      for Done'Address                                 --  J.7.1
        use SSE.To_Address (16#FFFF_0000#);
   end Interrupt_Handler;

   task body Interrupt_Handler is
      accept Done;
   end Interrupt_Handler;

   type Rec is record
      I : Integer;
   end record;

   for Rec use
      record at mod 8;                                 --  J.8
         I at 0 range 0 .. 32;
      end record;

   I1 : Integer := Interrupt_Handler'Storage_Size;     --  J.9

   pragma Suppress (Index_Check, On => S);             --  J.10 (Ada 2005)

   type Incomplete;

   type Access_Incomplete is access Incomplete'Class;  --  J.11 (Ada 2005)

   type Incomplete is tagged null record;

   function Local (X : Integer) return Integer;
   pragma Interface (C, Local);                        --  J.12 (Ada 2005)

   B1 : Boolean :=
          Ada.Characters.Handling.Is_Character ('a');  --  J.14 (Ada 2005)

   function ISC (Item : Wide_Character) return Boolean
     renames Ada.Characters.Handling.Is_Character;     --  J.14 (Ada 2005)

   type R is access
     function (Item : Wide_Character) return Boolean;  --  J.14 (Ada 2005)

   RV : R :=
end Test_Obsolete;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-08-10  Robert Dewar  <>

	* Add comments on handling of obsolescent entries.
	* Add Ada_2005 and Ada_2012 renamings for versions.
	* restrict.adb (Check_Obsolescent_2005_Entity): New procedure.
	* (Check_Obsolescent_2005_Entity): New procedure.
	* sem_attr.adb (Analyze_Access_Attribute): Call
	Check_Obsolescent_2005_Entity to check for access to obsolescent
	Ada.Characters.Handling subprogram.
	(Analyze_Attribute, case Class): Applying Class to untagged incomplete
	type is obsolescent in Ada 2005.
	(Analyze_Attribute, case Constrained): Better placement of flag when
	flagged as obsolescent feature.
	(Analyze_Attribute, case Storage_Size): Use with tasks is obsolescent
	* sem_ch10.adb (Analyze_With_Clause): With of renamings such as Text_IO
	is an obsolescent feature.
	* sem_ch11.adb (Analyze_Raise_Statement): Numeric_Error is obsolescent
	* sem_ch8.adb (Analyze_Subprogram_Renaming): Call
	Check_Obsolescent_2005_Entity to check for renaming obsolete
	Ada.Characters.Handling subprogram.
	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Check
	for obsolescent restrictions in Ada 2005.
	(Analyze_Pragma, case Suppress): Entity arg is obsolescent in Ada 2005
	(Analyze_Pragma, case Interface): Interface is obsolescent in Ada 2005
	* sem_res.adb (Resolve_Call): Call Check_Obsolescent_2005_Entity to
	check for obsolescent references to Ada.Characters.Handling subprograms

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]