From patchwork Wed Feb 6 10:05:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 218523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 482CB2C02A0 for ; Wed, 6 Feb 2013 21:05:43 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360749944; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=8TLa2V6uOf8YmXUBHEzX 9DkjisA=; b=NJcMYFN7hjtoD4vnx153ocsfOLkP878wZyYRMlxsqz8iYKGnvcC3 g6eZdGJq07alZNVrYg6OHBOIJhNyoFNzHiIb/rPdHHg6MbcVojAmBpziwQ+QSDOk h9rdci9V/6r4hG3L7iSi5GbWE048UJjGhNP0cgvrShef0WfnkQetgig= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=yCC70jaiSqt4W7tmteqbN9Qg6t7Bbihe/tnaKGwOWa50b+EvtZQmcg6syfa6Jq 2z/Vf1DQgMG23AIDtjeRmG+2IHHX/rDDtXZg1KptmLJnSaFtejOxsTtqiKpa1Qy5 EVmghAKQ6PmHpnLCC141Tq5kUyaiZUBfcfAnADx3RcLPo=; Received: (qmail 10874 invoked by alias); 6 Feb 2013 10:05:32 -0000 Received: (qmail 10841 invoked by uid 22791); 6 Feb 2013 10:05:30 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO, TW_TR X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Feb 2013 10:05:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C7FCA2E5BF; Wed, 6 Feb 2013 05:05:22 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id G7sXtSqe1ksg; Wed, 6 Feb 2013 05:05:22 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 9DD792E1C3; Wed, 6 Feb 2013 05:05:22 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 9D7A13FF09; Wed, 6 Feb 2013 05:05:22 -0500 (EST) Date: Wed, 6 Feb 2013 05:05:22 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Internal clean up for N_Pragma nodes Message-ID: <20130206100522.GA15484@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The specification for N_Pragma nodes requires that all pragma arguments by represented by N_Pragma_Associatin nodes, but in several cases naked expressions appeared. This patch corrects this irregularity, and also cleans up the format of Make_Pragma calls throughout these files. This was noticed during some new development, but does not as far as is known affect any current functionality. It is only a latent bug, so no test is needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-02-06 Robert Dewar * exp_prag.adb, sem_ch3.adb, exp_attr.adb, sem_prag.adb, sem_ch6.adb, exp_intr.adb, exp_dist.adb, sem_ch13.adb: Internal clean up for N_Pragma nodes. Index: exp_prag.adb =================================================================== --- exp_prag.adb (revision 195784) +++ exp_prag.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -513,7 +513,7 @@ Insert_After_And_Analyze (N, Make_Pragma (Loc, - Chars => Name_Machine_Attribute, + Chars => Name_Machine_Attribute, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Iloc, Expression => New_Copy_Tree (Internal)), @@ -644,44 +644,38 @@ (UI_To_Int (Exception_Code (Id)) / 8 * 8); Excep_Alias := - Make_Pragma - (Loc, - Name_Linker_Alias, - New_List - (Make_Pragma_Argument_Association - (Sloc => Loc, - Expression => - New_Reference_To (Excep_Internal, Loc)), + Make_Pragma (Loc, + Chars => Name_Linker_Alias, + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => + New_Reference_To (Excep_Internal, Loc)), - Make_Pragma_Argument_Association - (Sloc => Loc, - Expression => - Make_String_Literal - (Sloc => Loc, - Strval => End_String)))); + Make_Pragma_Argument_Association (Loc, + Expression => + Make_String_Literal (Loc, End_String)))); Insert_Action (N, Excep_Alias); Analyze (Excep_Alias); Export_Pragma := - Make_Pragma - (Loc, - Name_Export, - New_List - (Make_Pragma_Argument_Association (Loc, - Expression => Make_Identifier (Loc, Name_C)), + Make_Pragma (Loc, + Chars => Name_Export, + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Make_Identifier (Loc, Name_C)), - Make_Pragma_Argument_Association (Loc, - Expression => - New_Reference_To (Excep_Internal, Loc)), + Make_Pragma_Argument_Association (Loc, + Expression => + New_Reference_To (Excep_Internal, Loc)), - Make_Pragma_Argument_Association (Loc, - Expression => - Make_String_Literal (Loc, Excep_Image)), + Make_Pragma_Argument_Association (Loc, + Expression => + Make_String_Literal (Loc, Excep_Image)), - Make_Pragma_Argument_Association (Loc, - Expression => - Make_String_Literal (Loc, Excep_Image)))); + Make_Pragma_Argument_Association (Loc, + Expression => + Make_String_Literal (Loc, Excep_Image)))); Insert_Action (N, Export_Pragma); Analyze (Export_Pragma); Index: sem_ch3.adb =================================================================== --- sem_ch3.adb (revision 195784) +++ sem_ch3.adb (working copy) @@ -9060,17 +9060,16 @@ Impl_Prag := Make_Pragma (Loc, - Chars => Name_Implemented, + Chars => Name_Implemented, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, - Expression => - New_Reference_To (Subp, Loc)), + Expression => New_Reference_To (Subp, Loc)), Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Iface_Kind)))); -- The pragma doesn't need to be analyzed because it is internally - -- build. It is safe to directly register it as a rep item since we + -- built. It is safe to directly register it as a rep item since we -- are only interested in the characters of the implementation kind. Record_Rep_Item (Subp, Impl_Prag); Index: exp_attr.adb =================================================================== --- exp_attr.adb (revision 195784) +++ exp_attr.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -2120,7 +2120,7 @@ Defining_Unit_Name => Ent)), Make_Pragma (Loc, - Chars => Name_Import, + Chars => Name_Import, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Lang), Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 195787) +++ sem_prag.adb (working copy) @@ -7289,8 +7289,7 @@ Rewrite (N, Make_Pragma (Loc, - Chars => Name_Check_Policy, - + Chars => Name_Check_Policy, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Assertion)), @@ -8436,11 +8435,10 @@ Rewrite (N, Make_Pragma (Loc, Chars => Name_Import, - Pragma_Argument_Associations => - New_List ( - Make_Pragma_Argument_Association (Loc, - Expression => Make_Identifier (Loc, Name_CPP)), - New_Copy (First (Pragma_Argument_Associations (N)))))); + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Make_Identifier (Loc, Name_CPP)), + New_Copy (First (Pragma_Argument_Associations (N)))))); Analyze (N); end CPP_Class; @@ -13485,7 +13483,7 @@ if In_Body then Rewrite (N, Make_Pragma (Loc, - Chars => Name_Check, + Chars => Name_Check, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Precondition)), Index: sem_ch6.adb =================================================================== --- sem_ch6.adb (revision 195787) +++ sem_ch6.adb (working copy) @@ -11763,7 +11763,7 @@ if not Expander_Active then CP := Make_Pragma (Loc, - Chars => Name_Postcondition, + Chars => Name_Postcondition, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Chars => Name_Check, Index: exp_intr.adb =================================================================== --- exp_intr.adb (revision 195784) +++ exp_intr.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -454,7 +454,7 @@ New_Occurrence_Of (Standard_Character, Loc)), Make_Pragma (Loc, - Chars => Name_Import, + Chars => Name_Import, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Ada)), Index: exp_dist.adb =================================================================== --- exp_dist.adb (revision 195784) +++ exp_dist.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -2176,7 +2176,7 @@ Append_To (Decls, Make_Pragma (Loc, - Chars => Name_Import, + Chars => Name_Import, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Chars => Name_Convention, Index: sem_ch13.adb =================================================================== --- sem_ch13.adb (revision 195784) +++ sem_ch13.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -843,7 +843,9 @@ Prag := Make_Pragma (Loc, Pragma_Argument_Associations => New_List ( - New_Occurrence_Of (Ent, Sloc (Ident))), + Make_Pragma_Argument_Association (Sloc (Ident), + Expression => New_Occurrence_Of (Ent, Sloc (Ident)))), + Pragma_Identifier => Make_Identifier (Sloc (Ident), Chars (Ident))); @@ -1212,21 +1214,29 @@ Aitem := Make_Pragma (Loc, Pragma_Argument_Associations => New_List ( - New_Occurrence_Of (E, Loc), - Relocate_Node (Expr)), + Make_Pragma_Argument_Association (Loc, + Expression => New_Occurrence_Of (E, Loc)), + + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr))), + Pragma_Identifier => Make_Identifier (Sloc (Id), Chars (Id))); when Aspect_Synchronization => -- The aspect corresponds to pragma Implemented. - -- Construct the pragma + -- Construct the pragma. Aitem := Make_Pragma (Loc, Pragma_Argument_Associations => New_List ( - New_Occurrence_Of (E, Loc), - Relocate_Node (Expr)), + Make_Pragma_Argument_Association (Loc, + Expression => New_Occurrence_Of (E, Loc)), + + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr))), + Pragma_Identifier => Make_Identifier (Sloc (Id), Name_Implemented)); @@ -1241,8 +1251,11 @@ Make_Pragma (Loc, Pragma_Identifier => Make_Identifier (Sloc (Id), Name_Attach_Handler), - Pragma_Argument_Associations => - New_List (Ent, Relocate_Node (Expr))); + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent), + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr)))); when Aspect_Dynamic_Predicate | Aspect_Predicate | @@ -1253,8 +1266,11 @@ Aitem := Make_Pragma (Loc, - Pragma_Argument_Associations => - New_List (Ent, Relocate_Node (Expr)), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent), + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr))), Class_Present => Class_Present (Aspect), Pragma_Identifier => Make_Identifier (Sloc (Id), Name_Predicate)); @@ -1305,8 +1321,7 @@ while Present (A) loop A_Name := Chars (Identifier (A)); - if A_Name = Name_Import - or else + if A_Name = Name_Import or else A_Name = Name_Export then if Found then @@ -1333,7 +1348,11 @@ Next (A); end loop; - Arg_List := New_List (Relocate_Node (Expr), Ent); + Arg_List := New_List ( + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr)), + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent)); if Present (L_Assoc) then Append_To (Arg_List, L_Assoc); @@ -1361,8 +1380,9 @@ if Nkind (N) = N_Subprogram_Body then Aitem := Make_Pragma (Loc, - Pragma_Argument_Associations => - New_List (Relocate_Node (Expr)), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr))), Pragma_Identifier => Make_Identifier (Sloc (Id), Chars (Id))); else @@ -1380,8 +1400,10 @@ Aitem := Make_Pragma (Loc, Pragma_Argument_Associations => New_List ( - Relocate_Node (Expr), - New_Occurrence_Of (E, Loc)), + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr)), + Make_Pragma_Argument_Association (Loc, + Expression => New_Occurrence_Of (E, Loc))), Pragma_Identifier => Make_Identifier (Sloc (Id), Chars (Id)), Class_Present => Class_Present (Aspect)); @@ -1409,8 +1431,11 @@ Aitem := Make_Pragma (Loc, - Pragma_Argument_Associations => - New_List (Ent, Relocate_Node (Expr)), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent), + Make_Pragma_Argument_Association (Sloc (Expr), + Expression => Relocate_Node (Expr))), Class_Present => Class_Present (Aspect), Pragma_Identifier => Make_Identifier (Sloc (Id), Name_Invariant)); @@ -1661,6 +1686,7 @@ when Aspect_Contract_Case | Aspect_Test_Case => + declare Args : List_Id; Comp_Expr : Node_Id; @@ -1692,10 +1718,9 @@ while Present (Comp_Expr) loop New_Expr := Relocate_Node (Comp_Expr); Set_Original_Node (New_Expr, Comp_Expr); - Append - (Make_Pragma_Argument_Association (Sloc (Comp_Expr), - Expression => New_Expr), - Args); + Append_To (Args, + Make_Pragma_Argument_Association (Sloc (Comp_Expr), + Expression => New_Expr)); Next (Comp_Expr); end loop; @@ -1713,11 +1738,10 @@ New_Expr := Relocate_Node (Expression (Comp_Assn)); Set_Original_Node (New_Expr, Expression (Comp_Assn)); - Append (Make_Pragma_Argument_Association ( - Sloc => Sloc (Comp_Assn), + Append_To (Args, + Make_Pragma_Argument_Association (Sloc (Comp_Assn), Chars => Chars (First (Choices (Comp_Assn))), - Expression => New_Expr), - Args); + Expression => New_Expr)); Next (Comp_Assn); end loop; @@ -1893,7 +1917,9 @@ if No (Expr) then Aitem := Make_Pragma (Loc, - Pragma_Argument_Associations => New_List (Ent), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent)), Pragma_Identifier => Make_Identifier (Sloc (Id), Chars (Id))); @@ -1940,7 +1966,9 @@ if Is_True (Static_Boolean (Expr)) then Aitem := Make_Pragma (Loc, - Pragma_Argument_Associations => New_List (Ent), + Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Sloc (Ent), + Expression => Ent)), Pragma_Identifier => Make_Identifier (Sloc (Id), Chars (Id)));