public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2075] [Ada] Replace a question mark comment with assertion
@ 2021-07-06 14:49 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-06 14:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b1c4989d174cb22297a88f8873be95430ad62bcd

commit r12-2075-gb1c4989d174cb22297a88f8873be95430ad62bcd
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue May 11 14:11:12 2021 +0200

    [Ada] Replace a question mark comment with assertion
    
    gcc/ada/
    
            * lib.adb (Remove_Unit): Replace defensive code with an
            assertion.
            * par-load.adb (Load): Address a question mark in the comment.

Diff:
---
 gcc/ada/lib.adb      | 7 +++----
 gcc/ada/par-load.adb | 3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 44aa5c61e60..44a4af0aed2 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -1174,10 +1174,9 @@ package body Lib is
 
    procedure Remove_Unit (U : Unit_Number_Type) is
    begin
-      if U = Units.Last then
-         Unit_Names.Set (Unit_Name (U), No_Unit);
-         Units.Decrement_Last;
-      end if;
+      pragma Assert (U = Units.Last);
+      Unit_Names.Set (Unit_Name (U), No_Unit);
+      Units.Decrement_Last;
    end Remove_Unit;
 
    ----------------------------------
diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
index fe8fede714c..39c445ea992 100644
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -234,8 +234,7 @@ begin
          Error_Msg ("\\found unit $!", Loc);
       end if;
 
-      --  In both cases, remove the unit if it is the last unit (which it
-      --  normally (always?) will be) so that it is out of the way later.
+      --  In both cases, remove the unit so that it is out of the way later
 
       Remove_Unit (Cur_Unum);
    end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-06 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:49 [gcc r12-2075] [Ada] Replace a question mark comment with assertion Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).