diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-17 21:07:05 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-17 21:07:05 +0000 |
commit | 26bdbe289ff47a014f2bf4aa06bf3d12d54ca755 (patch) | |
tree | a224052d9d5171d179321515f61186deba4f2b92 | |
parent | 8880be8571f9ef03b3cd47702aa15d31f4c0dad3 (diff) | |
download | gcc-26bdbe289ff47a014f2bf4aa06bf3d12d54ca755.tar.gz |
* 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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48126 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/ali.adb | 4 | ||||
-rw-r--r-- | gcc/ada/ali.ads | 10 | ||||
-rw-r--r-- | gcc/ada/bcheck.adb | 6 | ||||
-rw-r--r-- | gcc/ada/bindgen.adb | 32 | ||||
-rw-r--r-- | gcc/ada/lib-writ.adb | 74 | ||||
-rw-r--r-- | gcc/ada/lib-writ.ads | 8 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 9 | ||||
-rw-r--r-- | gcc/ada/types.ads | 6 |
9 files changed, 131 insertions, 44 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2c049d969ae..76ab8a01779 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb index c0d744ffb93..5a4c21bcffa 100644 --- a/gcc/ada/ali.adb +++ b/gcc/ada/ali.adb @@ -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; diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads index 1e427e836b8..78b9435f334 100644 --- a/gcc/ada/ali.ads +++ b/gcc/ada/ali.ads @@ -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 diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb index c4da7574030..77b3284fc33 100644 --- a/gcc/ada/bcheck.adb +++ b/gcc/ada/bcheck.adb @@ -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; diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index d2af91bc8d6..a45e7923e1f 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -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 diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index a7039f8390f..c2b15d59df0 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -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'); - 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 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 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 subunit, add unit name, omitting the %b at the end - -- If Source_Reference pragma used output information + 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 Num_SRef_Pragmas (Sind) > 0 then - Write_Info_Char (' '); + -- If Source_Reference pragma used output information - if Num_SRef_Pragmas (Sind) = 1 then - Write_Info_Nat (Int (First_Mapped_Line (Sind))); - else - Write_Info_Nat (0); - end if; + if Num_SRef_Pragmas (Sind) > 0 then + Write_Info_Char (' '); - Write_Info_Char (':'); - Write_Info_Name (Reference_Name (Sind)); + if Num_SRef_Pragmas (Sind) = 1 then + Write_Info_Nat (Int (First_Mapped_Line (Sind))); + else + Write_Info_Nat (0); end if; - Write_Info_EOL; + 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; diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads index 75621d765a4..f1770ba590e 100644 --- a/gcc/ada/lib-writ.ads +++ b/gcc/ada/lib-writ.ads @@ -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 -- -------------------------- diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index eb3d2939405..d1076c85ef9 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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 diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads index 4c73f2e4bc8..bd25cf616ec 100644 --- a/gcc/ada/types.ads +++ b/gcc/ada/types.ads @@ -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; |