diff options
author | Bob Duff <duff@adacore.com> | 2019-08-19 08:36:12 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-19 08:36:12 +0000 |
commit | dafa2ae46c9f0d95821fd365e8c554008b934819 (patch) | |
tree | 6556de1317772ac7eefd9f6c2b0b063164a6b8b2 /gcc/ada | |
parent | 27b2fbc95cea0512e71a4cd3090e68ae2bf4fe1d (diff) | |
download | gcc-dafa2ae46c9f0d95821fd365e8c554008b934819.zip gcc-dafa2ae46c9f0d95821fd365e8c554008b934819.tar.gz gcc-dafa2ae46c9f0d95821fd365e8c554008b934819.tar.bz2 |
[Ada] Factor out the "size for& too small..." error message
Use a constant for the Size_Too_Small_Message, so if it changes, it
won't change in one place but not another. DRY. It might be better to
move this code out of errout.adb, but that's for another day.
2019-08-19 Bob Duff <duff@adacore.com>
gcc/ada/
* errout.ads (Size_Too_Small_Message): New constant.
* errout.adb, freeze.adb, sem_ch13.adb: Use it.
From-SVN: r274648
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/errout.adb | 2 | ||||
-rw-r--r-- | gcc/ada/errout.ads | 6 | ||||
-rw-r--r-- | gcc/ada/freeze.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 2 |
5 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e1342f4..c01d358 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-08-19 Bob Duff <duff@adacore.com> + + * errout.ads (Size_Too_Small_Message): New constant. + * errout.adb, freeze.adb, sem_ch13.adb: Use it. + 2019-08-19 Eric Botcazou <ebotcazou@adacore.com> * exp_dist.adb (Build_Package_Stubs): Do not specifically visit diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index ea524f3..f5a4925 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -3259,7 +3259,7 @@ package body Errout is -- Processing for "Size too small" messages - elsif Msg = "size for& too small, minimum allowed is ^" then + elsif Msg = Size_Too_Small_Message then -- Suppress "size too small" errors in CodePeer mode, since code may -- be analyzed in a different configuration than the one used for diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index 10a43b1..9a54c7c 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -948,4 +948,10 @@ package Errout is -- This name is the identifier name as passed, cased according to the -- default identifier casing for the given file. + 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. + end Errout; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 78d1ed4..70f4b9d 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -786,9 +786,7 @@ package body Freeze is elsif Has_Size_Clause (T) then if RM_Size (T) < S then Error_Msg_Uint_1 := S; - Error_Msg_NE - ("size for& too small, minimum allowed is ^", - Size_Clause (T), T); + Error_Msg_NE (Size_Too_Small_Message, Size_Clause (T), T); end if; -- Set size if not set already diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 35a295c..92e308a 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10835,7 +10835,7 @@ package body Sem_Ch13 is if not ASIS_Mode then Error_Msg_Uint_1 := Min_Siz; - Error_Msg_NE ("size for& too small, minimum allowed is ^", N, T); + Error_Msg_NE (Size_Too_Small_Message, N, T); end if; end Size_Too_Small_Error; |