From d50a26f2bad59ba73c52694190aac02e90423bbd Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 4 Mar 2015 16:00:57 +0100 Subject: [PATCH] [multiple changes] 2015-03-04 Robert Dewar * sem_warn.adb: Minor reformatting. * init.c: Minor tweaks. 2015-03-04 Dmitriy Anisimko * a-coinho-shared.adb: Fix clear of already empty holder. 2015-03-04 Robert Dewar * exp_unst.adb (Check_Dynamic_Type): Ignore library level types. (Check_Uplevel_Reference_To_Type): Ignore call inside generic. (Note_Uplevel_Reference): Ignore call inside generic. (Note_Uplevel_Reference): Fix check for no entity field. (Unnest_Subprogram): Ignore call inside generic. (Find_Current_Subprogram): Use Defining_Entity, not Defining_Unit_Name. (Visit_Node): Ignore calls to Imported subprograms. (Visit_Node): Fix problem in finding subprogram body in some cases. (Add_Form_To_Spec): Use Defining_Entity, not Defining_Unit_Name. From-SVN: r221188 --- gcc/ada/ChangeLog | 21 ++++++++++++++++++ gcc/ada/a-coinho-shared.adb | 8 ++++--- gcc/ada/exp_unst.adb | 44 ++++++++++++++++++++++++++++++------- gcc/ada/init.c | 18 +++++++-------- gcc/ada/sem_warn.adb | 4 +--- 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7b1f0f4d771..9dc33a7aadc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2015-03-04 Robert Dewar + + * sem_warn.adb: Minor reformatting. + * init.c: Minor tweaks. + +2015-03-04 Dmitriy Anisimko + + * a-coinho-shared.adb: Fix clear of already empty holder. + +2015-03-04 Robert Dewar + + * exp_unst.adb (Check_Dynamic_Type): Ignore library level types. + (Check_Uplevel_Reference_To_Type): Ignore call inside generic. + (Note_Uplevel_Reference): Ignore call inside generic. + (Note_Uplevel_Reference): Fix check for no entity field. + (Unnest_Subprogram): Ignore call inside generic. + (Find_Current_Subprogram): Use Defining_Entity, not Defining_Unit_Name. + (Visit_Node): Ignore calls to Imported subprograms. + (Visit_Node): Fix problem in finding subprogram body in some cases. + (Add_Form_To_Spec): Use Defining_Entity, not Defining_Unit_Name. + 2015-03-04 Robert Dewar * einfo.adb (Is_ARECnF_Entity): Removed. diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb index 783121c6b9d..9dd5b2f18cc 100644 --- a/gcc/ada/a-coinho-shared.adb +++ b/gcc/ada/a-coinho-shared.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2013-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2013-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -129,8 +129,10 @@ package body Ada.Containers.Indefinite_Holders is raise Program_Error with "attempt to tamper with elements"; end if; - Unreference (Container.Reference); - Container.Reference := null; + if Container.Reference /= null then + Unreference (Container.Reference); + Container.Reference := null; + end if; end Clear; ------------------------ diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index b7bcf5c6e51..2034b0e03b5 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -153,12 +153,19 @@ package body Exp_Unst is Set_Has_Uplevel_Reference (Typ); return True; + -- If the type is at library level, always consider it static, since + -- uplevel references do not matter in this case. + + elsif Is_Library_Level_Entity (T) then + Set_Is_Static_Type (T); + return False; + -- Otherwise we need to figure out what the story is with this type else DT := False; - -- For a scalar type, check bounds + -- For a scalar type, check bounds if Is_Scalar_Type (T) then @@ -243,9 +250,14 @@ package body Exp_Unst is -- Start of processing for Check_Uplevel_Reference_To_Type begin + -- Nothing to do inside a generic (all processing is for instance) + + if Inside_A_Generic then + return; + -- Nothing to do if we know this is a static type - if Is_Static_Type (Typ) then + elsif Is_Static_Type (Typ) then return; -- Nothing to do if already marked as uplevel referenced @@ -270,9 +282,15 @@ package body Exp_Unst is procedure Note_Uplevel_Reference (N : Node_Id; Subp : Entity_Id) is begin + -- Nothing to do inside a generic (all processing is for instance) + + if Inside_A_Generic then + return; + end if; + -- Nothing to do if reference has no entity field - if Nkind (N) not in N_Entity then + if Nkind (N) not in N_Has_Entity then return; end if; @@ -382,6 +400,11 @@ package body Exp_Unst is -- Start of processing for Unnest_Subprogram begin + -- Nothing to do inside a generic (all processing is for instance) + + if Inside_A_Generic then + return; + end if; -- At least for now, do not unnest anything but main source unit if not In_Extended_Main_Source_Unit (Subp_Body) then @@ -434,7 +457,7 @@ package body Exp_Unst is if Nkind (Nod) = N_Subprogram_Body then if Acts_As_Spec (Nod) then - return Defining_Unit_Name (Specification (Nod)); + return Defining_Entity (Specification (Nod)); else return Corresponding_Spec (Nod); end if; @@ -470,6 +493,11 @@ package body Exp_Unst is then null; + -- Ignore calls to imported routines + + elsif Is_Imported (Ent) then + null; + -- Here we have a call to keep and analyze else @@ -501,14 +529,14 @@ package body Exp_Unst is begin -- Set fields of Subp_Entry for new subprogram - STJ.Ent := Defining_Unit_Name (Specification (N)); + STJ.Ent := Defining_Entity (Specification (N)); STJ.Lev := Get_Level (STJ.Ent); if Nkind (N) = N_Subprogram_Body then STJ.Bod := N; else - STJ.Bod := Parent (Parent (Corresponding_Body (N))); - + STJ.Bod := + Parent (Declaration_Node (Corresponding_Body (N))); pragma Assert (Nkind (STJ.Bod) = N_Subprogram_Body); end if; @@ -697,7 +725,7 @@ package body Exp_Unst is ---------------------- procedure Add_Form_To_Spec (F : Entity_Id; S : Node_Id) is - Sub : constant Entity_Id := Defining_Unit_Name (S); + Sub : constant Entity_Id := Defining_Entity (S); Ent : Entity_Id; begin diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 30f2da4462b..7b8b870580c 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2014, Free Software Foundation, Inc. * + * Copyright (C) 1992-2015, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -38,9 +38,9 @@ installed by this file are used to catch the resulting signals that come from these probes failing (i.e. touching protected pages). */ -/* This file should be kept synchronized with 2sinit.ads, 2sinit.adb, - s-init-ae653-cert.adb and s-init-xi-sparc.adb. All these files implement - the required functionality for different targets. */ +/* This file should be kept synchronized with s-init.ads, s-init.adb and the + s-init-*.adb variants. All these files implement the required functionality + for different targets. */ /* The following include is here to meet the published VxWorks requirement that the __vxworks header appear before any other include. */ @@ -674,7 +674,7 @@ __gnat_error_handler (int sig) msg = "unhandled signal"; } - Raise_From_Signal_Handler(exception, msg); + Raise_From_Signal_Handler (exception, msg); } void @@ -1912,8 +1912,8 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc) sigprocmask (SIG_SETMASK, &mask, NULL); #if defined (__ARMEL__) || defined (__PPC__) - /* On PowerPC, kernel mode, we process signals through a Call Frame Info - trampoline, voiding the need for myriads of fallback_frame_state + /* On ARM and PowerPC, kernel mode, we process signals through a Call Frame + Info trampoline, voiding the need for myriads of fallback_frame_state variants in the ZCX runtime. We have no simple way to distinguish ZCX from SJLJ here, so we do this for SJLJ as well even though this is not necessary. This only incurs a few extra instructions and a tiny @@ -2100,7 +2100,7 @@ __gnat_error_handler (int sig) msg = "unhandled signal"; } - Raise_From_Signal_Handler(exception, msg); + Raise_From_Signal_Handler (exception, msg); } void @@ -2163,7 +2163,7 @@ __gnat_error_handler (int sig) msg = "unhandled signal"; } - Raise_From_Signal_Handler(exception, msg); + Raise_From_Signal_Handler (exception, msg); } void diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index f3768621399..518c9191e37 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3109,9 +3109,7 @@ package body Sem_Warn is procedure Output_Unreferenced_Messages is begin - for J in Unreferenced_Entities.First .. - Unreferenced_Entities.Last - loop + for J in Unreferenced_Entities.First .. Unreferenced_Entities.Last loop Warn_On_Unreferenced_Entity (Unreferenced_Entities.Table (J)); end loop; end Output_Unreferenced_Messages; -- 2.30.2