From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id D615E393BC12; Wed, 28 Apr 2021 09:40:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D615E393BC12 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-185] [Ada] Remove unused subprograms X-Act-Checkin: gcc X-Git-Author: Arnaud Charlet X-Git-Refname: refs/heads/master X-Git-Oldrev: ce32ccfc25a1b12ff9f42b1d9b6150ea128a26ec X-Git-Newrev: 3cb4256addca89ff6d6c47ed3ea53499d5b97a52 Message-Id: <20210428094044.D615E393BC12@sourceware.org> Date: Wed, 28 Apr 2021 09:40:44 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2021 09:40:44 -0000 https://gcc.gnu.org/g:3cb4256addca89ff6d6c47ed3ea53499d5b97a52 commit r12-185-g3cb4256addca89ff6d6c47ed3ea53499d5b97a52 Author: Arnaud Charlet Date: Mon Dec 7 07:47:37 2020 -0500 [Ada] Remove unused subprograms gcc/ada/ * sem_ch3.adb (Analyze_Object_Declaration): Remove dead code. * ali.ads, ali.adb (Scan_ALI): Remove unused parameters. Remove unused code related to Xref lines. (Get_Typeref): Removed, no longer used. Diff: --- gcc/ada/ali.adb | 474 +--------------------------------------------------- gcc/ada/ali.ads | 20 --- gcc/ada/sem_ch3.adb | 19 +-- 3 files changed, 8 insertions(+), 505 deletions(-) diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb index f213c301c0c..7093766e8d4 100644 --- a/gcc/ada/ali.adb +++ b/gcc/ada/ali.adb @@ -894,8 +894,6 @@ package body ALI is T : Text_Buffer_Ptr; Ignore_ED : Boolean; Err : Boolean; - Read_Xref : Boolean := False; - Read_Lines : String := ""; Ignore_Lines : String := "X"; Ignore_Errors : Boolean := False; Directly_Scanned : Boolean := False) return ALI_Id @@ -907,7 +905,8 @@ package body ALI is NS_Found : Boolean; First_Arg : Arg_Id; - Ignore : array (Character range 'A' .. 'Z') of Boolean; + Ignore : array (Character range 'A' .. 'Z') of Boolean := + (others => False); -- Ignore (X) is set to True if lines starting with X are to -- be ignored by Scan_ALI and skipped, and False if the lines -- are to be read and processed. @@ -1006,16 +1005,6 @@ package body ALI is function Nextc return Character; -- Return current character without modifying pointer P - procedure Get_Typeref - (Current_File_Num : Sdep_Id; - Ref : out Tref_Kind; - File_Num : out Sdep_Id; - Line : out Nat; - Ref_Type : out Character; - Col : out Nat; - Standard_Entity : out Name_Id); - -- Parse the definition of a typeref (<...>, {...} or (...)) - procedure Scan_Invocation_Graph_Line; -- Parse a single line that encodes a piece of the invocation graph @@ -1423,94 +1412,6 @@ package body ALI is return T; end Get_Stamp; - ----------------- - -- Get_Typeref -- - ----------------- - - procedure Get_Typeref - (Current_File_Num : Sdep_Id; - Ref : out Tref_Kind; - File_Num : out Sdep_Id; - Line : out Nat; - Ref_Type : out Character; - Col : out Nat; - Standard_Entity : out Name_Id) - is - N : Nat; - begin - case Nextc is - when '<' => Ref := Tref_Derived; - when '(' => Ref := Tref_Access; - when '{' => Ref := Tref_Type; - when others => Ref := Tref_None; - end case; - - -- Case of typeref field present - - if Ref /= Tref_None then - P := P + 1; -- skip opening bracket - - if Nextc in 'a' .. 'z' then - File_Num := No_Sdep_Id; - Line := 0; - Ref_Type := ' '; - Col := 0; - Standard_Entity := Get_Name (Ignore_Spaces => True); - else - N := Get_Nat; - - if Nextc = '|' then - File_Num := Sdep_Id (N + Nat (First_Sdep_Entry) - 1); - P := P + 1; - N := Get_Nat; - else - File_Num := Current_File_Num; - end if; - - Line := N; - Ref_Type := Getc; - Col := Get_Nat; - Standard_Entity := No_Name; - end if; - - -- ??? Temporary workaround for nested generics case: - -- 4i4 Directories{1|4I9[4|6[3|3]]} - -- See C918-002 - - declare - Nested_Brackets : Natural := 0; - - begin - loop - case Nextc is - when '[' => - Nested_Brackets := Nested_Brackets + 1; - when ']' => - Nested_Brackets := Nested_Brackets - 1; - when others => - if Nested_Brackets = 0 then - exit; - end if; - end case; - - Skipc; - end loop; - end; - - P := P + 1; -- skip closing bracket - Skip_Space; - - -- No typeref entry present - - else - File_Num := No_Sdep_Id; - Line := 0; - Ref_Type := ' '; - Col := 0; - Standard_Entity := No_Name; - end if; - end Get_Typeref; - ---------- -- Getc -- ---------- @@ -1836,31 +1737,10 @@ package body ALI is begin First_Sdep_Entry := Sdep.Last + 1; - -- Acquire lines to be ignored - - if Read_Xref then - Ignore := - ('T' | 'U' | 'W' | 'Y' | 'Z' | 'D' | 'X' => False, others => True); - - -- Read_Lines parameter given - - elsif Read_Lines /= "" then - Ignore := ('U' => False, others => True); - - for J in Read_Lines'Range loop - Ignore (Read_Lines (J)) := False; - end loop; - - -- Process Ignore_Lines parameter - - else - Ignore := (others => False); - - for J in Ignore_Lines'Range loop - pragma Assert (Ignore_Lines (J) /= 'U'); - Ignore (Ignore_Lines (J)) := True; - end loop; - end if; + for J in Ignore_Lines'Range loop + pragma Assert (Ignore_Lines (J) /= 'U'); + Ignore (Ignore_Lines (J)) := True; + end loop; -- Setup ALI Table entry with appropriate defaults @@ -3465,347 +3345,7 @@ package body ALI is Fatal_Error; end if; - -- If we are ignoring Xref sections we are done (we ignore all - -- remaining lines since only xref related lines follow X). - - if Ignore ('X') and then not Debug_Flag_X then - return Id; - end if; - - -- Loop through Xref sections - - X_Loop : loop - Check_Unknown_Line; - exit X_Loop when C /= 'X'; - - -- Make new entry in section table - - Xref_Section.Increment_Last; - - Read_Refs_For_One_File : declare - XS : Xref_Section_Record renames - Xref_Section.Table (Xref_Section.Last); - - Current_File_Num : Sdep_Id; - -- Keeps track of the current file number (changed by nn|) - - begin - XS.File_Num := Sdep_Id (Get_Nat + Nat (First_Sdep_Entry) - 1); - XS.File_Name := Get_File_Name; - XS.First_Entity := Xref_Entity.Last + 1; - - Current_File_Num := XS.File_Num; - - Skip_Space; - - Skip_Eol; - C := Nextc; - - -- Loop through Xref entities - - while C /= 'X' and then C /= EOF loop - Xref_Entity.Increment_Last; - - Read_Refs_For_One_Entity : declare - XE : Xref_Entity_Record renames - Xref_Entity.Table (Xref_Entity.Last); - N : Nat; - - procedure Read_Instantiation_Reference; - -- Acquire instantiation reference. Caller has checked - -- that current character is '[' and on return the cursor - -- is skipped past the corresponding closing ']'. - - ---------------------------------- - -- Read_Instantiation_Reference -- - ---------------------------------- - - procedure Read_Instantiation_Reference is - Local_File_Num : Sdep_Id := Current_File_Num; - - begin - Xref.Increment_Last; - - declare - XR : Xref_Record renames Xref.Table (Xref.Last); - - begin - P := P + 1; -- skip [ - N := Get_Nat; - - if Nextc = '|' then - XR.File_Num := - Sdep_Id (N + Nat (First_Sdep_Entry) - 1); - Local_File_Num := XR.File_Num; - P := P + 1; - N := Get_Nat; - - else - XR.File_Num := Local_File_Num; - end if; - - XR.Line := N; - XR.Rtype := ' '; - XR.Col := 0; - - -- Recursive call for next reference - - if Nextc = '[' then - pragma Warnings (Off); -- kill recursion warning - Read_Instantiation_Reference; - pragma Warnings (On); - end if; - - -- Skip closing bracket after recursive call - - P := P + 1; - end; - end Read_Instantiation_Reference; - - -- Start of processing for Read_Refs_For_One_Entity - - begin - XE.Line := Get_Nat; - XE.Etype := Getc; - XE.Col := Get_Nat; - - case Getc is - when '*' => - XE.Visibility := Global; - when '+' => - XE.Visibility := Static; - when others => - XE.Visibility := Other; - end case; - - XE.Entity := Get_Name; - - -- Handle the information about generic instantiations - - if Nextc = '[' then - Skipc; -- Opening '[' - N := Get_Nat; - - if Nextc /= '|' then - XE.Iref_File_Num := Current_File_Num; - XE.Iref_Line := N; - else - XE.Iref_File_Num := - Sdep_Id (N + Nat (First_Sdep_Entry) - 1); - Skipc; - XE.Iref_Line := Get_Nat; - end if; - - if Getc /= ']' then - Fatal_Error; - end if; - - else - XE.Iref_File_Num := No_Sdep_Id; - XE.Iref_Line := 0; - end if; - - Current_File_Num := XS.File_Num; - - -- Renaming reference is present - - if Nextc = '=' then - P := P + 1; - XE.Rref_Line := Get_Nat; - - if Getc /= ':' then - Fatal_Error; - end if; - - XE.Rref_Col := Get_Nat; - - -- No renaming reference present - - else - XE.Rref_Line := 0; - XE.Rref_Col := 0; - end if; - - Skip_Space; - - XE.Oref_File_Num := No_Sdep_Id; - XE.Tref_File_Num := No_Sdep_Id; - XE.Tref := Tref_None; - XE.First_Xref := Xref.Last + 1; - - -- Loop to check for additional info present - - loop - declare - Ref : Tref_Kind; - File : Sdep_Id; - Line : Nat; - Typ : Character; - Col : Nat; - Std : Name_Id; - - begin - Get_Typeref - (Current_File_Num, Ref, File, Line, Typ, Col, Std); - exit when Ref = Tref_None; - - -- Do we have an overriding procedure? - - if Ref = Tref_Derived and then Typ = 'p' then - XE.Oref_File_Num := File; - XE.Oref_Line := Line; - XE.Oref_Col := Col; - - -- Arrays never override anything, and <> points to - -- the index types instead - - elsif Ref = Tref_Derived and then XE.Etype = 'A' then - - -- Index types are stored in the list of references - - Xref.Increment_Last; - - declare - XR : Xref_Record renames Xref.Table (Xref.Last); - begin - XR.File_Num := File; - XR.Line := Line; - XR.Rtype := Array_Index_Reference; - XR.Col := Col; - XR.Name := Std; - end; - - -- Interfaces are stored in the list of references, - -- although the parent type itself is stored in XE. - -- The first interface (when there are only - -- interfaces) is stored in XE.Tref*) - - elsif Ref = Tref_Derived - and then Typ = 'R' - and then XE.Tref_File_Num /= No_Sdep_Id - then - Xref.Increment_Last; - - declare - XR : Xref_Record renames Xref.Table (Xref.Last); - begin - XR.File_Num := File; - XR.Line := Line; - XR.Rtype := Interface_Reference; - XR.Col := Col; - XR.Name := Std; - end; - - else - XE.Tref := Ref; - XE.Tref_File_Num := File; - XE.Tref_Line := Line; - XE.Tref_Type := Typ; - XE.Tref_Col := Col; - XE.Tref_Standard_Entity := Std; - end if; - end; - end loop; - - -- Loop through cross-references for this entity - - loop - Skip_Space; - - if At_Eol then - Skip_Eol; - exit when Nextc /= '.'; - P := P + 1; - end if; - - Xref.Increment_Last; - - declare - XR : Xref_Record renames Xref.Table (Xref.Last); - - begin - N := Get_Nat; - - if Nextc = '|' then - XR.File_Num := - Sdep_Id (N + Nat (First_Sdep_Entry) - 1); - Current_File_Num := XR.File_Num; - P := P + 1; - N := Get_Nat; - else - XR.File_Num := Current_File_Num; - end if; - - XR.Line := N; - XR.Rtype := Getc; - - -- Imported entities reference as in: - -- 494b25 - - if Nextc = '<' then - Skipc; - XR.Imported_Lang := Get_Name; - - pragma Assert (Nextc = ','); - Skipc; - - XR.Imported_Name := Get_Name; - - pragma Assert (Nextc = '>'); - Skipc; - - else - XR.Imported_Lang := No_Name; - XR.Imported_Name := No_Name; - end if; - - XR.Col := Get_Nat; - - if Nextc = '[' then - Read_Instantiation_Reference; - end if; - end; - end loop; - - -- Record last cross-reference - - XE.Last_Xref := Xref.Last; - C := Nextc; - - exception - when Bad_ALI_Format => - - -- If ignoring errors, then we skip a line with an - -- unexpected error, and try to continue subsequent - -- xref lines. - - if Ignore_Errors then - Xref_Entity.Decrement_Last; - Skip_Line; - C := Nextc; - - -- Otherwise, we reraise the fatal exception - - else - raise; - end if; - end Read_Refs_For_One_Entity; - end loop; - - -- Record last entity - - XS.Last_Entity := Xref_Entity.Last; - end Read_Refs_For_One_File; - - C := Getc; - end loop X_Loop; - - -- Here after dealing with xref sections - - -- Ignore remaining lines, which belong to an additional section of the - -- ALI file not considered here (like SCO or SPARK information). - - Check_Unknown_Line; + -- This ALI parser does not care about Xref lines. return Id; diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads index ccb516f34a2..90bc94a0f49 100644 --- a/gcc/ada/ali.ads +++ b/gcc/ada/ali.ads @@ -1391,8 +1391,6 @@ package ALI is T : Text_Buffer_Ptr; Ignore_ED : Boolean; Err : Boolean; - Read_Xref : Boolean := False; - Read_Lines : String := ""; Ignore_Lines : String := "X"; Ignore_Errors : Boolean := False; Directly_Scanned : Boolean := False) return ALI_Id; @@ -1417,24 +1415,6 @@ package ALI is -- tables will not be filled in this case. It is not possible -- to ignore U (unit) lines, they are always read. -- - -- Read_Lines requests that Scan_ALI process only lines that start - -- with one of the given characters. The corresponding data in the - -- ALI file for any characters not given in the list will not be - -- set. The default value of the null string indicates that all - -- lines should be read (unless Ignore_Lines is specified). U - -- (unit) lines are always read regardless of the value of this - -- parameter. - -- - -- Note: either Ignore_Lines or Read_Lines should be non-null, but not - -- both. If both are provided then only the Read_Lines value is used, - -- and the Ignore_Lines parameter is ignored. - -- - -- Read_Xref is set True to read and acquire the cross-reference - -- information. If Read_XREF is set to True, then the effect is to ignore - -- all lines other than U, W, D and X lines and the Ignore_Lines and - -- Read_Lines parameters are ignored (i.e. the use of True for Read_XREF - -- is equivalent to specifying an argument of "UWDX" for Read_Lines. - -- -- Ignore_Errors is normally False. If it is set True, then Scan_ALI -- will do its best to scan through a file and extract all information -- it can, even if there are errors. In this case Err is only set if diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 4c7b8e7659b..d796c47454c 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4164,27 +4164,10 @@ package body Sem_Ch3 is Set_Related_Array_Object (Base_Type (T), Id); end if; - -- Special checks for protected objects not at library level + -- Check for protected objects not at library level if Has_Protected (T) and then not Is_Library_Level_Entity (Id) then Check_Restriction (No_Local_Protected_Objects, Id); - - -- Protected objects with interrupt handlers must be at library level - - -- Ada 2005: This test is not needed (and the corresponding clause - -- in the RM is removed) because accessibility checks are sufficient - -- to make handlers not at the library level illegal. - - -- AI05-0303: The AI is in fact a binding interpretation, and thus - -- applies to the '95 version of the language as well. - - if Is_Protected_Type (T) - and then Has_Interrupt_Handler (T) - and then Ada_Version < Ada_95 - then - Error_Msg_N - ("interrupt object can only be declared at library level", Id); - end if; end if; -- Check for violation of No_Local_Timing_Events