From patchwork Tue May 26 14:47:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1298126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WcJC4jY8z9sPF for ; Wed, 27 May 2020 00:47:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8E017388A83B; Tue, 26 May 2020 14:47:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.eu.adacore.com (mel.act-europe.fr [194.98.77.210]) by sourceware.org (Postfix) with ESMTPS id 08C0C3851C23 for ; Tue, 26 May 2020 14:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 08C0C3851C23 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 72D6881382; Tue, 26 May 2020 16:47:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6US8O5eLi8U8; Tue, 26 May 2020 16:47:31 +0200 (CEST) Received: from localhost.localdomain (115.79.25.93.rev.sfr.net [93.25.79.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 07888812EF; Tue, 26 May 2020 16:47:30 +0200 (CEST) From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] gcc-changelog: remove file descriptor leaks Date: Tue, 26 May 2020 16:47:23 +0200 Message-Id: <20200526144724.13636-1-derodat@adacore.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Currently, running gcc-changelog's unit tests may clutter the output with tons of warnings such as: .../contrib/gcc-changelog/git_email.py:40: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpt5okd4qp.patch' mode='r' encoding='UTF-8'> lines = open(self.filename).read().splitlines() ResourceWarning: Enable tracemalloc to get the object allocation traceback This commit fixes these leaks, which restores a clean testsuite output. contrib/ * gcc-changelog/git_email.py: Close file objects after use. * gcc-changelog/test_email.py: Likewise. --- contrib/gcc-changelog/git_email.py | 3 ++- contrib/gcc-changelog/git_update_version.py | 6 ++++-- contrib/gcc-changelog/test_email.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index e1d6b70e80c..8c9df293a66 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -37,7 +37,8 @@ class GitEmail(GitCommit): date = None author = None - lines = open(self.filename).read().splitlines() + with open(self.filename, 'r') as f: + lines = f.read().splitlines() lines = list(takewhile(lambda line: line != '---', lines)) for line in lines: if line.startswith(DATE_PREFIX): diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py index 3dcc5625eda..6b6ccf68a5e 100755 --- a/contrib/gcc-changelog/git_update_version.py +++ b/contrib/gcc-changelog/git_update_version.py @@ -28,7 +28,8 @@ current_timestamp = datetime.datetime.now().strftime('%Y%m%d\n') def read_timestamp(path): - return open(path).read() + with open(path) as f: + return f.read() def prepend_to_changelog_files(repo, folder, git_commit, add_to_git): @@ -40,7 +41,8 @@ def prepend_to_changelog_files(repo, folder, git_commit, add_to_git): full_path = os.path.join(folder, entry, 'ChangeLog') print('writting to %s' % full_path) if os.path.exists(full_path): - content = open(full_path).read() + with open(full_path) as f: + content = f.read() else: content = '' with open(full_path, 'w+') as f: diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index bf028a3d40a..1379502e755 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -33,7 +33,8 @@ class TestGccChangelog(unittest.TestCase): filename = None patch_lines = [] - lines = open(os.path.join(script_path, 'test_patches.txt')).read() + with open(os.path.join(script_path, 'test_patches.txt')) as f: + lines = f.read() for line in lines.split('\n'): if line.startswith('==='): if patch_lines: From patchwork Tue May 26 14:47:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1298127 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WcJb3wtyz9sRK for ; Wed, 27 May 2020 00:47:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E9713896178; Tue, 26 May 2020 14:47:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.eu.adacore.com (mel.act-europe.fr [IPv6:2a02:2ab8:224:1::a0a:d2]) by sourceware.org (Postfix) with ESMTPS id 6C0D13851C23 for ; Tue, 26 May 2020 14:47:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6C0D13851C23 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5D45581382; Tue, 26 May 2020 16:47:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pd_krLa4Ietw; Tue, 26 May 2020 16:47:52 +0200 (CEST) Received: from localhost.localdomain (115.79.25.93.rev.sfr.net [93.25.79.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id C3CC1812EF; Tue, 26 May 2020 16:47:51 +0200 (CEST) From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] gcc-changelog: handle entries with multi-line file lists Date: Tue, 26 May 2020 16:47:25 +0200 Message-Id: <20200526144724.13636-2-derodat@adacore.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200526144724.13636-1-derodat@adacore.com> References: <20200526144724.13636-1-derodat@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This extends the ChangeLog entries parsing machinery to handle entries that cover multiple files spanning over multiple lines. For instance: * first_file_patched.c, second_file_patched.c, third_file_patched.c, fourth_file_patched.c: Do things. contrib/ * gcc-changelog/git_commit.py (ChangeLogEntry): Handle entries with multi-line file lists. * test_email.py: New testcase. * test_patches.txt: Likewise. --- contrib/gcc-changelog/git_commit.py | 18 ++ contrib/gcc-changelog/test_email.py | 9 + contrib/gcc-changelog/test_patches.txt | 290 +++++++++++++++++++++++++ 3 files changed, 317 insertions(+) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 6f99d917b3b..a24a251d8f3 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -185,14 +185,32 @@ class ChangeLogEntry: @property def files(self): files = [] + + # Whether the content currently processed is between a star prefix the + # end of the file list: a colon or an open paren. + in_location = False + for line in self.lines: + # If this line matches the star prefix, start the location + # processing on the information that follows the star. m = star_prefix_regex.match(line) if m: + in_location = True line = m.group('content') + + if in_location: + # Strip everything that is not a filename in "line": entities + # "(NAME)", entry text (the colon, if present, and anything + # that follows it). if '(' in line: line = line[:line.index('(')] + in_location = False if ':' in line: line = line[:line.index(':')] + in_location = False + + # At this point, all that 's left is a list of filenames + # separated by commas and whitespaces. for file in line.split(','): file = file.strip() if file: diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 1379502e755..3d2c8ff2412 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -286,3 +286,12 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-Update-merge.sh-to-reflect.patch') assert (email.changelog_entries[0].lines[0] == '\t* LOCAL_PATCHES: Use git hash instead of SVN id.') + + def test_multiline_file_list(self): + email = self.from_patch_glob( + '0001-Ada-Reuse-Is_Package_Or_Generic_Package-where-possib.patch') + assert (email.changelog_entries[0].files + == ['contracts.adb', 'einfo.adb', 'exp_ch9.adb', + 'sem_ch12.adb', 'sem_ch4.adb', 'sem_ch7.adb', + 'sem_ch8.adb', 'sem_elab.adb', 'sem_type.adb', + 'sem_util.adb']) diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 84d4b81d818..3492fb4dcb8 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -2650,4 +2650,294 @@ index dfa7bf3d196..3f4f1629a22 100755 -- 2.26.2 +=== 0001-Ada-Reuse-Is_Package_Or_Generic_Package-where-possib.patch === +From 557b268fffffdeb0980a17411f458eee333f55c6 Mon Sep 17 00:00:00 2001 +From: Piotr Trojanek +Date: Thu, 12 Dec 2019 11:45:24 +0100 +Subject: [PATCH] [Ada] Reuse Is_Package_Or_Generic_Package where possible + +2020-05-26 Piotr Trojanek + +gcc/ada/ + + * contracts.adb, einfo.adb, exp_ch9.adb, sem_ch12.adb, + sem_ch4.adb, sem_ch7.adb, sem_ch8.adb, sem_elab.adb, + sem_type.adb, sem_util.adb: Reuse Is_Package_Or_Generic_Package + where possible (similarly, reuse Is_Concurrent_Type if it was + possible in the same expressions). +--- + gcc/ada/contracts.adb | 2 +- + gcc/ada/einfo.adb | 22 +++++++++++----------- + gcc/ada/exp_ch9.adb | 2 +- + gcc/ada/sem_ch12.adb | 2 +- + gcc/ada/sem_ch4.adb | 2 +- + gcc/ada/sem_ch7.adb | 6 +++--- + gcc/ada/sem_ch8.adb | 6 +++--- + gcc/ada/sem_elab.adb | 2 +- + gcc/ada/sem_type.adb | 2 +- + gcc/ada/sem_util.adb | 6 +++--- + 10 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb +index 981bb91..d58f136 100644 +--- a/gcc/ada/contracts.adb ++++ b/gcc/ada/contracts.adb +@@ -213,7 +213,7 @@ package body Contracts is + -- Initializes + -- Part_Of (instantiation only) + +- elsif Ekind_In (Id, E_Generic_Package, E_Package) then ++ elsif Is_Package_Or_Generic_Package (Id) then + if Nam_In (Prag_Nam, Name_Abstract_State, + Name_Initial_Condition, + Name_Initializes) +diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb +index 98b508f..1df8ed0 100644 +--- a/gcc/ada/einfo.adb ++++ b/gcc/ada/einfo.adb +@@ -713,7 +713,7 @@ package body Einfo is + + function Abstract_States (Id : E) return L is + begin +- pragma Assert (Ekind_In (Id, E_Generic_Package, E_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + return Elist25 (Id); + end Abstract_States; + +@@ -837,7 +837,7 @@ package body Einfo is + + function Body_Entity (Id : E) return E is + begin +- pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + return Node19 (Id); + end Body_Entity; + +@@ -1424,8 +1424,8 @@ package body Einfo is + + function First_Private_Entity (Id : E) return E is + begin +- pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package) +- or else Ekind (Id) in Concurrent_Kind); ++ pragma Assert (Is_Package_Or_Generic_Package (Id) ++ or else Is_Concurrent_Type (Id)); + return Node16 (Id); + end First_Private_Entity; + +@@ -3044,7 +3044,7 @@ package body Einfo is + + function Package_Instantiation (Id : E) return N is + begin +- pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + return Node26 (Id); + end Package_Instantiation; + +@@ -3883,7 +3883,7 @@ package body Einfo is + + procedure Set_Abstract_States (Id : E; V : L) is + begin +- pragma Assert (Ekind_In (Id, E_Generic_Package, E_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + Set_Elist25 (Id, V); + end Set_Abstract_States; + +@@ -4006,7 +4006,7 @@ package body Einfo is + + procedure Set_Body_Entity (Id : E; V : E) is + begin +- pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + Set_Node19 (Id, V); + end Set_Body_Entity; + +@@ -4593,8 +4593,8 @@ package body Einfo is + + procedure Set_First_Private_Entity (Id : E; V : E) is + begin +- pragma Assert (Ekind_In (Id, E_Package, E_Generic_Package) +- or else Ekind (Id) in Concurrent_Kind); ++ pragma Assert (Is_Package_Or_Generic_Package (Id) ++ or else Is_Concurrent_Type (Id)); + Set_Node16 (Id, V); + end Set_First_Private_Entity; + +@@ -7827,7 +7827,7 @@ package body Einfo is + + function Has_Non_Null_Abstract_State (Id : E) return B is + begin +- pragma Assert (Ekind_In (Id, E_Generic_Package, E_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + + return + Present (Abstract_States (Id)) +@@ -7863,7 +7863,7 @@ package body Einfo is + ----------------------------- + + function Has_Null_Abstract_State (Id : E) return B is +- pragma Assert (Ekind_In (Id, E_Generic_Package, E_Package)); ++ pragma Assert (Is_Package_Or_Generic_Package (Id)); + + States : constant Elist_Id := Abstract_States (Id); + +diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb +index 64ac353..392a221 100644 +--- a/gcc/ada/exp_ch9.adb ++++ b/gcc/ada/exp_ch9.adb +@@ -6167,7 +6167,7 @@ package body Exp_Ch9 is + -- this safe. This is a common (if dubious) idiom. + + elsif S = Scope (Prot) +- and then Ekind_In (S, E_Package, E_Generic_Package) ++ and then Is_Package_Or_Generic_Package (S) + and then Nkind (Parent (E)) = N_Object_Declaration + and then Nkind (Parent (Parent (E))) = N_Package_Body + then +diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb +index dc3a3c2..209e060 100644 +--- a/gcc/ada/sem_ch12.adb ++++ b/gcc/ada/sem_ch12.adb +@@ -10364,7 +10364,7 @@ package body Sem_Ch12 is + -- such as a parent generic within the body of a generic child. + + if not Is_Entity_Name (Actual) +- or else not Ekind_In (Entity (Actual), E_Generic_Package, E_Package) ++ or else not Is_Package_Or_Generic_Package (Entity (Actual)) + then + Error_Msg_N + ("expect package instance to instantiate formal", Actual); +diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb +index 5910112..702f265 100644 +--- a/gcc/ada/sem_ch4.adb ++++ b/gcc/ada/sem_ch4.adb +@@ -9480,7 +9480,7 @@ package body Sem_Ch4 is + Type_Scope : constant Entity_Id := Scope (T); + Op_List : Elist_Id := Primitive_Operations (T); + begin +- if Ekind_In (Type_Scope, E_Package, E_Generic_Package) ++ if Is_Package_Or_Generic_Package (Type_Scope) + and then ((In_Package_Body (Type_Scope) + and then In_Open_Scopes (Type_Scope)) or else In_Instance_Body) + then +diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb +index 6d9a1db..f217dfd 100644 +--- a/gcc/ada/sem_ch7.adb ++++ b/gcc/ada/sem_ch7.adb +@@ -2428,7 +2428,7 @@ package body Sem_Ch7 is + -- defined in the associated package, subject to at least one Part_Of + -- constituent. + +- if Ekind_In (P, E_Generic_Package, E_Package) then ++ if Is_Package_Or_Generic_Package (P) then + declare + States : constant Elist_Id := Abstract_States (P); + State_Elmt : Elmt_Id; +@@ -3322,7 +3322,7 @@ package body Sem_Ch7 is + -- performed if the caller requests this behavior. + + if Do_Abstract_States +- and then Ekind_In (Pack_Id, E_Generic_Package, E_Package) ++ and then Is_Package_Or_Generic_Package (Pack_Id) + and then Has_Non_Null_Abstract_State (Pack_Id) + and then Requires_Body + then +@@ -3380,7 +3380,7 @@ package body Sem_Ch7 is + -- provided). If Ignore_Abstract_State is True, we don't do this check + -- (so we can use Unit_Requires_Body to check for some other reason). + +- elsif Ekind_In (Pack_Id, E_Generic_Package, E_Package) ++ elsif Is_Package_Or_Generic_Package (Pack_Id) + and then Present (Abstract_States (Pack_Id)) + and then not Is_Null_State + (Node (First_Elmt (Abstract_States (Pack_Id)))) +diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb +index f083f7c..7f50b40 100644 +--- a/gcc/ada/sem_ch8.adb ++++ b/gcc/ada/sem_ch8.adb +@@ -5950,7 +5950,7 @@ package body Sem_Ch8 is + + -- Package or generic package is always a simple reference + +- if Ekind_In (E, E_Package, E_Generic_Package) then ++ if Is_Package_Or_Generic_Package (E) then + Generate_Reference (E, N, 'r'); + + -- Else see if we have a left hand side +@@ -8779,7 +8779,7 @@ package body Sem_Ch8 is + + -- Set Default_Storage_Pool field of the library unit if necessary + +- if Ekind_In (S, E_Package, E_Generic_Package) ++ if Is_Package_Or_Generic_Package (S) + and then + Nkind (Parent (Unit_Declaration_Node (S))) = N_Compilation_Unit + then +@@ -8949,7 +8949,7 @@ package body Sem_Ch8 is + + if Is_Child_Unit (S) + and then Present (E) +- and then Ekind_In (E, E_Package, E_Generic_Package) ++ and then Is_Package_Or_Generic_Package (E) + and then + Nkind (Parent (Unit_Declaration_Node (E))) = N_Compilation_Unit + then +diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb +index f3cac46..dbf3fac 100644 +--- a/gcc/ada/sem_elab.adb ++++ b/gcc/ada/sem_elab.adb +@@ -13826,7 +13826,7 @@ package body Sem_Elab is + -- be on another machine. + + if Ekind (Body_Id) = E_Package_Body +- and then Ekind_In (Spec_Id, E_Generic_Package, E_Package) ++ and then Is_Package_Or_Generic_Package (Spec_Id) + and then (Is_Remote_Call_Interface (Spec_Id) + or else Is_Remote_Types (Spec_Id)) + then +diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb +index e5d01dd..1868568 100644 +--- a/gcc/ada/sem_type.adb ++++ b/gcc/ada/sem_type.adb +@@ -1383,7 +1383,7 @@ package body Sem_Type is + begin + return In_Same_List (Parent (Typ), Op_Decl) + or else +- (Ekind_In (Scop, E_Package, E_Generic_Package) ++ (Is_Package_Or_Generic_Package (Scop) + and then List_Containing (Op_Decl) = + Visible_Declarations (Parent (Scop)) + and then List_Containing (Parent (Typ)) = +diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb +index b980b4c..c1b1d9e 100644 +--- a/gcc/ada/sem_util.adb ++++ b/gcc/ada/sem_util.adb +@@ -3407,7 +3407,7 @@ package body Sem_Util is + -- Stop the traversal when a package subject to a null abstract state + -- has been found. + +- if Ekind_In (Context, E_Generic_Package, E_Package) ++ if Is_Package_Or_Generic_Package (Context) + and then Has_Null_Abstract_State (Context) + then + exit; +@@ -12978,7 +12978,7 @@ package body Sem_Util is + + begin + if Present (Pkg) +- and then Ekind_In (Pkg, E_Generic_Package, E_Package) ++ and then Is_Package_Or_Generic_Package (Pkg) + then + while Nkind (Pkg_Decl) /= N_Package_Specification loop + Pkg_Decl := Parent (Pkg_Decl); +@@ -25283,7 +25283,7 @@ package body Sem_Util is + or else + (Present (Scope (Val)) + and then Is_Implementation_Defined (Scope (Val)))) +- and then not (Ekind_In (Val, E_Package, E_Generic_Package) ++ and then not (Is_Package_Or_Generic_Package (Val) + and then Is_Library_Level_Entity (Val)) + then + Check_Restriction (No_Implementation_Identifiers, Post_Node); +-- +2.1.4