From 2d56744e3bfcf3cc27f4100b1903b2443d858f13 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Mon, 12 Aug 2019 09:00:39 +0000 Subject: [PATCH] [Ada] Minor cleanups in exception handling No change in behavior, so no test. 2019-08-12 Bob Duff gcc/ada/ * libgnat/a-except.ads: Update obsolete comment, still making clear that this is a variant. Add explicit default for Id component of Exception_Occurrence, because that value is used. Define Null_Occurrence less redundantly. * libgnat/a-einuoc.adb: Minor simplification of code. From-SVN: r274296 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/libgnat/a-einuoc.adb | 6 +----- gcc/ada/libgnat/a-except.ads | 22 ++++------------------ 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 244e9179973..351cc490152 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-08-12 Bob Duff + + * libgnat/a-except.ads: Update obsolete comment, still making + clear that this is a variant. Add explicit default for Id + component of Exception_Occurrence, because that value is used. + Define Null_Occurrence less redundantly. + * libgnat/a-einuoc.adb: Minor simplification of code. + 2019-08-12 Justin Squirek * libgnat/a-dhfina.adb, libgnat/a-dhfina.ads (Is_Simple_Name, diff --git a/gcc/ada/libgnat/a-einuoc.adb b/gcc/ada/libgnat/a-einuoc.adb index a949a16b8da..77d6b8dd955 100644 --- a/gcc/ada/libgnat/a-einuoc.adb +++ b/gcc/ada/libgnat/a-einuoc.adb @@ -40,9 +40,5 @@ begin -- The null exception is uniquely identified by the fact that the Id value -- is null. No other exception occurrence can have a null Id. - if X.Id = Null_Id then - return True; - else - return False; - end if; + return X.Id = Null_Id; end Ada.Exceptions.Is_Null_Occurrence; diff --git a/gcc/ada/libgnat/a-except.ads b/gcc/ada/libgnat/a-except.ads index 60ff5db5b5b..4f70769a9b9 100644 --- a/gcc/ada/libgnat/a-except.ads +++ b/gcc/ada/libgnat/a-except.ads @@ -33,14 +33,8 @@ -- -- ------------------------------------------------------------------------------ --- This version of Ada.Exceptions fully supports Ada 95 and later language --- versions. It is used in all situations except for the build of the --- compiler and other basic tools. For these latter builds, we use an --- Ada 95-only version. - --- The reason for this splitting off of a separate version is to support --- older bootstrap compilers that do not support Ada 2005 features, and --- Ada.Exceptions is part of the compiler sources. +-- This is the default version of this package. We also have cert and zfp +-- versions. pragma Polling (Off); -- We must turn polling off for this unit, because otherwise we get @@ -284,7 +278,7 @@ private -- Traceback array stored in exception occurrence type Exception_Occurrence is record - Id : Exception_Id; + Id : Exception_Id := Null_Id; -- Exception_Identity for this exception occurrence Machine_Occurrence : System.Address; @@ -336,14 +330,6 @@ private pragma Stream_Convert (Exception_Occurrence, String_To_EO, EO_To_String); -- Functions for implementing Exception_Occurrence stream attributes - Null_Occurrence : constant Exception_Occurrence := ( - Id => null, - Machine_Occurrence => System.Null_Address, - Msg_Length => 0, - Msg => (others => ' '), - Exception_Raised => False, - Pid => 0, - Num_Tracebacks => 0, - Tracebacks => (others => TBE.Null_TB_Entry)); + Null_Occurrence : constant Exception_Occurrence := (others => <>); end Ada.Exceptions; -- 2.30.2