From 22b77f6852d433ba17fe169004a085298f636041 Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Tue, 5 Oct 2010 10:22:52 +0000 Subject: [PATCH] prj-util.adb, [...]: Minor reformatting. 2010-10-05 Robert Dewar * prj-util.adb, prj-util.ads, prj.ads, s-vxwext-rtp.adb, sem_ch4.adb, sem_ch7.adb, sem_res.adb, sem_type.adb: Minor reformatting. Minor code reorganization (use Nkind_In). From-SVN: r164981 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/prj-util.adb | 37 +++++++++++++++++++++++++------------ gcc/ada/prj-util.ads | 23 +++++++++++------------ gcc/ada/prj.ads | 15 +++++++-------- gcc/ada/s-vxwext-rtp.adb | 6 ++++-- gcc/ada/sem_ch4.adb | 7 ++++--- gcc/ada/sem_ch7.adb | 11 +++++------ gcc/ada/sem_res.adb | 4 ++-- gcc/ada/sem_type.adb | 3 +-- 9 files changed, 65 insertions(+), 47 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 47f12db0539..787adbd0087 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2010-10-05 Robert Dewar + + * prj-util.adb, prj-util.ads, prj.ads, s-vxwext-rtp.adb, sem_ch4.adb, + sem_ch7.adb, sem_res.adb, sem_type.adb: Minor reformatting. + Minor code reorganization (use Nkind_In). + 2010-10-05 Ed Schonberg * sem_ch10.adb (Analyze_Task_Body_Stub): Diagnose duplicate stub for diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb index 1bc8b11bf07..494b04c482e 100644 --- a/gcc/ada/prj-util.adb +++ b/gcc/ada/prj-util.adb @@ -476,13 +476,13 @@ package body Prj.Util is ---------------- procedure Initialize - (Iter : out Source_Info_Iterator; For_Project : Name_Id) + (Iter : out Source_Info_Iterator; + For_Project : Name_Id) is Ind : constant Natural := Source_Info_Project_HTable.Get (For_Project); begin if Ind = 0 then Iter := (No_Source_Info, 0); - else Iter := Source_Info_Table.Table (Ind); end if; @@ -1049,9 +1049,10 @@ package body Prj.Util is ---------------------------- procedure Write_Source_Info_File (Tree : Project_Tree_Ref) is - Iter : Source_Iterator := For_Each_Source (Tree); + Iter : Source_Iterator := For_Each_Source (Tree); Source : Prj.Source_Id; File : Text_File; + begin if Opt.Verbose_Mode then Write_Line ("Writing new source info file " & @@ -1073,41 +1074,53 @@ package body Prj.Util is if not Source.Locally_Removed and then Source.Replaced_By = No_Source then - -- project name + -- Project name + Put_Line (File, Get_Name_String (Source.Project.Name)); - -- language name + + -- Language name + Put_Line (File, Get_Name_String (Source.Language.Name)); - -- kind + + -- Kind + Put_Line (File, Source.Kind'Img); - -- display path name + + -- Display path name + Put_Line (File, Get_Name_String (Source.Path.Display_Name)); -- Optional lines: - -- path name (P=) + -- Path name (P=) + if Source.Path.Name /= Source.Path.Display_Name then Put (File, "P="); Put_Line (File, Get_Name_String (Source.Path.Name)); end if; - -- unit name (U=) + -- Unit name (U=) + if Source.Unit /= No_Unit_Index then Put (File, "U="); Put_Line (File, Get_Name_String (Source.Unit.Name)); end if; - -- multi-source index (I=) + -- Multi-source index (I=) + if Source.Index /= 0 then Put (File, "I="); Put_Line (File, Source.Index'Img); end if; - -- naming exception ("N=T"); + -- Naming exception ("N=T"); + if Source.Naming_Exception then Put_Line (File, "N=T"); end if; - -- empty line to indicate end of info on this source + -- Empty line to indicate end of info on this source + Put_Line (File, ""); end if; diff --git a/gcc/ada/prj-util.ads b/gcc/ada/prj-util.ads index 5ee0ee78b42..508d7d999b1 100644 --- a/gcc/ada/prj-util.ads +++ b/gcc/ada/prj-util.ads @@ -104,7 +104,7 @@ package Prj.Util is In_Tree : Project_Tree_Ref; Force_Lower_Case_Index : Boolean := False; Allow_Wildcards : Boolean := False) return Variable_Value; - -- In a specific package, + -- In a specific package: -- - if there exists an array Attribute_Or_Array_Name with an index Name, -- returns the corresponding component (depending on the attribute, the -- index may or may not be case sensitive, see previous function), @@ -134,8 +134,8 @@ package Prj.Util is (Name : Name_Id; In_Packages : Package_Id; In_Tree : Project_Tree_Ref) return Package_Id; - -- Returns a specified package in a package list. Returns No_Package if - -- In_Packages is null or if Name is not the name of a package in + -- Returns a specified package in a package list. Returns No_Package + -- if In_Packages is null or if Name is not the name of a package in -- Package_List. The caller must ensure that Name is in lower case. function Value_Of @@ -150,9 +150,9 @@ package Prj.Util is (S : String; Max_Length : Positive; Separator : Character); - -- Output string S using Output.Write_Str. If S is too long to fit in - -- one line of Max_Length, cut it in several lines, using Separator as - -- the last character of each line, if possible. + -- Output string S using Output.Write_Str. If S is too long to fit in one + -- line of Max_Length, cut it in several lines, using Separator as the last + -- character of each line, if possible. type Text_File is limited private; -- Represents a text file (default is invalid text file) @@ -198,10 +198,9 @@ package Prj.Util is -- the new file. procedure Read_Source_Info_File (Tree : Project_Tree_Ref); - -- Check if there is a source info file specified for the project Tree and - -- if there is one, attempt to read it. If the file exists and is - -- successfully read, set the flag Source_Info_File_Exists to True for - -- the tree. + -- Check if there is a source info file specified for the project Tree. If + -- so, attempt to read it. If the file exists and is successfully read, set + -- the flag Source_Info_File_Exists to True for the tree. type Source_Info_Data is record Project : Name_Id; @@ -222,7 +221,8 @@ package Prj.Util is -- Iterator to get the sources for a single project procedure Initialize - (Iter : out Source_Info_Iterator; For_Project : Name_Id); + (Iter : out Source_Info_Iterator; + For_Project : Name_Id); -- Initiaize Iter for the project function Source_Info_Of (Iter : Source_Info_Iterator) return Source_Info; @@ -234,7 +234,6 @@ package Prj.Util is -- Advance the iterator to the next source in the project private - type Text_File_Data is record FD : File_Descriptor := Invalid_FD; Out_File : Boolean := False; diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index bdd7ccee62e..76a2e326dad 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -292,17 +292,16 @@ package Prj is Makefile_Dependency_Suffix : constant String := ".d"; ALI_Dependency_Suffix : constant String := ".ali"; - Switches_Dependency_Suffix : constant String := ".cswi"; - Binder_Exchange_Suffix : constant String := ".bexch"; + Binder_Exchange_Suffix : constant String := ".bexch"; -- Suffix for binder exchange files - Library_Exchange_Suffix : constant String := ".lexch"; + Library_Exchange_Suffix : constant String := ".lexch"; -- Suffix for library exchange files type Name_List_Index is new Nat; - No_Name_List : constant Name_List_Index := 0; + No_Name_List : constant Name_List_Index := 0; type Name_Node is record Name : Name_Id := No_Name; @@ -1348,19 +1347,19 @@ package Prj is Packages : Package_Table.Instance; Projects : Project_List; - Units_HT : Units_Htable.Instance; + Units_HT : Units_Htable.Instance; -- Unit name to Unit_Index (and from there so Source_Id) - Source_Paths_HT : Source_Paths_Htable.Instance; + Source_Paths_HT : Source_Paths_Htable.Instance; -- Full path to Source_Id - Source_Info_File_Name : String_Access := null; + Source_Info_File_Name : String_Access := null; -- The name of the source info file, if specified by the builder Source_Info_File_Exists : Boolean := False; -- True when a source info file has been successfully read - Private_Part : Private_Project_Tree_Data; + Private_Part : Private_Project_Tree_Data; end record; -- Data for a project tree diff --git a/gcc/ada/s-vxwext-rtp.adb b/gcc/ada/s-vxwext-rtp.adb index 39b7acf4c13..b27238c918b 100644 --- a/gcc/ada/s-vxwext-rtp.adb +++ b/gcc/ada/s-vxwext-rtp.adb @@ -60,7 +60,8 @@ package body System.VxWorks.Ext is function Interrupt_Connect (Vector : Interrupt_Vector; Handler : Interrupt_Handler; - Parameter : System.Address := System.Null_Address) return int is + Parameter : System.Address := System.Null_Address) return int + is pragma Unreferenced (Vector, Handler, Parameter); begin return ERROR; @@ -82,7 +83,8 @@ package body System.VxWorks.Ext is -------------------------------- function Interrupt_Number_To_Vector - (intNum : int) return Interrupt_Vector is + (intNum : int) return Interrupt_Vector + is pragma Unreferenced (intNum); begin return 0; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 35c1553a0a9..813a2977bf8 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -6103,9 +6103,10 @@ package body Sem_Ch4 is if Is_Discrete_Type (Entity (Actual)) then Rewrite (N, Make_Slice (Loc, - Prefix => Make_Function_Call (Loc, - Name => Relocate_Node (Name (N))), - Discrete_Range => + Prefix => + Make_Function_Call (Loc, + Name => Relocate_Node (Name (N))), + Discrete_Range => New_Occurrence_Of (Entity (Actual), Sloc (Actual)))); Analyze (N); diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index e2e234466cd..bd0d130b19e 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -487,8 +487,7 @@ package body Sem_Ch7 is function Has_Referencer (L : List_Id; - Outer : Boolean) - return Boolean; + Outer : Boolean) return Boolean; -- Traverse the given list of declarations in reverse order. -- Return True if a referencer is present. Return False if none is -- found. The Outer parameter is True for the outer level call and @@ -509,10 +508,10 @@ package body Sem_Ch7 is function Has_Referencer (L : List_Id; - Outer : Boolean) - return Boolean + Outer : Boolean) return Boolean is Has_Referencer_Except_For_Subprograms : Boolean := False; + D : Node_Id; E : Entity_Id; K : Node_Kind; @@ -532,7 +531,6 @@ package body Sem_Ch7 is V : Node_Id; begin - -- Check name of procedure or function calls if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) @@ -566,12 +564,13 @@ package body Sem_Ch7 is end if; return OK; - end Check_Subprogram_Ref; function Check_Subprogram_Refs is new Traverse_Func (Check_Subprogram_Ref); + -- Start of processing for Has_Referencer + begin if No (L) then return False; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b377bf28b38..a3721667195 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -1011,8 +1011,8 @@ package body Sem_Res is It : Interp; begin - -- if the context is an attribute reference that can apply to - -- functions, this is never a parameterless call. (RM 4.1.4 (6)) + -- If the context is an attribute reference that can apply to + -- functions, this is never a parameterless call (RM 4.1.4 (6)). if Nkind (Parent (N)) = N_Attribute_Reference and then (Attribute_Name (Parent (N)) = Name_Address diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 44f6960c0c2..ed6c25206c9 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -480,8 +480,7 @@ package body Sem_Type is then Add_Entry (Entity (N), Etype (N)); - elsif (Nkind (N) = N_Function_Call - or else Nkind (N) = N_Procedure_Call_Statement) + elsif Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) and then Is_Entity_Name (Name (N)) then Add_Entry (Entity (Name (N)), Etype (N));