diff options
author | Robert Dewar <dewar@adacore.com> | 2010-10-26 13:17:23 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-26 15:17:23 +0200 |
commit | dc718e52b96bde01a6095f8319c3a0191bff65a3 (patch) | |
tree | 466f5fb04a37f7d7c9a58c69639e6a947c91bcc8 /gcc/ada/prj-nmsc.adb | |
parent | b251750b22953106e31f33f86b6ff064f6a1b204 (diff) | |
download | gcc-dc718e52b96bde01a6095f8319c3a0191bff65a3.zip gcc-dc718e52b96bde01a6095f8319c3a0191bff65a3.tar.gz gcc-dc718e52b96bde01a6095f8319c3a0191bff65a3.tar.bz2 |
opt.ads: Move documentation on checksum stuff here from prj-nmsc
2010-10-26 Robert Dewar <dewar@adacore.com>
* opt.ads: Move documentation on checksum stuff here from prj-nmsc
* prj-nmsc.adb (Process_Project_Level_Array_Attributes): Move
documentation on checksum versions to opt.ads.
From-SVN: r165962
Diffstat (limited to 'gcc/ada/prj-nmsc.adb')
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 57 |
1 files changed, 17 insertions, 40 deletions
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index 6786e92..3865887 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -54,7 +54,10 @@ package body Prj.Nmsc is -- location. type Name_Location is record - Name : File_Name_Type; -- ??? duplicates the key + Name : File_Name_Type; + -- Key is duplicated, so that it is known when using functions Get_First + -- and Get_Next, as these functions only return an Element. + Location : Source_Ptr; Source : Source_Id := No_Source; Listed : Boolean := False; @@ -81,7 +84,10 @@ package body Prj.Nmsc is -- found on the disk. type Unit_Exception is record - Name : Name_Id; -- ??? duplicates the key + Name : Name_Id; + -- Key is duplicated, so that it is known when using functions Get_First + -- and Get_Next, as these functions only return an Element. + Spec : File_Name_Type; Impl : File_Name_Type; end record; @@ -2399,50 +2405,17 @@ package body Prj.Nmsc is Lang_Index.Config.Toolchain_Version := Element.Value.Value; - if Lang_Index.Name = Name_Ada then - -- The way the checksum is computed has evolved - -- across the different versions of GNAT. When - -- gprbuild is called with -m, the checksums need - -- to be computed the same way in gprbuild as it - -- was in the GNAT version of the compiler. - -- The different ways are: - -- - version 6.4 and later: - -- procedure Accumulate_Token_Checksum is - -- called after each numeric literal and each - -- identifier/keyword. For keywords, - -- Tok_Identifier is used in the call to - -- Accumulate_Token_Checksum. - -- - versions 5.04 to 6.3: - -- for keywords, the token value were used in - -- the call to Accumulate_Token_Checksum. Type - -- Token_Type did not include Tok_Some. - -- - versions 5.03: - -- for keywords, the token value were used in - -- the call to Accumulate_Token_Checksum. Type - -- Token_Type did not include Tok_Interface, - -- Tok_Overriding, Tok_Synchronized and - -- Tok_Some. - -- - versions 5.02 and before: - -- no call to Accumulate_Token_Checksum. - -- - -- To signal to the scanner that - -- Accumulate_Token_Checksum needs to be called and - -- what versions to call, 3 Booleans flags are used - -- in Opt: - -- - Checksum_Accumulate_Token_Checksum: True for - -- versions 5.03 and later, False for 5.02 and - -- before. - -- - Checksum_GNAT_6_3: False for versions 6.4 - -- and later, True for versions 6.3 and before. - -- - Checksum_GNAT_5_03: False for versions 5.04 - -- and later, True for versions 5.03 and before. + -- For Ada, set proper checksum computation mode + if Lang_Index.Name = Name_Ada then declare Vers : constant String := Get_Name_String (Element.Value.Value); pragma Assert (Vers'First = 1); begin + -- Version 6.3 or earlier + if Vers'Length >= 8 and then Vers (1 .. 5) = "GNAT " and then Vers (7) = '.' @@ -2453,17 +2426,21 @@ package body Prj.Nmsc is then Checksum_GNAT_6_3 := True; + -- Version 5.03 or earlier + if Vers (6) < '5' or else (Vers (6) = '5' and then Vers (Vers'Last) < '4') then Checksum_GNAT_5_03 := True; + -- Version 5.02 or earlier + if Vers (6) /= '5' or else Vers (Vers'Last) < '3' then Checksum_Accumulate_Token_Checksum := - False; + False; end if; end if; end if; |