diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-16 16:30:48 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-16 16:30:48 +0000 |
commit | 9a4f36a469258d61477e892ab38b79ce3387adc8 (patch) | |
tree | c15915818fefe732dbe57105e1e89f4316dbd193 /gcc/ada/put_scos.adb | |
parent | 34deb790fd88270ee2b859af538166b37ad1dea5 (diff) | |
download | gcc-9a4f36a469258d61477e892ab38b79ce3387adc8.tar.gz |
* get_scos.adb, par_sco.adb, par_sco.ads, put_scos.adb, scos.adb,
scos.ads, exp_ch4.adb, sem_warn.adb: Code clean up, update
documentation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160849 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/put_scos.adb')
-rw-r--r-- | gcc/ada/put_scos.adb | 145 |
1 files changed, 99 insertions, 46 deletions
diff --git a/gcc/ada/put_scos.adb b/gcc/ada/put_scos.adb index 39b6288520e..53962b2545a 100644 --- a/gcc/ada/put_scos.adb +++ b/gcc/ada/put_scos.adb @@ -23,9 +23,43 @@ -- -- ------------------------------------------------------------------------------ -with SCOs; use SCOs; +with Atree; use Atree; +with SCOs; use SCOs; +with Sinfo; use Sinfo; procedure Put_SCOs is + Ctr : Nat; + + procedure Output_Range (T : SCO_Table_Entry); + -- Outputs T.From and T.To in line:col-line:col format + + procedure Output_Source_Location (Loc : Source_Location); + -- Output source location in line:col format + + ------------------ + -- Output_Range -- + ------------------ + + procedure Output_Range (T : SCO_Table_Entry) is + begin + Output_Source_Location (T.From); + Write_Info_Char ('-'); + Output_Source_Location (T.To); + end Output_Range; + + ---------------------------- + -- Output_Source_Location -- + ---------------------------- + + procedure Output_Source_Location (Loc : Source_Location) is + begin + Write_Info_Nat (Nat (Loc.Line)); + Write_Info_Char (':'); + Write_Info_Nat (Nat (Loc.Col)); + end Output_Source_Location; + +-- Start of processing for Put_SCOs + begin -- Loop through entries in SCO_Unit_Table @@ -64,35 +98,16 @@ begin Output_SCO_Line : declare T : SCO_Table_Entry renames SCO_Table.Table (Start); - procedure Output_Range (T : SCO_Table_Entry); - -- Outputs T.From and T.To in line:col-line:col format - - ------------------ - -- Output_Range -- - ------------------ - - procedure Output_Range (T : SCO_Table_Entry) is - begin - Write_Info_Nat (Nat (T.From.Line)); - Write_Info_Char (':'); - Write_Info_Nat (Nat (T.From.Col)); - Write_Info_Char ('-'); - Write_Info_Nat (Nat (T.To.Line)); - Write_Info_Char (':'); - Write_Info_Nat (Nat (T.To.Col)); - end Output_Range; - - -- Start of processing for Output_SCO_Line - begin - Write_Info_Initiate ('C'); - Write_Info_Char (T.C1); - case T.C1 is -- Statements when 'S' => + Write_Info_Initiate ('C'); + Write_Info_Char ('S'); + + Ctr := 0; loop Write_Info_Char (' '); @@ -105,6 +120,18 @@ begin Start := Start + 1; pragma Assert (SCO_Table.Table (Start).C1 = 's'); + + Ctr := Ctr + 1; + + -- Up to 6 items on a line, if more than 6 items, + -- continuation lines are marked Cs. + + if Ctr = 6 then + Write_Info_Terminate; + Write_Info_Initiate ('C'); + Write_Info_Char ('s'); + Ctr := 0; + end if; end loop; -- Statement continuations should not occur since they @@ -116,35 +143,61 @@ begin -- Decision when 'I' | 'E' | 'P' | 'W' | 'X' => - if T.C2 = ' ' then - Start := Start + 1; - end if; + Start := Start + 1; + + -- For disabled pragma, skip decision output. Note that + -- if the SCO table has been populated by Get_SCOs + -- (re-reading previously generated SCO information), + -- then the Node field of pragma entries is Empty. This + -- is the only way that Node can be Empty, so if we see + -- an Empty node field, we know the pragma is enabled. + + if T.C1 = 'P' + and then Present (T.Node) + and then not Pragma_Enabled (Original_Node (T.Node)) + then + while not SCO_Table.Table (Start).Last loop + Start := Start + 1; + end loop; - -- Loop through table entries for this decision + -- For all other cases output decision line - loop - declare - T : SCO_Table_Entry renames SCO_Table.Table (Start); + else + Write_Info_Initiate ('C'); + Write_Info_Char (T.C1); - begin + if T.C1 /= 'X' then Write_Info_Char (' '); + Output_Source_Location (T.From); + end if; - if T.C1 = '!' or else - T.C1 = '^' or else - T.C1 = '&' or else - T.C1 = '|' - then - Write_Info_Char (T.C1); + -- Loop through table entries for this decision - else - Write_Info_Char (T.C2); - Output_Range (T); - end if; + loop + declare + T : SCO_Table_Entry + renames SCO_Table.Table (Start); - exit when T.Last; - Start := Start + 1; - end; - end loop; + begin + Write_Info_Char (' '); + + if T.C1 = '!' or else + T.C1 = '&' or else + T.C1 = '|' + then + Write_Info_Char (T.C1); + Output_Source_Location (T.From); + + else + Write_Info_Char (T.C2); + Output_Range (T); + end if; + + exit when T.Last; + Start := Start + 1; + end; + end loop; + end if; when others => raise Program_Error; |