https://gcc.gnu.org/g:87bdd17829e93bf98d8984d6a16ed25081af6c0d
commit r15-3116-g87bdd17829e93bf98d8984d6a16ed25081af6c0d Author: Javier Miranda <mira...@adacore.com> Date: Sun Aug 11 11:11:29 2024 +0000 ada: String interpolation: report error without Extensions allowed The compiler does not report the correct error in occurrences of interpolated strings, when the sources are compiled without language extensions allowed. gcc/ada/ * scng.adb (Scan): Call Error_Msg_GNAT_Extension() to report an error, when the sources are compiled without Core_Extensions_ Allowed, and the scanner detects the beginning of an interpolated string. Diff: --- gcc/ada/scng.adb | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 08ce2ab5ad1c..658970fbab2d 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -2135,14 +2135,19 @@ package body Scng is -- Lower case letters when 'a' .. 'z' => - if Core_Extensions_Allowed - and then Source (Scan_Ptr) = 'f' + if Source (Scan_Ptr) = 'f' and then Source (Scan_Ptr + 1) = '"' then - Scan_Ptr := Scan_Ptr + 1; - Accumulate_Checksum (Source (Scan_Ptr)); - Token := Tok_Left_Interpolated_String; - return; + if Core_Extensions_Allowed then + Scan_Ptr := Scan_Ptr + 1; + Accumulate_Checksum (Source (Scan_Ptr)); + Token := Tok_Left_Interpolated_String; + return; + else + Error_Msg_GNAT_Extension + ("interpolated string", Scan_Ptr, + Is_Core_Extension => True); + end if; end if; Name_Len := 1; @@ -2155,15 +2160,20 @@ package body Scng is -- Upper case letters when 'A' .. 'Z' => - if Core_Extensions_Allowed - and then Source (Scan_Ptr) = 'F' + if Source (Scan_Ptr) = 'F' and then Source (Scan_Ptr + 1) = '"' then - Error_Msg_S - ("delimiter of interpolated string must be in lowercase"); - Scan_Ptr := Scan_Ptr + 1; - Token := Tok_Left_Interpolated_String; - return; + if Core_Extensions_Allowed then + Error_Msg_S + ("delimiter of interpolated string must be in lowercase"); + Scan_Ptr := Scan_Ptr + 1; + Token := Tok_Left_Interpolated_String; + return; + else + Error_Msg_GNAT_Extension + ("interpolated string", Scan_Ptr, + Is_Core_Extension => True); + end if; end if; Token_Contains_Uppercase := True;