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.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-08-19 Bob Duff <d...@adacore.com>
gcc/ada/
* errout.ads (Size_Too_Small_Message): New constant.
* errout.adb, freeze.adb, sem_ch13.adb: Use it.
--- gcc/ada/errout.adb
+++ 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
--- gcc/ada/errout.ads
+++ 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;
--- gcc/ada/freeze.adb
+++ 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
--- gcc/ada/sem_ch13.adb
+++ 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;