sem_ch3.adb (Analyze_Variant_Part): check that type of discriminant is discrete before analyzing choices.

* sem_ch3.adb (Analyze_Variant_Part): check that type of discriminant
	is discrete before analyzing choices.

	* bindgen.adb (Gen_Output_File_Ada): Generate a new C-like string
	containing the name of the Ada Main Program. This string is mainly
	intended for the debugger.
	(Gen_Output_File_C): Do the equivalent change when generating a C file.

	* ali.adb: Set new Dummy_Entry field in dependency entry

	* ali.ads: Add Dummy_Entry field to source dependency table

	* bcheck.adb (Check_Consistency): Ignore dummy D lines

	* lib-writ.adb (Writ_ALI): Write dummy D lines for missing source files

	* lib-writ.ads: Document dummy D lines for missing files.

	* types.ads: (Dummy_Time_Stamp): New value for non-existant files

From-SVN: r48126
This commit is contained in:
Geert Bosch 2001-12-17 22:07:05 +01:00
parent c1c22e7a70
commit 855ff2e1e4
9 changed files with 137 additions and 50 deletions

View File

@ -1,3 +1,29 @@
2001-12-17 Ed Schonberg <schonber@gnat.com>
* sem_ch3.adb (Analyze_Variant_Part): check that type of discriminant
is discrete before analyzing choices.
2001-12-17 Joel Brobecker <brobecke@gnat.com>
* bindgen.adb (Gen_Output_File_Ada): Generate a new C-like string
containing the name of the Ada Main Program. This string is mainly
intended for the debugger.
(Gen_Output_File_C): Do the equivalent change when generating a C file.
2001-12-17 Robert Dewar <dewar@gnat.com>
* ali.adb: Set new Dummy_Entry field in dependency entry
* ali.ads: Add Dummy_Entry field to source dependency table
* bcheck.adb (Check_Consistency): Ignore dummy D lines
* lib-writ.adb (Writ_ALI): Write dummy D lines for missing source files
* lib-writ.ads: Document dummy D lines for missing files.
* types.ads: (Dummy_Time_Stamp): New value for non-existant files
2001-12-17 Robert Dewar <dewar@gnat.com>
* ali.adb: Type reference does not reset current file.

View File

@ -1128,8 +1128,10 @@ package body ALI is
Sdep.Increment_Last;
Sdep.Table (Sdep.Last).Sfile := Get_Name (Lower => True);
Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
Sdep.Table (Sdep.Last).Dummy_Entry :=
(Sdep.Table (Sdep.Last).Stamp = Dummy_Time_Stamp);
-- Check for version number present, and if so store it
-- Acquire checksum value
Skip_Space;

View File

@ -517,10 +517,16 @@ package ALI is
-- Name of source file
Stamp : Time_Stamp_Type;
-- Time stamp value
-- Time stamp value. Note that this will be all zero characters
-- for the dummy entries for missing or non-dependent files.
Checksum : Word;
-- Checksum value
-- Checksum value. Note that this will be all zero characters
-- for the dummy entries for missing or non-dependent files
Dummy_Entry : Boolean;
-- Set True for dummy entries that correspond to missing files
-- or files where no dependency relationship exists.
Subunit_Name : Name_Id;
-- Name_Id for subunit name if present, else No_Name

View File

@ -529,6 +529,10 @@ package body Bcheck is
Sdep_Loop : for D in
ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep
loop
if Sdep.Table (D).Dummy_Entry then
goto Continue;
end if;
Src := Source_Id (Get_Name_Table_Info (Sdep.Table (D).Sfile));
-- If the time stamps match, or all checksums match, then we
@ -587,6 +591,8 @@ package body Bcheck is
exit Sdep_Loop;
end if;
<<Continue>>
null;
end loop Sdep_Loop;
end loop ALIs_Loop;
end Check_Consistency;

View File

