From: Ghjuvan Lacambre Date: Thu, 20 Aug 2020 15:17:39 +0000 (+0200) Subject: [Ada] Fix parser not detecting casing issues in keywords X-Git-Tag: upstream/12.2.0~12703 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e354dca60268ea14f3b20fb865b23e27af751022;p=platform%2Fupstream%2Fgcc.git [Ada] Fix parser not detecting casing issues in keywords gcc/ada/ * scng.adb (Scan): Check if any letter of the token is uppercase. --- diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 162d882..0d5cff8 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -1180,6 +1180,8 @@ package body Scng is end if; end Start_Of_Wide_Character; + Token_Contains_Uppercase : Boolean; + -- Start of processing for Scan begin @@ -1241,6 +1243,8 @@ package body Scng is Token_Ptr := Scan_Ptr; + Token_Contains_Uppercase := False; + -- Here begins the main case statement which transfers control on the -- basis of the non-blank character we have encountered. @@ -1999,6 +2003,7 @@ package body Scng is -- Upper case letters when 'A' .. 'Z' => + Token_Contains_Uppercase := True; Name_Len := 1; Underline_Found := False; Name_Buffer (1) := @@ -2347,6 +2352,8 @@ package body Scng is Accumulate_Checksum (Source (Scan_Ptr)); elsif Source (Scan_Ptr) in 'A' .. 'Z' then + Token_Contains_Uppercase := True; + Name_Buffer (Name_Len + 1) := Character'Val (Character'Pos (Source (Scan_Ptr)) + 32); Accumulate_Checksum (Name_Buffer (Name_Len + 1)); @@ -2601,7 +2608,7 @@ package body Scng is -- Ada 2005 (AI-340): Do not apply the style check in case of -- MOD attribute. - if Source (Token_Ptr) <= 'Z' + if Token_Contains_Uppercase and then (Prev_Token /= Tok_Apostrophe or else (Token /= Tok_Access and then