diff gcc/ada/libgnat/s-memory.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/ada/libgnat/s-memory.adb	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/ada/libgnat/s-memory.adb	Thu Feb 13 11:34:05 2020 +0900
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2018, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2019, 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- --
@@ -33,13 +33,10 @@
 
 --  This implementation assumes that the underlying malloc/free/realloc
 --  implementation is thread safe, and thus, no additional lock is required.
---  Note that we still need to defer abort because on most systems, an
---  asynchronous signal (as used for implementing asynchronous abort of
---  task) cannot safely be handled while malloc is executing.
-
---  If you are not using Ada constructs containing the "abort" keyword, then
---  you can remove the calls to Abort_Defer.all and Abort_Undefer.all from
---  this unit.
+--  Note that when using sjlj exception handling, we still need to defer abort
+--  because an asynchronous signal (as used for implementing asynchronous abort
+--  of task on sjlj runtimes) cannot safely be handled while malloc is
+--  executing.
 
 pragma Compiler_Unit_Warning;
 
@@ -80,7 +77,7 @@
          raise Storage_Error with "object too large";
       end if;
 
-      if Parameters.No_Abort then
+      if ZCX_By_Default or else Parameters.No_Abort then
          Result := c_malloc (System.CRTL.size_t (Size));
       else
          Abort_Defer.all;
@@ -121,7 +118,7 @@
 
    procedure Free (Ptr : System.Address) is
    begin
-      if Parameters.No_Abort then
+      if ZCX_By_Default or else Parameters.No_Abort then
          c_free (Ptr);
       else
          Abort_Defer.all;
@@ -145,7 +142,7 @@
          raise Storage_Error with "object too large";
       end if;
 
-      if Parameters.No_Abort then
+      if ZCX_By_Default or else Parameters.No_Abort then
          Result := c_realloc (Ptr, System.CRTL.size_t (Size));
       else
          Abort_Defer.all;