summaryrefslogtreecommitdiffstats
path: root/gcc/ada/scng.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-16 08:45:19 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-16 08:45:19 +0000
commitb7c799aac4dc8c85fffec5f949f0f122eefd287c (patch)
tree5b916e5fc59de413560d104b03f3d24bb616e5c5 /gcc/ada/scng.adb
parent7b785fabdf01ec9fe778b0790b99652e14b5f694 (diff)
downloadppe42-gcc-b7c799aac4dc8c85fffec5f949f0f122eefd287c.tar.gz
ppe42-gcc-b7c799aac4dc8c85fffec5f949f0f122eefd287c.zip
2005-06-14 Robert Dewar <dewar@adacore.com>
* scng.adb: Add call to new Check_EOF routine (Accumulate_Checksum): Properly handle wide wide char >= 2 ** 24 Add some comments regarding wide character handling * style.ads, styleg.ads, styleg.adb: Implement new style switch -gnatyu * stylesw.ads, stylesw.adb: Implement new style switch -gnatyu * g-utf_32.ads, g-utf_32.adb (Is_UTF_32_Non_Graphic): Other_Format characters are now considered graphic characters and hence yield false in this call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101056 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r--gcc/ada/scng.adb18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 13ef75c88ee..9d9d0aa5301 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -97,7 +97,8 @@ package body Scng is
procedure Accumulate_Checksum (C : Char_Code) is
begin
if C > 16#FFFF# then
- Accumulate_Checksum (Character'Val (C / 2 ** 16));
+ Accumulate_Checksum (Character'Val (C / 2 ** 24));
+ Accumulate_Checksum (Character'Val ((C / 2 ** 16) mod 256));
Accumulate_Checksum (Character'Val ((C / 256) mod 256));
else
Accumulate_Checksum (Character'Val (C / 256));
@@ -1110,6 +1111,10 @@ package body Scng is
Accumulate_Checksum (Code);
+ -- In Ada 95 mode we allow any wide characters in a string
+ -- but in Ada 2005, the set of characters allowed has been
+ -- restricted to graphic characters.
+
if Ada_Version >= Ada_05
and then Is_UTF_32_Non_Graphic (UTF_32 (Code))
then
@@ -1236,6 +1241,7 @@ package body Scng is
when EOF =>
if Scan_Ptr = Source_Last (Current_Source_File) then
Check_End_Of_Line;
+ if Style_Check then Style.Check_EOF; end if;
Token := Tok_EOF;
return;
else
@@ -1644,7 +1650,11 @@ package body Scng is
if Err then
Error_Illegal_Wide_Character;
- Code := Character'Pos (' ');
+ Code := Character'Pos (' ');
+
+ -- In Ada 95 mode we allow any wide character in a character
+ -- literal, but in Ada 2005, the set of characters allowed
+ -- is restricted to graphic characters.
elsif Ada_Version >= Ada_05
and then Is_UTF_32_Non_Graphic (UTF_32 (Code))
@@ -2257,6 +2267,10 @@ package body Scng is
-- stored. It seems reasonable to exclude it from the
-- checksum.
+ -- Note that it is correct (see AI-395) to simply strip
+ -- other format characters, before testing for double
+ -- underlines, or for reserved words).
+
elsif Is_UTF_32_Other (Cat) then
null;
OpenPOWER on IntegriCloud