diff options
Diffstat (limited to 'gcc/ada/scng.adb')
| -rw-r--r-- | gcc/ada/scng.adb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index f0189c1..690656c 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -59,6 +59,9 @@ package body Scng is -- Local Subprograms -- ----------------------- + procedure Accumulate_Token_Checksum; + pragma Inline (Accumulate_Token_Checksum); + procedure Accumulate_Checksum (C : Character); pragma Inline (Accumulate_Checksum); -- This routine accumulates the checksum given character C. During the @@ -96,6 +99,17 @@ package body Scng is Accumulate_Checksum (Character'Val (C mod 256)); end Accumulate_Checksum; + ------------------------------- + -- Accumulate_Token_Checksum -- + ------------------------------- + + procedure Accumulate_Token_Checksum is + begin + System.CRC32.Update + (System.CRC32.CRC32 (Checksum), + Character'Val (Token_Type'Pos (Token))); + end Accumulate_Token_Checksum; + ---------------------------- -- Determine_Token_Casing -- ---------------------------- @@ -408,6 +422,7 @@ package body Scng is -- Procedure to scan integer literal. On entry, Scan_Ptr points to -- a digit, on exit Scan_Ptr points past the last character of -- the integer. + -- -- For each digit encountered, UI_Int_Value is multiplied by 10, -- and the value of the digit added to the result. In addition, -- the value in Scale is decremented by one for each actual digit @@ -444,7 +459,10 @@ package body Scng is C := Source (Scan_Ptr); if C = '_' then - Accumulate_Checksum ('_'); + -- We do not want to accumulate the '_' in the checksum, + -- so that 1_234 is equivalent to 1234, and does not + -- trigger compilation in "minimal recompilation" + -- (gnatmake -m). loop Scan_Ptr := Scan_Ptr + 1; @@ -707,6 +725,8 @@ package body Scng is end if; + Accumulate_Token_Checksum; + return; end Nlit; @@ -2063,16 +2083,19 @@ package body Scng is -- of the corresponding keyword. Token_Name := No_Name; + Accumulate_Token_Checksum; return; -- It is an identifier after all else Token := Tok_Identifier; + Accumulate_Token_Checksum; Post_Scan; return; end if; end Scan; + -------------------------- -- Set_Comment_As_Token -- -------------------------- |
