* [Ada] Guard against leading and trailing spaces reappearing in errors
@ 2021-05-04 9:52 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04 9:52 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
The leading and trailing spaces in error message strings have been
recently removed. This patch adds an assertion to prevent those spaces
from appearing again.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* errout.adb (Error_Msg_Internal): Add assertion to prevent
style mistakes reappearing in the future.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 495 bytes --]
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -952,6 +952,11 @@ package body Errout is
-- Start of processing for Error_Msg_Internal
begin
+ -- Detect common mistake of prefixing or suffing the message with a
+ -- space character.
+
+ pragma Assert (Msg (Msg'First) /= ' ' and then Msg (Msg'Last) /= ' ');
+
if Raise_Exception_On_Error /= 0 then
raise Error_Msg_Exception;
end if;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-04 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 9:52 [Ada] Guard against leading and trailing spaces reappearing in errors 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).