Commit dafa2ae4 by Bob Duff Committed by Pierre-Marie de Rodat

[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
parent 27b2fbc9
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
......
......@@ -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
......
......@@ -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;
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment