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.
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;


Reply via email to