From f2d9ae209afbf4486850f531ebe091953f1f72f9 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 20 Nov 2014 15:17:04 +0100 Subject: [PATCH] [multiple changes] 2014-11-20 Robert Dewar * sem_ch13.adb: Minor reformatting. * exp_util.adb (Following_Address_Clause): Handle case of package private part. 2014-11-20 Arnaud Charlet * a-cdlili.adb, a-cihama.adb, a-coinve.adb, a-cusyqu.adb, a-ciorse.adb, a-coorma.adb, a-cborma.adb, a-cidlli.adb, a-cimutr.adb, a-ciormu.adb, a-cbprqu.adb, a-cihase.adb, a-cohama.adb, a-coorse.adb, a-coboho.adb, a-cuprqu.adb, a-cbhama.adb, a-rbtgbo.adb, a-cborse.adb, a-comutr.adb, a-ciorma.adb, a-cobove.adb, a-coormu.adb, a-convec.adb, a-cohase.adb, a-coinho.adb, a-coinho-shared.adb, a-cbdlli.adb, a-cbsyqu.adb, a-cbmutr.adb, a-cbhase.adb: Add pragma Annotate to prevent codepeer from analyzing these bodies. From-SVN: r217854 --- gcc/ada/ChangeLog | 17 ++++++++ gcc/ada/a-cbdlli.adb | 2 + gcc/ada/a-cbhama.adb | 2 + gcc/ada/a-cbhase.adb | 2 + gcc/ada/a-cbmutr.adb | 2 + gcc/ada/a-cborma.adb | 2 + gcc/ada/a-cborse.adb | 2 + gcc/ada/a-cbprqu.adb | 4 +- gcc/ada/a-cbsyqu.adb | 4 +- gcc/ada/a-cdlili.adb | 2 + gcc/ada/a-cidlli.adb | 2 + gcc/ada/a-cihama.adb | 4 +- gcc/ada/a-cihase.adb | 2 + gcc/ada/a-cimutr.adb | 2 + gcc/ada/a-ciorma.adb | 4 +- gcc/ada/a-ciormu.adb | 4 +- gcc/ada/a-ciorse.adb | 2 + gcc/ada/a-coboho.adb | 2 + gcc/ada/a-cobove.adb | 2 + gcc/ada/a-cohama.adb | 4 +- gcc/ada/a-cohase.adb | 2 + gcc/ada/a-coinho-shared.adb | 2 + gcc/ada/a-coinho.adb | 2 + gcc/ada/a-coinve.adb | 4 +- gcc/ada/a-comutr.adb | 2 + gcc/ada/a-convec.adb | 4 +- gcc/ada/a-coorma.adb | 4 +- gcc/ada/a-coormu.adb | 4 +- gcc/ada/a-coorse.adb | 2 + gcc/ada/a-cuprqu.adb | 4 +- gcc/ada/a-cusyqu.adb | 4 +- gcc/ada/a-rbtgbo.adb | 2 + gcc/ada/exp_util.adb | 80 ++++++++++++++++++++++++++++--------- gcc/ada/sem_ch13.adb | 1 - 34 files changed, 152 insertions(+), 32 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f24e4fd26b9..f93275bfd3f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2014-11-20 Robert Dewar + + * sem_ch13.adb: Minor reformatting. + * exp_util.adb (Following_Address_Clause): Handle case of + package private part. + +2014-11-20 Arnaud Charlet + + * a-cdlili.adb, a-cihama.adb, a-coinve.adb, a-cusyqu.adb, a-ciorse.adb, + a-coorma.adb, a-cborma.adb, a-cidlli.adb, a-cimutr.adb, a-ciormu.adb, + a-cbprqu.adb, a-cihase.adb, a-cohama.adb, a-coorse.adb, a-coboho.adb, + a-cuprqu.adb, a-cbhama.adb, a-rbtgbo.adb, a-cborse.adb, a-comutr.adb, + a-ciorma.adb, a-cobove.adb, a-coormu.adb, a-convec.adb, a-cohase.adb, + a-coinho.adb, a-coinho-shared.adb, a-cbdlli.adb, a-cbsyqu.adb, + a-cbmutr.adb, a-cbhase.adb: Add pragma Annotate to prevent codepeer + from analyzing these bodies. + 2014-11-20 Ed Schonberg * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not apply diff --git a/gcc/ada/a-cbdlli.adb b/gcc/ada/a-cbdlli.adb index 796d87b7e1b..c4e4945d702 100644 --- a/gcc/ada/a-cbdlli.adb +++ b/gcc/ada/a-cbdlli.adb @@ -31,6 +31,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Doubly_Linked_Lists is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cbhama.adb b/gcc/ada/a-cbhama.adb index eb53e757b45..3772c779305 100644 --- a/gcc/ada/a-cbhama.adb +++ b/gcc/ada/a-cbhama.adb @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Hashed_Maps is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cbhase.adb b/gcc/ada/a-cbhase.adb index 331087b9eeb..5f87c295578 100644 --- a/gcc/ada/a-cbhase.adb +++ b/gcc/ada/a-cbhase.adb @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Hashed_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cbmutr.adb b/gcc/ada/a-cbmutr.adb index 26b0085b648..2a075428071 100644 --- a/gcc/ada/a-cbmutr.adb +++ b/gcc/ada/a-cbmutr.adb @@ -31,6 +31,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Multiway_Trees is + pragma Annotate (CodePeer, Skip_Analysis); + -------------------- -- Root_Iterator -- -------------------- diff --git a/gcc/ada/a-cborma.adb b/gcc/ada/a-cborma.adb index 68b6befaad8..c45bf9a3b76 100644 --- a/gcc/ada/a-cborma.adb +++ b/gcc/ada/a-cborma.adb @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Ordered_Maps is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------------- -- Node Access Subprograms -- ----------------------------- diff --git a/gcc/ada/a-cborse.adb b/gcc/ada/a-cborse.adb index 979357ddc75..af894ee11fb 100644 --- a/gcc/ada/a-cborse.adb +++ b/gcc/ada/a-cborse.adb @@ -42,6 +42,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Ordered_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ------------------------------ -- Access to Fields of Node -- ------------------------------ diff --git a/gcc/ada/a-cbprqu.adb b/gcc/ada/a-cbprqu.adb index ce2fd69fae7..61b9e72a3db 100644 --- a/gcc/ada/a-cbprqu.adb +++ b/gcc/ada/a-cbprqu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2014, 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- -- @@ -29,6 +29,8 @@ package body Ada.Containers.Bounded_Priority_Queues is + pragma Annotate (CodePeer, Skip_Analysis); + package body Implementation is ------------- diff --git a/gcc/ada/a-cbsyqu.adb b/gcc/ada/a-cbsyqu.adb index 462d6f4c95c..e918a9aebfe 100644 --- a/gcc/ada/a-cbsyqu.adb +++ b/gcc/ada/a-cbsyqu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2014, 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- -- @@ -29,6 +29,8 @@ package body Ada.Containers.Bounded_Synchronized_Queues is + pragma Annotate (CodePeer, Skip_Analysis); + package body Implementation is ------------- diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb index eae608c05b2..02a4c3903ea 100644 --- a/gcc/ada/a-cdlili.adb +++ b/gcc/ada/a-cdlili.adb @@ -33,6 +33,8 @@ with System; use type System.Address; package body Ada.Containers.Doubly_Linked_Lists is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb index c41be78fcf3..6e296e80c2d 100644 --- a/gcc/ada/a-cidlli.adb +++ b/gcc/ada/a-cidlli.adb @@ -33,6 +33,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Doubly_Linked_Lists is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free is new Ada.Unchecked_Deallocation (Element_Type, Element_Access); diff --git a/gcc/ada/a-cihama.adb b/gcc/ada/a-cihama.adb index 7f9978935d9..98798a247a7 100644 --- a/gcc/ada/a-cihama.adb +++ b/gcc/ada/a-cihama.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Hashed_Maps is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free_Key is new Ada.Unchecked_Deallocation (Key_Type, Key_Access); diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb index 7d503668702..4cc0f461b40 100644 --- a/gcc/ada/a-cihase.adb +++ b/gcc/ada/a-cihase.adb @@ -41,6 +41,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Hashed_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cimutr.adb b/gcc/ada/a-cimutr.adb index 0d3f16455ee..e0b4b968257 100644 --- a/gcc/ada/a-cimutr.adb +++ b/gcc/ada/a-cimutr.adb @@ -33,6 +33,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Multiway_Trees is + pragma Annotate (CodePeer, Skip_Analysis); + -------------------- -- Root_Iterator -- -------------------- diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb index d62f6076ca0..3dde307d160 100644 --- a/gcc/ada/a-ciorma.adb +++ b/gcc/ada/a-ciorma.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -40,6 +40,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Ordered_Maps is pragma Suppress (All_Checks); + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------------- -- Node Access Subprograms -- ----------------------------- diff --git a/gcc/ada/a-ciormu.adb b/gcc/ada/a-ciormu.adb index 2bc1200014b..1b562d7febf 100644 --- a/gcc/ada/a-ciormu.adb +++ b/gcc/ada/a-ciormu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -42,6 +42,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Ordered_Multisets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------------- -- Node Access Subprograms -- ----------------------------- diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb index 7c14cac72cb..218ab8a325e 100644 --- a/gcc/ada/a-ciorse.adb +++ b/gcc/ada/a-ciorse.adb @@ -42,6 +42,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Ordered_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-coboho.adb b/gcc/ada/a-coboho.adb index 23beaea9b37..4ea0fa047aa 100644 --- a/gcc/ada/a-coboho.adb +++ b/gcc/ada/a-coboho.adb @@ -30,6 +30,8 @@ with Ada.Assertions; use Ada.Assertions; package body Ada.Containers.Bounded_Holders is + pragma Annotate (CodePeer, Skip_Analysis); + function Size_In_Storage_Elements (Element : Element_Type) return Natural is (Element'Size / System.Storage_Unit) with Pre => diff --git a/gcc/ada/a-cobove.adb b/gcc/ada/a-cobove.adb index a7e7a76a30e..80437de5e0a 100644 --- a/gcc/ada/a-cobove.adb +++ b/gcc/ada/a-cobove.adb @@ -33,6 +33,8 @@ with System; use type System.Address; package body Ada.Containers.Bounded_Vectors is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb index 70e7758c9d8..ba6b998ba12 100644 --- a/gcc/ada/a-cohama.adb +++ b/gcc/ada/a-cohama.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Hashed_Maps is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb index f7f49aab96c..56376e18092 100644 --- a/gcc/ada/a-cohase.adb +++ b/gcc/ada/a-cohase.adb @@ -41,6 +41,8 @@ with System; use type System.Address; package body Ada.Containers.Hashed_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb index cf9d1ccaa23..783121c6b9d 100644 --- a/gcc/ada/a-coinho-shared.adb +++ b/gcc/ada/a-coinho-shared.adb @@ -36,6 +36,8 @@ with Ada.Unchecked_Deallocation; package body Ada.Containers.Indefinite_Holders is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free is new Ada.Unchecked_Deallocation (Element_Type, Element_Access); diff --git a/gcc/ada/a-coinho.adb b/gcc/ada/a-coinho.adb index 2cdba9957c1..0135ea55db4 100644 --- a/gcc/ada/a-coinho.adb +++ b/gcc/ada/a-coinho.adb @@ -29,6 +29,8 @@ with Ada.Unchecked_Deallocation; package body Ada.Containers.Indefinite_Holders is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free is new Ada.Unchecked_Deallocation (Element_Type, Element_Access); diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb index 3234f5ec87a..bb7b2837c50 100644 --- a/gcc/ada/a-coinve.adb +++ b/gcc/ada/a-coinve.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -34,6 +34,8 @@ with System; use type System.Address; package body Ada.Containers.Indefinite_Vectors is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free is new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access); diff --git a/gcc/ada/a-comutr.adb b/gcc/ada/a-comutr.adb index f45a27a1e0d..14d879e00ab 100644 --- a/gcc/ada/a-comutr.adb +++ b/gcc/ada/a-comutr.adb @@ -34,6 +34,8 @@ with System; use type System.Address; package body Ada.Containers.Multiway_Trees is + pragma Annotate (CodePeer, Skip_Analysis); + -------------------- -- Root_Iterator -- -------------------- diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb index ef4d75494df..8731060fbe3 100644 --- a/gcc/ada/a-convec.adb +++ b/gcc/ada/a-convec.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -34,6 +34,8 @@ with System; use type System.Address; package body Ada.Containers.Vectors is + pragma Annotate (CodePeer, Skip_Analysis); + procedure Free is new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access); diff --git a/gcc/ada/a-coorma.adb b/gcc/ada/a-coorma.adb index e451ec628ff..0794ba3f62b 100644 --- a/gcc/ada/a-coorma.adb +++ b/gcc/ada/a-coorma.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Ordered_Maps is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------------- -- Node Access Subprograms -- ----------------------------- diff --git a/gcc/ada/a-coormu.adb b/gcc/ada/a-coormu.adb index a3c5ab5c97e..06dfe94918c 100644 --- a/gcc/ada/a-coormu.adb +++ b/gcc/ada/a-coormu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, 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- -- @@ -42,6 +42,8 @@ with System; use type System.Address; package body Ada.Containers.Ordered_Multisets is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------------- -- Node Access Subprograms -- ----------------------------- diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb index 0f45308d669..34e562ec733 100644 --- a/gcc/ada/a-coorse.adb +++ b/gcc/ada/a-coorse.adb @@ -42,6 +42,8 @@ with System; use type System.Address; package body Ada.Containers.Ordered_Sets is + pragma Annotate (CodePeer, Skip_Analysis); + ------------------------------ -- Access to Fields of Node -- ------------------------------ diff --git a/gcc/ada/a-cuprqu.adb b/gcc/ada/a-cuprqu.adb index 4f6966dc136..dfb78687b4b 100644 --- a/gcc/ada/a-cuprqu.adb +++ b/gcc/ada/a-cuprqu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2014, 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- -- @@ -31,6 +31,8 @@ with Ada.Unchecked_Deallocation; package body Ada.Containers.Unbounded_Priority_Queues is + pragma Annotate (CodePeer, Skip_Analysis); + package body Implementation is ----------------------- diff --git a/gcc/ada/a-cusyqu.adb b/gcc/ada/a-cusyqu.adb index 7fc01cc5fc9..3a87306af15 100644 --- a/gcc/ada/a-cusyqu.adb +++ b/gcc/ada/a-cusyqu.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2014, 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- -- @@ -31,6 +31,8 @@ with Ada.Unchecked_Deallocation; package body Ada.Containers.Unbounded_Synchronized_Queues is + pragma Annotate (CodePeer, Skip_Analysis); + package body Implementation is ----------------------- diff --git a/gcc/ada/a-rbtgbo.adb b/gcc/ada/a-rbtgbo.adb index 99a2edc2e36..100881bf013 100644 --- a/gcc/ada/a-rbtgbo.adb +++ b/gcc/ada/a-rbtgbo.adb @@ -39,6 +39,8 @@ with System; use type System.Address; package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is + pragma Annotate (CodePeer, Skip_Analysis); + ----------------------- -- Local Subprograms -- ----------------------- diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 388807100dd..c85593647d0 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2916,31 +2916,73 @@ package body Exp_Util is -- Following_Address_Clause -- ------------------------------ - -- Should this function check the private part in a package ??? - function Following_Address_Clause (D : Node_Id) return Node_Id is - Id : constant Entity_Id := Defining_Identifier (D); - Decl : Node_Id; + Id : constant Entity_Id := Defining_Identifier (D); + Result : Node_Id; + Par : Node_Id; + + function Check_Decls (D : Node_Id) return Node_Id; + -- This internal function differs from the main function in that it + -- gets called to deal with a following package private part, and + -- it checks declarations starting with D (the main function checks + -- declarations following D). If D is Empty, then Empty is returned. + + ----------------- + -- Check_Decls -- + ----------------- + + function Check_Decls (D : Node_Id) return Node_Id is + Decl : Node_Id; + + begin + Decl := D; + while Present (Decl) loop + if Nkind (Decl) = N_At_Clause + and then Chars (Identifier (Decl)) = Chars (Id) + then + return Decl; + + elsif Nkind (Decl) = N_Attribute_Definition_Clause + and then Chars (Decl) = Name_Address + and then Chars (Name (Decl)) = Chars (Id) + then + return Decl; + end if; + + Next (Decl); + end loop; + + -- Otherwise not found, return Empty + + return Empty; + end Check_Decls; + + -- Start of processing for Following_Address_Clause begin - Decl := Next (D); - while Present (Decl) loop - if Nkind (Decl) = N_At_Clause - and then Chars (Identifier (Decl)) = Chars (Id) - then - return Decl; + Result := Check_Decls (Next (D)); - elsif Nkind (Decl) = N_Attribute_Definition_Clause - and then Chars (Decl) = Name_Address - and then Chars (Name (Decl)) = Chars (Id) - then - return Decl; - end if; + if Present (Result) then + return Result; + end if; - Next (Decl); - end loop; + -- Check for possible package private part following - return Empty; + Par := Parent (D); + + if Nkind (Par) = N_Package_Specification + and then Visible_Declarations (Par) = List_Containing (D) + and then Present (Private_Declarations (Par)) + then + -- Private part present, check declarations there + + return Check_Decls (First (Private_Declarations (Par))); + + else + -- No private part, clause not found, return Empty + + return Empty; + end if; end Following_Address_Clause; ---------------------- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index fe358b30b78..8a0ac8cc0b8 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2853,7 +2853,6 @@ package body Sem_Ch13 is begin if A_Id = Aspect_Pre or else A_Id = Aspect_Precondition then Pname := Name_Precondition; - else Pname := Name_Postcondition; end if; -- 2.30.2