From: Pascal Obry Date: Thu, 16 Sep 2021 17:10:39 +0000 (+0200) Subject: [Ada] Issue a proper error message when no format specifier found X-Git-Tag: basepoints/gcc-13~4147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7d1d2c250e2d8d3892d620924795c10b6809337;p=thirdparty%2Fgcc.git [Ada] Issue a proper error message when no format specifier found gcc/ada/ * libgnat/g-forstr.adb (Next_Format): When there is no more format specifier found issue a proper error message instead of raising a contraint error. --- diff --git a/gcc/ada/libgnat/g-forstr.adb b/gcc/ada/libgnat/g-forstr.adb index d6596126a8d9..04539be026c6 100644 --- a/gcc/ada/libgnat/g-forstr.adb +++ b/gcc/ada/libgnat/g-forstr.adb @@ -519,7 +519,7 @@ package body GNAT.Formatted_String is J := J + 1; end loop; - if F (J) /= '%' or else J = F'Last then + if J >= F'Last or else F (J) /= '%' then raise Format_Error with "no format specifier found for parameter" & Positive'Image (Format.D.Current); end if;