From 495cdc79fb629750a71d5b1b1258425c3c3ebc58 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Mon, 16 Dec 2019 10:35:24 +0000 Subject: [PATCH] [Ada] Minor: improve comments 2019-12-16 Bob Duff gcc/ada/ * errout.adb, errout.ads: Improve comments. From-SVN: r279440 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/errout.adb | 3 +++ gcc/ada/errout.ads | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9a422d812bc..0f94e4047d1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2019-12-16 Bob Duff + + * errout.adb, errout.ads: Improve comments. + 2019-12-16 Bob Duff * sem_util.ads: Minor comment fix. diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 46e223f8d69..db3393c59f1 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -1716,9 +1716,12 @@ package body Errout is function Is_Size_Too_Small_Message (S : String) return Boolean is Size_For : constant String := "size for"; + pragma Assert (Size_Too_Small_Message (1 .. Size_For'Last) = Size_For); + -- Assert that Size_Too_Small_Message starts with Size_For begin return S'Length >= Size_For'Length and then S (S'First .. S'First + Size_For'Length - 1) = Size_For; + -- True if S starts with Size_For end Is_Size_Too_Small_Message; ----------------- diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index 64acff496ca..4cfb806d0e7 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -957,8 +957,9 @@ package Errout is function Is_Size_Too_Small_Message (S : String) return Boolean; Size_Too_Small_Message : constant String := "size for& too small, minimum allowed is ^"; - -- This message is explicitly tested in Special_Msg_Delete in the package - -- body, which is somewhat questionable, but at least by using a constant - -- we are obeying the DRY principle. + -- This message is printed in Freeze and Sem_Ch13. We also test for it in + -- the body of this package (see Special_Msg_Delete) ???which is somewhat + -- questionable. The Is_Size_Too_Small_Message function tests for it by + -- testing a prefix. The function and constant should be kept in synch. end Errout; -- 2.30.2