From d6cd5d3493f6fb565ff9300577deeebe37143673 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 10 Oct 2014 16:32:30 +0200 Subject: [PATCH] [multiple changes] 2014-10-10 Gary Dismukes * sinfo.ads, gnat_ugn.texi, a-except.adb, a-except-2005.adb, raise-gcc.c Spelling changes (prolog => prologue, epilog => epilogue). 2014-10-10 Ed Schonberg * sem_ch5.adb (Is_Wrapped_In_Block): Handle properly blocks that contain pragmas generated for loop invariants and type predicates. Clarify use of this subprogram. From-SVN: r216087 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/a-except-2005.adb | 2 +- gcc/ada/a-except.adb | 4 ++-- gcc/ada/gnat_ugn.texi | 6 +++--- gcc/ada/raise-gcc.c | 6 +++--- gcc/ada/sem_ch5.adb | 30 +++++++++++++++++++++++------- gcc/ada/sinfo.ads | 2 +- 7 files changed, 44 insertions(+), 17 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 401751c6e99..d410c97902d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2014-10-10 Gary Dismukes + + * sinfo.ads, gnat_ugn.texi, a-except.adb, a-except-2005.adb, + raise-gcc.c Spelling changes (prolog => prologue, epilog => epilogue). + +2014-10-10 Ed Schonberg + + * sem_ch5.adb (Is_Wrapped_In_Block): Handle properly blocks that + contain pragmas generated for loop invariants and type predicates. + Clarify use of this subprogram. + 2014-10-10 Yannick Moy * sem_prag.adb (Analyze_Global_Item): Accept formal objects in Global diff --git a/gcc/ada/a-except-2005.adb b/gcc/ada/a-except-2005.adb index 0b33c0c9f3f..d03194b8dd4 100644 --- a/gcc/ada/a-except-2005.adb +++ b/gcc/ada/a-except-2005.adb @@ -564,7 +564,7 @@ package body Ada.Exceptions is -- None of these procedures ever returns (they raise an exception). By -- using pragma No_Return, we ensure that any junk code after the call, - -- such as normal return epilog stuff, can be eliminated). + -- such as normal return epilogue stuff, can be eliminated). pragma No_Return (Rcheck_CE_Access_Check); pragma No_Return (Rcheck_CE_Null_Access_Parameter); diff --git a/gcc/ada/a-except.adb b/gcc/ada/a-except.adb index a436d6fb725..3ffd0a1aed0 100644 --- a/gcc/ada/a-except.adb +++ b/gcc/ada/a-except.adb @@ -513,7 +513,7 @@ package body Ada.Exceptions is -- None of these procedures ever returns (they raise an exception). By -- using pragma No_Return, we ensure that any junk code after the call, - -- such as normal return epilog stuff, can be eliminated). + -- such as normal return epilogue stuff, can be eliminated). pragma No_Return (Rcheck_CE_Access_Check); pragma No_Return (Rcheck_CE_Null_Access_Parameter); @@ -633,7 +633,7 @@ package body Ada.Exceptions is -- None of these procedures ever returns (they raise an exception). By -- using pragma No_Return, we ensure that any junk code after the call, - -- such as normal return epilog stuff, can be eliminated). + -- such as normal return epilogue stuff, can be eliminated). pragma No_Return (Rcheck_00); pragma No_Return (Rcheck_01); diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 2c6aabd2ff8..846fa03a622 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -20890,11 +20890,11 @@ When you use the @code{next} command in a function, the current source location will advance to the next statement as usual. A special case arises in the case of a @code{return} statement. -Part of the code for a return statement is the ``epilog'' of the function. +Part of the code for a return statement is the ``epilogue'' of the function. This is the code that returns to the caller. There is only one copy of -this epilog code, and it is typically associated with the last return +this epilogue code, and it is typically associated with the last return statement in the function if there is more than one return. In some -implementations, this epilog is associated with the first statement +implementations, this epilogue is associated with the first statement of the function. The result is that if you use the @code{next} command from a return diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index f33fd1f7d90..747a9de167f 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2013, Free Software Foundation, Inc. * + * Copyright (C) 1992-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- * @@ -1432,7 +1432,7 @@ __gnat_adjust_context (unsigned char *unw, ULONG64 rsp) { unsigned int len; - /* Version = 1, no flags, no prolog. */ + /* Version = 1, no flags, no prologue. */ if (unw[0] != 1 || unw[1] != 0) return; len = unw[2]; @@ -1442,7 +1442,7 @@ __gnat_adjust_context (unsigned char *unw, ULONG64 rsp) unw += 4; while (len > 0) { - /* Offset in prolog = 0. */ + /* Offset in prologue = 0. */ if (unw[0] != 0) return; switch (unw[1] & 0xf) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index b80efcec704..1e731f887a7 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2855,7 +2855,10 @@ package body Sem_Ch5 is -- container iteration. function Is_Wrapped_In_Block (N : Node_Id) return Boolean; - -- Determine whether node N is the sole statement of a block + -- Determine whether loop statement N has been wrapped in a block to + -- capture finalization actions that may be generated for container + -- iterators. Prevents infinite recursion when block is analyzed. + -- Routine is a noop if loop is single statement within source block. --------------------------- -- Is_Container_Iterator -- @@ -2919,14 +2922,27 @@ package body Sem_Ch5 is ------------------------- function Is_Wrapped_In_Block (N : Node_Id) return Boolean is - HSS : constant Node_Id := Parent (N); + HSS : Node_Id; + Stat : Node_Id; begin - return - Nkind (HSS) = N_Handled_Sequence_Of_Statements - and then Nkind (Parent (HSS)) = N_Block_Statement - and then First (Statements (HSS)) = N - and then No (Next (First (Statements (HSS)))); + if Ekind (Current_Scope) /= E_Block then + return False; + + else + HSS := + Handled_Statement_Sequence (Parent (Block_Node (Current_Scope))); + + -- Skip leading pragmas that may be introduced for invariant and + -- predicate checks. + + Stat := First (Statements (HSS)); + while Present (Stat) and then Nkind (Stat) = N_Pragma loop + Stat := Next (Stat); + end loop; + + return Stat = N and then No (Next (Stat)); + end if; end Is_Wrapped_In_Block; -- Local declarations diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 85a0d537225..4eaf51f1b23 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1093,7 +1093,7 @@ package Sinfo is -- Do_Storage_Check (Flag17-Sem) -- This flag is set in an N_Allocator node to indicate that a storage -- check is required for the allocation, or in an N_Subprogram_Body node - -- to indicate that a stack check is required in the subprogram prolog. + -- to indicate that a stack check is required in the subprogram prologue. -- The N_Allocator case is handled by the routine that expands the call -- to the runtime routine. The N_Subprogram_Body case is handled by the -- backend, and all the semantics does is set the flag.