From f9105bfacd6119d197885897857f82e7a7cfdde1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 16 Oct 2015 14:47:43 +0200 Subject: [PATCH] [multiple changes] 2015-10-16 Bob Duff * a-tags.adb, s-trasym.adb, s-trasym.ads: Make sure we don't get elaboration circularities when polling is turned on. 2015-10-16 Ed Schonberg * sem_ch3.adb (Replace_Anonymous_Access_To_Protected_Subprogram): When creating a full declaration for a formal parameter, the entity is labelled as an Itype, so set Associated_Node_For_Itype accordingly. * einfo.ads: Clarify use of Associated_Node_For_Itype. 2015-10-16 Bob Duff * bindgen: Move pragmas Warnings earlier, otherwise we can get warnings on with_clauses. From-SVN: r228885 --- gcc/ada/ChangeLog | 18 ++++++++++++++++++ gcc/ada/a-tags.adb | 8 ++++++-- gcc/ada/bindgen.adb | 4 ++-- gcc/ada/einfo.ads | 13 +++++++++---- gcc/ada/s-trasym.adb | 6 +++++- gcc/ada/s-trasym.ads | 6 +++++- gcc/ada/sem_ch3.adb | 2 ++ 7 files changed, 47 insertions(+), 10 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7b590421da1..c48e1f65cda 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2015-10-16 Bob Duff + + * a-tags.adb, s-trasym.adb, s-trasym.ads: Make sure we don't get + elaboration circularities when polling is turned on. + +2015-10-16 Ed Schonberg + + * sem_ch3.adb (Replace_Anonymous_Access_To_Protected_Subprogram): + When creating a full declaration for a formal parameter, the + entity is labelled as an Itype, so set Associated_Node_For_Itype + accordingly. + * einfo.ads: Clarify use of Associated_Node_For_Itype. + +2015-10-16 Bob Duff + + * bindgen: Move pragmas Warnings earlier, otherwise + we can get warnings on with_clauses. + 2015-10-16 Arnaud Charlet * s-osprim-mingw.adb, s-osprim-x32.adb, s-taprop-mingw.adb, diff --git a/gcc/ada/a-tags.adb b/gcc/ada/a-tags.adb index e60ef19f9bb..203d19ed676 100644 --- a/gcc/ada/a-tags.adb +++ b/gcc/ada/a-tags.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2013, 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- -- @@ -37,7 +37,11 @@ with System.Storage_Elements; use System.Storage_Elements; with System.WCh_Con; use System.WCh_Con; with System.WCh_StW; use System.WCh_StW; -pragma Elaborate_All (System.HTable); +pragma Elaborate (System.HTable); +-- Elaborate needed instead of Elaborate_All to avoid elaboration cycles +-- when polling is turned on. This is safe because HTable doesn't do anything +-- at elaboration time; it just contains a generic package we want to +-- instantiate. package body Ada.Tags is diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 76e9dc35346..7c8aff2d120 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -1983,6 +1983,7 @@ package body Bindgen is -- of the Ada 2005 or Ada 2012 constructs are needed by the binder file. WBI ("pragma Ada_95;"); + WBI ("pragma Warnings (Off);"); -- If we are operating in Restrictions (No_Exception_Handlers) mode, -- then we need to make sure that the binder program is compiled with @@ -2031,7 +2032,6 @@ package body Bindgen is end if; WBI ("package " & Ada_Main & " is"); - WBI (" pragma Warnings (Off);"); -- Main program case @@ -2182,6 +2182,7 @@ package body Bindgen is -- of the Ada 2005/2012 constructs are needed by the binder file. WBI ("pragma Ada_95;"); + WBI ("pragma Warnings (Off);"); -- Output Source_File_Name pragmas which look like @@ -2243,7 +2244,6 @@ package body Bindgen is WBI (""); WBI ("package body " & Ada_Main & " is"); - WBI (" pragma Warnings (Off);"); WBI (""); -- Generate externals for elaboration entities diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index a31951f429d..8949ea2bc83 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -462,10 +462,15 @@ package Einfo is -- copying trees, to determine whether or not to copy an Itype, and -- also for accessibility checks on anonymous access types. This -- node is typically an object declaration, component declaration, --- type or subtype declaration. For an access discriminant in a type --- declaration, the associated_node_for_itype is the discriminant --- specification. For an access parameter it is the enclosing subprogram --- declaration. +-- type or subtype declaration. + +-- For an access discriminant in a type declaration, the associated_ +-- node_for_itype is the corresponding discriminant specification. + +-- For an access parameter it is the enclosing subprogram declaration. + +-- For an access_to_protected_subprogram parameter it is the declaration +-- of the corresponding formal parameter. -- -- Itypes have no explicit declaration, and therefore are not attached to -- the tree: their Parent field is always empty. The Associated_Node_For_ diff --git a/gcc/ada/s-trasym.adb b/gcc/ada/s-trasym.adb index ad5588761d1..740bef9eeea 100644 --- a/gcc/ada/s-trasym.adb +++ b/gcc/ada/s-trasym.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2014, AdaCore -- +-- Copyright (C) 1999-2015, AdaCore -- -- -- -- 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- -- @@ -33,6 +33,10 @@ -- is not supported. It returns tracebacks as lists of LF separated strings of -- the form "0x..." corresponding to the addresses. +pragma Polling (Off); +-- We must turn polling off for this unit, because otherwise we can get +-- elaboration circularities when polling is turned on + with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback; with System.Address_Image; diff --git a/gcc/ada/s-trasym.ads b/gcc/ada/s-trasym.ads index ea0b46bf9fc..5c2812b1308 100644 --- a/gcc/ada/s-trasym.ads +++ b/gcc/ada/s-trasym.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2014, AdaCore -- +-- Copyright (C) 1999-2015, AdaCore -- -- -- -- 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- -- @@ -62,6 +62,10 @@ -- Symbolic_Traceback return a list of addresses expressed as "0x..." -- separated by line feed. +pragma Polling (Off); +-- We must turn polling off for this unit, because otherwise we can get +-- elaboration circularities when polling is turned on + with Ada.Exceptions; package System.Traceback.Symbolic is diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 8f979292e4b..f21edeb057e 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -5919,10 +5919,12 @@ package body Sem_Ch3 is else -- Temporarily remove the current scope (record or subprogram) from -- the stack to add the new declarations to the enclosing scope. + -- The anonymous entity is an Itype with the proper attributes. Scope_Stack.Decrement_Last; Analyze (Decl); Set_Is_Itype (Anon); + Set_Associated_Node_For_Itype (Anon, N); Scope_Stack.Append (Curr_Scope); end if; -- 2.30.2