Commit 00838d9a by Arnaud Charlet

[multiple changes]

2009-07-15  Sergey Rybin  <rybin@adacore.com>

	* tree_in.ads, output.adb, tree_io.ads: Get rid of pragmas Warnings
	Off/On for with clause to System.OS_Lib - not needed any more.

2009-07-15  Ed Schonberg  <schonberg@adacore.com>

	* sem_warn.adb (Warn_On_Constant_Condition): if the constant condition
	is a literal of a derived boolean type, it appears as an unchecked
	conversion. Retrieve actual value from expression of conversion.

2009-07-15  Robert Dewar  <dewar@adacore.com>

	* sem_ch3.adb: Minor reformatting

	* lib-xref.ads, lib-xref.adb, lib.ads, par_sco.ads, par_sco.adb,
	lib-writ.ads, lib-writ.adb: Minor reformatting.
	Fix problem with SCO format in ALI files

From-SVN: r149674
parent fa01135d
2009-07-15 Ed Schonberg <schonberg@adacore.com>
* sem_warn.adb (Warn_On_Constant_Condition): if the constant condition
is a literal of a derived boolean type, it appears as an unchecked
conversion. Retrieve actual value from expression of conversion.
2009-07-15 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb: Minor reformatting
* lib-xref.ads, lib-xref.adb, lib.ads, par_sco.ads, par_sco.adb,
lib-writ.ads, lib-writ.adb: Minor reformatting.
Fix problem with SCO format in ALI files
2009-07-15 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb, exp_util.adb, tbuild.adb, tbuild.ads, exp_ch4.adb,
......@@ -36,11 +50,6 @@
* gcc-interface/Make-lang.in: Add dependency on par_sco.o for gnat1
2009-07-15 Sergey Rybin <rybin@adacore.com>
* tree_in.ads, tree_io.ads: Add pragma Warnings Off/On for with clause
to System.OS_Lib to avoid warnings.
2009-07-15 Robert Dewar <dewar@adacore.com>
* sinfo.ads, make.adb, par.ads, par.adb, sem_warn.adb: Minor
......
......@@ -632,12 +632,6 @@ package body Lib.Writ is
end if;
end;
end loop;
-- Output SCO information if present
if Generate_SCO then
SCO_Output (Unit_Num);
end if;
end Write_Unit_Information;
----------------------
......@@ -1236,8 +1230,20 @@ package body Lib.Writ is
end loop;
end;
Output_References;
-- Output cross-reference information
Write_Info_Terminate;
Output_References;
-- Output SCO information if present
if Generate_SCO then
Write_Info_Terminate;
SCO_Output;
end if;
-- Output of ALI file is complete
Close_Output_Library_Info;
end Write_ALI;
......
......@@ -2137,6 +2137,7 @@ package body Lib.Xref is
begin
Write_Info_Char ('[');
if Curru /= Gen_U then
Write_Info_Nat (Dependency_Num (Gen_U));
Write_Info_Char ('|');
......@@ -2230,7 +2231,7 @@ package body Lib.Xref is
Output_Import_Export_Info (XE.Ent);
end if;
Write_Info_Nat (Int (Get_Column_Number (XE.Loc)));
Write_Info_Nat (Int (Get_Column_Number (XE.Loc)));
Output_Instantiation_Refs (Sloc (XE.Ent));
end if;
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1998-2008, Free Software Foundation, Inc. --
-- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -42,7 +42,7 @@ package Lib.Xref is
-- X dependency-number filename
-- This header precedes xref information (entities/references from
-- the unit, identified by dependency number and file name. The
-- the unit), identified by dependency number and file name. The
-- dependency number is the index into the generated D lines and
-- is ones origin (i.e. 2 = reference to second generated D line).
......
......@@ -295,7 +295,7 @@ package Lib is
-- order. The number is ones origin, so a value of 2 refers to the
-- second generated D line. The Dependency_Number values are set
-- as the D lines are generated, and are used to generate proper
-- unit references in the generated xref information.
-- unit references in the generated xref information and SCO output.
-- Dynamic_Elab
-- A flag indicating if this unit was compiled with dynamic elaboration
......
......@@ -29,13 +29,7 @@
-- --
------------------------------------------------------------------------------
-- Note: the pragma Warnings (Off) here is because ASIS compiles this unit
-- without -gnatg, and System.OS_Lib is an implementation unit. This is a
-- temporary kludge which will be better resolved later on ???
pragma Warnings (Off);
with System.OS_Lib; use System.OS_Lib;
pragma Warnings (On);
package body Output is
......
......@@ -536,9 +536,10 @@ package body Par_SCO is
-- SCO_Output --
----------------
procedure SCO_Output (U : Unit_Number_Type) is
procedure SCO_Output is
Start : Nat;
Stop : Nat;
U : Unit_Number_Type;
procedure Output_Range (From : Source_Ptr; To : Source_Ptr);
-- Outputs Sloc range in line:col-line:col format (for now we do not
......@@ -566,10 +567,19 @@ package body Par_SCO is
dsco;
end if;
-- Find entry in unit table and set Start/Stop bounds in SCO table
-- Loop through entries in the unit table
for J in SCO_Unit_Table.First .. SCO_Unit_Table.Last loop
if U = SCO_Unit_Table.Table (J).Unit then
U := SCO_Unit_Table.Table (J).Unit;
if In_Extended_Main_Source_Unit (Cunit_Entity (U)) then
Write_Info_Initiate ('C');
Write_Info_Char (' ');
Write_Info_Nat (Dependency_Num (U));
Write_Info_Char (' ');
Write_Info_Name (Reference_Name (Source_Index (U)));
Write_Info_Terminate;
Start := SCO_Unit_Table.Table (J).Index;
if J = SCO_Unit_Table.Last then
......@@ -578,76 +588,70 @@ package body Par_SCO is
Stop := SCO_Unit_Table.Table (J + 1).Index - 1;
end if;
exit;
end if;
-- Seems like we should find the unit, but for now ignore ???
return;
end loop;
-- Loop through relevant entries in SCO table, outputting C lines
-- Loop through relevant entries in SCO table, outputting C lines
while Start <= Stop loop
declare
T : SCO_Table_Entry renames SCO_Table.Table (Start);
while Start <= Stop loop
declare
T : SCO_Table_Entry renames SCO_Table.Table (Start);
begin
Write_Info_Initiate ('C');
Write_Info_Char (T.C1);
begin
Write_Info_Initiate ('C');
Write_Info_Char (T.C1);
case T.C1 is
case T.C1 is
-- Statements, entry, exit
-- Statements, entry, exit
when 'S' | 'Y' | 'T' =>
Write_Info_Char (' ');
Output_Range (T.From, T.To);
when 'S' | 'Y' | 'T' =>
Write_Info_Char (' ');
Output_Range (T.From, T.To);
-- Decision
-- Decision
when 'I' | 'E' | 'W' | 'X' =>
if T.C2 = ' ' then
Start := Start + 1;
end if;
when 'I' | 'E' | 'W' | 'X' =>
if T.C2 = ' ' then
Start := Start + 1;
end if;
-- Loop through table entries for this decision
-- Loop through table entries for this decision
loop
declare
T : SCO_Table_Entry renames SCO_Table.Table (Start);
loop
declare
T : SCO_Table_Entry renames SCO_Table.Table (Start);
begin
Write_Info_Char (' ');
begin
Write_Info_Char (' ');
if T.C1 = '!' or else
T.C1 = '^' or else
T.C1 = '&' or else
T.C1 = '|'
then
Write_Info_Char (T.C1);
if T.C1 = '!' or else
T.C1 = '^' or else
T.C1 = '&' or else
T.C1 = '|'
then
Write_Info_Char (T.C1);
else
Write_Info_Char (T.C2);
Output_Range (T.From, T.To);
end if;
else
Write_Info_Char (T.C2);
Output_Range (T.From, T.To);
end if;
exit when T.Last;
Start := Start + 1;
end;
end loop;
exit when T.Last;
Start := Start + 1;
end;
end loop;
when others =>
raise Program_Error;
end case;
when others =>
raise Program_Error;
end case;
Write_Info_Terminate;
end;
Write_Info_Terminate;
end;
exit when Start = Stop;
Start := Start + 1;
exit when Start = Stop;
Start := Start + 1;
pragma Assert (Start <= Stop);
pragma Assert (Start <= Stop);
end loop;
end if;
end loop;
end SCO_Output;
......@@ -673,8 +677,9 @@ package body Par_SCO is
elsif Nkind (Lu) = N_Package_Body then
Traverse_Package_Body (Lu);
-- Ignore subprogram specifications
-- Also for now, ignore generic declarations and instantiations
-- Ignore subprogram specifications, since nothing to cover.
-- Also ignore instantiations, since again, nothing to cover.
-- Also for now, ignore generic declarations ???
else
null;
......
......@@ -44,7 +44,29 @@ package Par_SCO is
-- to indicate the first and last Sloc of some construct in the tree and
-- they have the form:
-- line:col-line:col ??? do we need generic instantiation stuff ???
-- line:col-line:col
-- Note that SCO's are generated only for generic templates, not for
-- generic instances (since only the first are part of the source). So
-- we don't need generic instantiation stuff in these line:col items.
-- SCO File headers
-- The SCO information follows the cross-reference information, so it
-- need not be read by tools like gnatbind, gnatmake etc. The SCO output
-- is divided into sections, one section for each unit for which SCO's
-- are generated. A SCO section has a header of the form:
-- C dependency-number filename
-- This header precedes SCO information for the unit identified by
-- dependency number and file name. The dependency number is the
-- index into the generated D lines and is ones origin (i.e. 2 =
-- reference to second generated D line).
-- Note that the filename here will reflect the original name if
-- a Source_Reference pragma was encountered (since all line number
-- references will be with respect to the original file).
-- Statements
......@@ -193,8 +215,9 @@ package Par_SCO is
-- (Typ = 'f') by the compiler. The condition is identified by the
-- First_Sloc value in the original tree.
procedure SCO_Output (U : Unit_Number_Type);
-- Outputs SCO lines for unit U in the ALI file, as recorded by a previous
-- call to SCO_Record, possibly modified by calls to Set_SCO_Condition.
procedure SCO_Output;
-- Outputs SCO lines for all units, with appropriate section headers, for
-- unit U in the ALI file, as recorded by previous calls to SCO_Record,
-- possibly modified by calls to Set_SCO_Condition.
end Par_SCO;
......@@ -13295,9 +13295,9 @@ package body Sem_Ch3 is
Ev := Uint_0;
-- Loop through literals of enumeration type setting pos and rep values
-- except that if the Ekind is already set, then it means that the
-- literal was already constructed (case of a derived type declaration
-- and we should not disturb the Pos and Rep values.
-- except that if the Ekind is already set, then it means the literal
-- was already constructed (case of a derived type declaration and we
-- should not disturb the Pos and Rep values.
while Present (L) loop
if Ekind (L) /= E_Enumeration_Literal then
......
......@@ -3360,7 +3360,10 @@ package body Sem_Warn is
begin
-- Adjust SCO condition if from source
if Comes_From_Source (Orig) then
if Generate_SCO
and then Comes_From_Source (Orig)
and then Is_Entity_Name (C)
then
declare
Start : Source_Ptr;
Dummy : Source_Ptr;
......@@ -3369,6 +3372,7 @@ package body Sem_Warn is
begin
Sloc_Range (Orig, Start, Dummy);
Atrue := Entity (C) = Standard_True;
if Present (Parent (C))
......
......@@ -34,13 +34,7 @@
-- tools that need to read the tree to the tree reading routines, and is
-- thus bound as part of such tools.
-- Note: the pragma Warnings (Off) here is because ASIS compiles this unit
-- without -gnatg, and System.OS_Lib is an implementation unit. This is a
-- temporary kludge which will be better resolved later on ???
pragma Warnings (Off);
with System.OS_Lib; use System.OS_Lib;
pragma Warnings (On);
procedure Tree_In (Desc : File_Descriptor);
-- Desc is the file descriptor for the file containing the tree, as written
......
......@@ -37,14 +37,7 @@
with Types; use Types;
with System; use System;
-- Note: the pragma Warnings (Off) here is because ASIS compiles this unit
-- without -gnatg, and System.OS_Lib is an implementation unit. This is a
-- temporary kludge which will be better resolved later on ???
pragma Warnings (Off);
with System.OS_Lib; use System.OS_Lib;
pragma Warnings (On);
package Tree_IO is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment