2014-10-10 Gary Dismukes <dismukes@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Oct 2014 14:32:30 +0000 (14:32 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 10 Oct 2014 14:32:30 +0000 (14:32 +0000)
* 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  <schonberg@adacore.com>

* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216087 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/a-except-2005.adb
gcc/ada/a-except.adb
gcc/ada/gnat_ugn.texi
gcc/ada/raise-gcc.c
gcc/ada/sem_ch5.adb
gcc/ada/sinfo.ads

index 401751c..d410c97 100644 (file)
@@ -1,3 +1,14 @@
+2014-10-10  Gary Dismukes  <dismukes@adacore.com>
+
+       * 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  <schonberg@adacore.com>
+
+       * 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  <moy@adacore.com>
 
        * sem_prag.adb (Analyze_Global_Item): Accept formal objects in Global
index 0b33c0c..d03194b 100644 (file)
@@ -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);
index a436d6f..3ffd0a1 100644 (file)
@@ -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);
index 2c6aabd..846fa03 100644 (file)
@@ -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
index f33fd1f..747a9de 100644 (file)
@@ -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)
index b80efce..1e731f8 100644 (file)
@@ -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
index 85a0d53..4eaf51f 100644 (file)
@@ -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.