@ -1752,9 +1752,10 @@ package body Bindgen is
end if;
end if;
-- Generate the GNAT_Version info only for the main program. Otherwise,
-- it can lead under some circumstances to a symbol duplication during
-- the link (for instance when a C program uses 2 Ada libraries)
-- Generate the GNAT_Version and Ada_Main_Program_name info only for
-- the main program. Otherwise, it can lead under some circumstances
-- to a symbol duplication during the link (for instance when a
-- C program uses 2 Ada libraries)
if Bind_Main_Program then
WBI ("");
@ -1762,6 +1763,17 @@ package body Bindgen is
WBI (" ""GNAT Version: " &
Gnat_Version_String & """;");
WBI (" pragma Export (C, GNAT_Version, ""__gnat_version"");");
WBI ("");
Set_String (" Ada_Main_Program_Name : constant String := """);
Get_Name_String (Units.Table (First_Unit_Entry).Uname);
Set_Main_Program_Name;
Set_String (""" & Ascii.NUL;");
Write_Statement_Buffer;
WBI
(" pragma Export (C, Ada_Main_Program_Name, " &
"""__gnat_ada_main_program_name"");");
end if;
-- No need to generate a finalization routine if there is no
@ -2006,15 +2018,21 @@ package body Bindgen is
WBI ("void __gnat_break_start () {}");
end if;
-- Generate the __gnat_version info only for the main program.
-- Otherwise, it can lead under some circumstances to a symbol
-- duplication during the link (for instance when a C program
-- uses 2 Ada libraries)
-- Generate the __gnat_version and __gnat_ada_main_program_name info
-- only for the main program. Otherwise, it can lead under some
-- circumstances to a symbol duplication during the link (for instance
-- when a C program uses 2 Ada libraries)
if Bind_Main_Program then
WBI ("");
WBI ("char __gnat_version[] = ""GNAT Version: " &
Gnat_Version_String & """;");
Set_String ("char __gnat_ada_main_program_name[] = """);
Get_Name_String (Units.Table (First_Unit_Entry).Uname);
Set_Main_Program_Name;
Set_String (""";");
Write_Statement_Buffer;
end if;
-- Generate the adafinal routine. In no runtime mode, this is

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- $Revision: 1.160 $
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@ -880,50 +880,60 @@ package body Lib.Writ is
begin
for J in 1 .. Num_Sdep loop
Unum := Sdep_Table (J);
Units.Table (Unum).Dependency_Num := J;
Sind := Units.Table (Unum).Source_Index;
-- Error defence, ignore entries with no source index
Write_Info_Initiate ('D');
Write_Info_Char (' ');
if Sind /= No_Source_File then
Units.Table (Unum).Dependency_Num := J;
-- Normal case of a dependent unit entry with a source index
if Units.Table (Unum).Dependent_Unit then
Write_Info_Initiate ('D');
if Sind /= No_Source_File
and then Units.Table (Unum).Dependent_Unit
then
Write_Info_Name (File_Name (Sind));
Write_Info_Tab (25);
Write_Info_Str (String (Time_Stamp (Sind)));
Write_Info_Char (' ');
Write_Info_Str (Get_Hex_String (Source_Checksum (Sind)));
-- If subunit, add unit name, omitting the %b at the end
if Present (Cunit (Unum))
and then Nkind (Unit (Cunit (Unum))) = N_Subunit
then
Get_Decoded_Name_String (Unit_Name (Unum));
Write_Info_Char (' ');
Write_Info_Name (File_Name (Sind));
Write_Info_Tab (25);
Write_Info_Str (String (Time_Stamp (Sind)));
Write_Info_Char (' ');
Write_Info_Str (Get_Hex_String (Source_Checksum (Sind)));
-- If subunit, add unit name, omitting the %b at the end
if Present (Cunit (Unum))
and then Nkind (Unit (Cunit (Unum))) = N_Subunit
then
Get_Decoded_Name_String (Unit_Name (Unum));
Write_Info_Char (' ');
Write_Info_Str (Name_Buffer (1 .. Name_Len - 2));
end if;
-- If Source_Reference pragma used output information
if Num_SRef_Pragmas (Sind) > 0 then
Write_Info_Char (' ');
if Num_SRef_Pragmas (Sind) = 1 then
Write_Info_Nat (Int (First_Mapped_Line (Sind)));
else
Write_Info_Nat (0);
end if;
Write_Info_Char (':');
Write_Info_Name (Reference_Name (Sind));
end if;
Write_Info_EOL;
Write_Info_Str (Name_Buffer (1 .. Name_Len - 2));
end if;
-- If Source_Reference pragma used output information
if Num_SRef_Pragmas (Sind) > 0 then
Write_Info_Char (' ');
if Num_SRef_Pragmas (Sind) = 1 then
Write_Info_Nat (Int (First_Mapped_Line (Sind)));
else
Write_Info_Nat (0);
end if;
Write_Info_Char (':');
Write_Info_Name (Reference_Name (Sind));
end if;
-- Case where there is no source index (happens for missing files)
-- Also come here for non-dependent units.
else
Write_Info_Name (Unit_File_Name (Unum));
Write_Info_Tab (25);
Write_Info_Str (String (Dummy_Time_Stamp));
Write_Info_Char (' ');
Write_Info_Str (Get_Hex_String (0));
end if;
Write_Info_EOL;
end loop;
end;

View File

@ -403,6 +403,7 @@ package Lib.Writ is
-- The dependency lines indicate the source files on which the compiled
-- units depend. This is used by the binder for consistency checking.
-- These lines are also referenced by the cross-reference information.
-- D source-name time-stamp checksum [subunit-name] line:file-name
@ -437,6 +438,13 @@ package Lib.Writ is
-- lines to ease readability. Blanks between fields are also
-- ignored.
-- For entries corresponding to files that were not present (and
-- thus resulted in error messages), or for files that are not
-- part of the dependency set, both the time stamp and checksum
-- are set to all zero characters. These dummy entries are ignored
-- by the binder in dependency checking, but must be present for
-- proper interpretation of the cross-reference data.
--------------------------
-- Cross-Reference Data --
--------------------------

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- $Revision: 1.10 $
-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@ -2609,6 +2609,13 @@ package body Sem_Ch3 is
Discr_Type := Etype (Entity (Discr_Name));
if not Is_Discrete_Type (Discr_Type) then
Error_Msg_N
("discriminant in a variant part must be of a discrete type",
Name (N));
return;
end if;
-- Call the instantiated Analyze_Choices which does the rest of the work
Analyze_Choices

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- $Revision: 1.3 $
-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@ -622,6 +622,10 @@ pragma Preelaborate (Types);
-- exact way in which this string is represented, and instead should
-- use the subprograms below.
Dummy_Time_Stamp : constant Time_Stamp_Type := (others => '0');
-- This is used for dummy time stamp values used in the D lines for
-- non-existant files, and is intended to be an impossible value.
function "=" (Left, Right : Time_Stamp_Type) return Boolean;
function "<=" (Left, Right : Time_Stamp_Type) return Boolean;
function ">=" (Left, Right : Time_Stamp_Type) return Boolean;