]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Guard against leading and trailing spaces reappearing in errors
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 28 Dec 2020 14:33:08 +0000 (15:33 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 4 May 2021 09:17:29 +0000 (05:17 -0400)
gcc/ada/

* errout.adb (Error_Msg_Internal): Add assertion to prevent
style mistakes reappearing in the future.

gcc/ada/errout.adb

index 2c050528898676939ad8181a48a86e86cc4809b2..3541a77233058ce1b06f195cde1594f3c3e46a1a 100644 (file)
@@ -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;