aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-12-28 15:33:08 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-04 05:17:29 -0400
commitb65d9aff59bdaa77578de0666077fdf671a020bc (patch)
treea5a24f0395b1d0e2d13e1c7e9f76bab98514ca3c
parent6d326562ff4d6ee583123b24acf662a576ac54f6 (diff)
downloadgcc-b65d9aff59bdaa77578de0666077fdf671a020bc.zip
gcc-b65d9aff59bdaa77578de0666077fdf671a020bc.tar.gz
gcc-b65d9aff59bdaa77578de0666077fdf671a020bc.tar.bz2
[Ada] Guard against leading and trailing spaces reappearing in errors
gcc/ada/ * errout.adb (Error_Msg_Internal): Add assertion to prevent style mistakes reappearing in the future.
-rw-r--r--gcc/ada/errout.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 2c05052..3541a77 100644
--- 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;