This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Reflect ACT changes of 2001-11-05
- From: Geert Bosch <bosch at darwin dot gnat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Dec 2001 16:07:22 -0500 (EST)
- Subject: [Ada] Reflect ACT changes of 2001-11-05
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
*** sem_ch3.adb 2001/10/29 01:53:40 1.1364
--- sem_ch3.adb 2001/11/05 05:03:02 1.1365
***************
*** 2609,2614 ****
--- 2609,2621 ----
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
*** bindgen.adb 2001/10/18 18:05:22 1.204
--- bindgen.adb 2001/11/05 17:56:09 1.205
***************
*** 1738,1746 ****
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)
if Bind_Main_Program then
WBI ("");
--- 1738,1747 ----
end if;
end if;
! -- 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 ("");
***************
*** 1748,1753 ****
--- 1749,1765 ----
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
***************
*** 1992,2006 ****
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)
if Bind_Main_Program then
WBI ("");
WBI ("char __gnat_version[] = ""GNAT Version: " &
Gnat_Version_String & """;");
end if;
-- Generate the adafinal routine. In no runtime mode, this is
--- 2004,2024 ----
WBI ("void __gnat_break_start () {}");
end if;
! -- 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
*** ali.adb 2001/11/04 16:23:49 1.131
--- ali.adb 2001/11/05 20:09:22 1.132
***************
*** 1128,1135 ****
Sdep.Increment_Last;
Sdep.Table (Sdep.Last).Sfile := Get_Name (Lower => True);
Sdep.Table (Sdep.Last).Stamp := Get_Stamp;
! -- Check for version number present, and if so store it
Skip_Space;
--- 1128,1137 ----
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);
! -- Acquire checksum value
Skip_Space;
*** ali.ads 2001/11/04 16:23:57 1.76
--- ali.ads 2001/11/05 20:09:28 1.77
***************
*** 517,526 ****
-- Name of source file
Stamp : Time_Stamp_Type;
! -- Time stamp value
Checksum : Word;
! -- Checksum value
Subunit_Name : Name_Id;
-- Name_Id for subunit name if present, else No_Name
--- 517,532 ----
-- Name of source file
Stamp : Time_Stamp_Type;
! -- 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. 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
*** bcheck.adb 2001/09/29 03:24:43 1.41
--- bcheck.adb 2001/11/05 20:09:32 1.42
***************
*** 529,534 ****
--- 529,538 ----
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,592 ****
--- 591,598 ----
exit Sdep_Loop;
end if;
+ <<Continue>>
+ null;
end loop Sdep_Loop;
end loop ALIs_Loop;
end Check_Consistency;
*** lib-writ.adb 2001/09/29 03:25:40 1.162
--- lib-writ.adb 2001/11/05 20:09:37 1.163
***************
*** 880,929 ****
begin
for J in 1 .. Num_Sdep loop
Unum := Sdep_Table (J);
Sind := Units.Table (Unum).Source_Index;
! -- Error defence, ignore entries with no source index
! if Sind /= No_Source_File then
! Units.Table (Unum).Dependency_Num := J;
! if Units.Table (Unum).Dependent_Unit then
! Write_Info_Initiate ('D');
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;
end if;
end if;
end loop;
end;
--- 880,939 ----
begin
for J in 1 .. Num_Sdep loop
Unum := Sdep_Table (J);
+ Units.Table (Unum).Dependency_Num := J;
Sind := Units.Table (Unum).Source_Index;
! Write_Info_Initiate ('D');
! Write_Info_Char (' ');
! -- Normal case of a dependent unit entry with a source index
! 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_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;
*** lib-writ.ads 2001/09/29 03:25:45 1.15
--- lib-writ.ads 2001/11/05 20:09:41 1.16
***************
*** 403,408 ****
--- 403,409 ----
-- 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
***************
*** 436,441 ****
--- 437,449 ----
-- read, and separate sections of the file are separated by blank
-- 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 --
*** types.ads 2001/10/29 01:55:45 1.89
--- types.ads 2001/11/05 20:09:45 1.90
***************
*** 622,627 ****
--- 622,631 ----
-- 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;