Skip to content

Commit

Permalink
Q831-010 Remove ineffective use clauses.
Browse files Browse the repository at this point in the history
Change-Id: I55f327171303977aa6d6208e8308b51a7eb38743
  • Loading branch information
godunko authored and reznikmm committed Sep 6, 2017
1 parent a08cfc0 commit 37c8df0
Show file tree
Hide file tree
Showing 133 changed files with 257 additions and 403 deletions.
1 change: 0 additions & 1 deletion ada_module/core/src/ada_semantic_tree-entity_iteration.adb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ package body Ada_Semantic_Tree.Entity_Iteration is
----------

procedure Next (It : in out Semantic_Tree_Iterator) is
use Language.Tree.Database.File_Set;

procedure Next_All_Access;
procedure Next_Referenced_Entity;
Expand Down
3 changes: 1 addition & 2 deletions ada_module/core/src/ada_semantic_tree-interfaces.adb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ package body Ada_Semantic_Tree.Interfaces is
------------------------

procedure Register_Assistant (Db : Construct_Database_Access) is
use Tree_Annotations_Pckg;

Import_Key : Construct_Annotations_Pckg.Annotation_Key;

begin
Get_Annotation_Key
(Get_Construct_Annotation_Key_Registry (Db).all,
Expand Down
3 changes: 1 addition & 2 deletions ada_module/core/src/ada_semantic_tree-lang.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1382,10 +1382,9 @@ package body Ada_Semantic_Tree.Lang is
(Db : Construct_Database_Access)
return Construct_Annotations_Pckg.Annotation_Key
is
use Construct_Annotations_Pckg;

Assistant : constant Database_Assistant_Access :=
Get_Assistant (Db, Ada_Assistant_Id);

begin
return Ada_Assistant (Assistant.all).Ada_Ref_Key;
end Get_Ref_Key;
Expand Down
17 changes: 8 additions & 9 deletions ada_module/core/src/ada_semantic_tree-parts.adb
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@ package body Ada_Semantic_Tree.Parts is
------------------------

procedure Register_Assistant (Db : Construct_Database_Access) is
use Construct_Annotations_Pckg;
use Tree_Annotations_Pckg;

Ada_Part_Entity_Key : Construct_Annotations_Pckg.Annotation_Key;

begin
Get_Annotation_Key
Construct_Annotations_Pckg.Get_Annotation_Key
(Get_Construct_Annotation_Key_Registry (Db).all,
Ada_Part_Entity_Key);

Expand Down Expand Up @@ -154,8 +152,8 @@ package body Ada_Semantic_Tree.Parts is
is
pragma Unreferenced (Assistant, Old_Tree);

use Tree_Annotations_Pckg;
It : Unit_Iterator;
It : Unit_Iterator;

begin
if Kind /= Minor_Change then
-- If this is not a minor change, then the entities relations may
Expand Down Expand Up @@ -764,23 +762,24 @@ package body Ada_Semantic_Tree.Parts is
Assistant : Ada_Part_Db_Assistant'Class)
return Ada_Relation_Access
is
use Tree_Annotations_Pckg;
use Construct_Annotations_Pckg;
use type Language.Tree.Construct_Annotations_Pckg.Annotation;

It : Construct_Tree_Iterator;
Relation_Annotation : Construct_Annotations_Pckg.Annotation;

begin
-- Then, extract the relation from the annotations.

It := To_Construct_Tree_Iterator (Entity);

Get_Annotation
Construct_Annotations_Pckg.Get_Annotation
(Get_Annotation_Container (Get_Tree (Get_File (Entity)), It).all,
Assistant.Parts_Key,
Relation_Annotation);

if Relation_Annotation = Construct_Annotations_Pckg.Null_Annotation then
return null;

else
return Ada_Relation_Annotation
(Relation_Annotation.Other_Val.all).Relation;
Expand Down
3 changes: 0 additions & 3 deletions ada_module/core/src/ada_semantic_tree-units.adb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ package body Ada_Semantic_Tree.Units is
----------

procedure Next (It : in out Unit_Iterator) is
use File_Set;
begin
if It.Unit_Cursor /= Persistent_Entity_List.No_Element then
It.Unit_Cursor := Next (It.Unit_Cursor);
Expand All @@ -291,7 +290,6 @@ package body Ada_Semantic_Tree.Units is
---------

function Get (It : Unit_Iterator) return Entity_Access is
use File_Set;
begin
if It.Unit_Cursor /= Persistent_Entity_List.No_Element then
return To_Entity_Access (Element (It.Unit_Cursor));
Expand Down Expand Up @@ -350,7 +348,6 @@ package body Ada_Semantic_Tree.Units is
------------

function At_End (It : Unit_Iterator) return Boolean is
use File_Set;
begin
return It.Unit_Cursor = Persistent_Entity_List.No_Element
and then At_End (It.Db_Iterator);
Expand Down
1 change: 0 additions & 1 deletion ada_module/core/src/ada_semantic_tree-units.ads
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ private

package Unit_Set_Pckg is new
Ada.Containers.Ordered_Sets (Unit_Access);
use Unit_Set_Pckg;

package Persistent_Entity_List is new
Ada.Containers.Ordered_Sets (Entity_Persistent_Access);
Expand Down
3 changes: 0 additions & 3 deletions ada_module/core/src/ada_semantic_tree-visibility.adb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ package body Ada_Semantic_Tree.Visibility is
------------------------

procedure Register_Assistant (Db : Construct_Database_Access) is
use Construct_Annotations_Pckg;
begin
Register_Assistant
(Db, Ada_Visibility_Id, new Ada_Visibibility_Assistant);
Expand Down Expand Up @@ -99,8 +98,6 @@ package body Ada_Semantic_Tree.Visibility is
-- reasonable to delay it until the first Is_Public_Visible call is
-- made.

use Construct_Annotations_Pckg;

Tree : constant Construct_Tree := Get_Tree (File);

procedure Add_Scope
Expand Down
4 changes: 1 addition & 3 deletions ada_module/ui/src/ada_naming_editors.adb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- of the license. --
------------------------------------------------------------------------------

with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Unchecked_Deallocation;
with GNAT.Strings; use GNAT.Strings;
Expand Down Expand Up @@ -185,8 +185,6 @@ package body Ada_Naming_Editors is
procedure On_Standard_Scheme_Changed
(Object : access Gtk_Widget_Record'Class)
is
use Widget_List;

E : constant Ada_Naming_Editor := Ada_Naming_Editor (Object);
Value : Gint;

Expand Down
16 changes: 9 additions & 7 deletions browsers/src/browsers-dependency_items.adb
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,14 @@ package body Browsers.Dependency_Items is
(Self : not null access File_Item_Record)
return XML_Utils.Node_Ptr
is
N : constant Node_Ptr := new Node;
N : constant XML_Utils.Node_Ptr := new XML_Utils.Node;

begin
N.Tag := new String'("file");
Set_Attribute (N, "file", Self.Source.Display_Full_Name);
Set_Attribute
XML_Utils.Set_Attribute (N, "file", Self.Source.Display_Full_Name);
XML_Utils.Set_Attribute
(N, "project", Self.Project.Project_Path.Display_Full_Name);

return N;
end Save_To_XML;

Expand All @@ -281,7 +283,7 @@ package body Browsers.Dependency_Items is
is
begin
if Self.Explicit then
Set_Attribute (Node, "explicit", "1");
XML_Utils.Set_Attribute (Node, "explicit", "1");
end if;
end Save_To_XML;

Expand All @@ -297,9 +299,9 @@ package body Browsers.Dependency_Items is
Newly_Added : Boolean;
begin
Self.Find_Or_Create_File
(Filename => Create (+Get_Attribute (Node, "file")),
(Filename => Create (+XML_Utils.Get_Attribute (Node, "file")),
Project => Get_Project_Tree (Self.Kernel).Project_From_Path
(Create (+Get_Attribute (Node, "project"))),
(Create (+XML_Utils.Get_Attribute (Node, "project"))),
Item => It,
Newly_Added => Newly_Added);
return It;
Expand All @@ -317,7 +319,7 @@ package body Browsers.Dependency_Items is
begin
Self.Add_Link
(File_Item (From), File_Item (To),
Explicit => Get_Attribute (Node, "explicit") = "1");
Explicit => XML_Utils.Get_Attribute (Node, "explicit") = "1");
end Load_From_XML;

---------------------
Expand Down
6 changes: 2 additions & 4 deletions browsers/src/browsers-elaborations.adb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
-- of the license. --
------------------------------------------------------------------------------

with Ada.Containers;
with Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Browsers.Canvas; use Browsers.Canvas;
Expand Down Expand Up @@ -183,8 +182,6 @@ package body Browsers.Elaborations is
(Kernel : Kernel_Handle;
Cycle : Elaboration_Cycles.Cycle)
is
use type Ada.Containers.Count_Type;

Browser : constant Elaboration_Browser :=
Elaboration_Views.Get_Or_Create_View (Kernel, Focus => True);
Styles : constant access Browser_Styles :=
Expand Down Expand Up @@ -363,9 +360,10 @@ package body Browsers.Elaborations is
Status : Integer)
is
pragma Unreferenced (Self, Category, Target, Mode, Shadow, Background);
use type Ada.Containers.Count_Type;

Cycle : Elaboration_Cycles.Cycle renames Last_Elaboration_Cycle;
Show : constant Boolean := Get_Pref (Auto_Show_Preference);

begin
if Show
and then Status /= 0
Expand Down
44 changes: 25 additions & 19 deletions browsers/src/browsers-entities.adb
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,15 @@ package body Browsers.Entities is
is
Decl : constant General_Entity_Declaration :=
Self.Entity.Element.Get_Declaration;
N : constant Node_Ptr := new Node;
N : constant XML_Utils.Node_Ptr := new XML_Utils.Node;

begin
N.Tag := new String'("entity");
Set_Attribute (N, "name", To_String (Decl.Name));
Set_Attribute (N, "file", Decl.Loc.File.Display_Full_Name);
Set_Attribute (N, "line", Decl.Loc.Line'Img);
Set_Attribute (N, "col", Decl.Loc.Column'Img);
XML_Utils.Set_Attribute (N, "name", To_String (Decl.Name));
XML_Utils.Set_Attribute (N, "file", Decl.Loc.File.Display_Full_Name);
XML_Utils.Set_Attribute (N, "line", Decl.Loc.Line'Img);
XML_Utils.Set_Attribute (N, "col", Decl.Loc.Column'Img);

return N;
end Save_To_XML;

Expand All @@ -331,12 +333,12 @@ package body Browsers.Entities is

overriding procedure Save_To_XML
(Self : not null access Entity_Link_Record;
Node : not null XML_Utils.Node_Ptr)
is
Node : not null XML_Utils.Node_Ptr) is
begin
Set_Attribute (Node, "name", To_String (Self.Name));
XML_Utils.Set_Attribute (Node, "name", To_String (Self.Name));

if Self.Parent_Link then
Set_Attribute (Node, "parent", "1");
XML_Utils.Set_Attribute (Node, "parent", "1");
end if;
end Save_To_XML;

Expand All @@ -350,13 +352,15 @@ package body Browsers.Entities is
is
E : constant Root_Entity'Class :=
Self.Kernel.Databases.Get_Entity
(Name => Get_Attribute (Node, "name"),
(Name => XML_Utils.Get_Attribute (Node, "name"),
Loc =>
(File => Create (+Get_Attribute (Node, "file")),
(File => Create (+XML_Utils.Get_Attribute (Node, "file")),
Project => <>,
Line => Integer'Value (Get_Attribute (Node, "line")),
Line =>
Integer'Value (XML_Utils.Get_Attribute (Node, "line")),
Column =>
Visible_Column_Type'Value (Get_Attribute (Node, "col"))));
Visible_Column_Type'Value
(XML_Utils.Get_Attribute (Node, "col"))));
It : Type_Item;
Newly_Added : Boolean;
begin
Expand All @@ -374,10 +378,12 @@ package body Browsers.Entities is
From, To : not null access GPS_Item_Record'Class)
is
pragma Unreferenced (Self);

begin
Add_Link (Type_Item (From), Type_Item (To),
Link_Name => Get_Attribute (Node, "name"),
Parent_Link => Get_Attribute (Node, "parent") = "1");
Add_Link
(Type_Item (From), Type_Item (To),
Link_Name => XML_Utils.Get_Attribute (Node, "name"),
Parent_Link => XML_Utils.Get_Attribute (Node, "parent") = "1");
end Load_From_XML;

-----------------
Expand Down Expand Up @@ -890,10 +896,10 @@ package body Browsers.Entities is
----------------

procedure Add_Fields (Item : not null access Type_Item_Record'Class) is
use Entity_Arrays;
B : constant Type_Browser := Type_Browser (Item.Browser);
S : constant access Browser_Styles := B.Get_View.Get_Styles;
B : constant Type_Browser := Type_Browser (Item.Browser);
S : constant access Browser_Styles := B.Get_View.Get_Styles;
Literals : Xref.Entity_Array := Item.Entity.Element.Literals;

begin
if Literals'Length /= 0 then
for F in Literals'Range loop
Expand Down
17 changes: 9 additions & 8 deletions browsers/src/browsers-projects.adb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ package body Browsers.Projects is
Position => Position_Automatic,
Group => Group_Default);
subtype Project_Browser is Project_Views.View_Access;
use type Project_Browser;

procedure Examine_Project_Hierarchy
(Browser : not null access Project_Browser_Record'Class;
Expand Down Expand Up @@ -200,10 +199,12 @@ package body Browsers.Projects is
(Self : not null access Project_Item_Record)
return XML_Utils.Node_Ptr
is
N : constant Node_Ptr := new Node;
N : constant XML_Utils.Node_Ptr := new XML_Utils.Node;

begin
N.Tag := new String'("project");
Set_Attribute (N, "path", Self.Path.Display_Full_Name);
XML_Utils.Set_Attribute (N, "path", Self.Path.Display_Full_Name);

return N;
end Save_To_XML;

Expand All @@ -213,11 +214,10 @@ package body Browsers.Projects is

overriding procedure Save_To_XML
(Self : not null access Project_Link_Record;
Node : not null XML_Utils.Node_Ptr)
is
Node : not null XML_Utils.Node_Ptr) is
begin
if Self.Limited_With then
Set_Attribute (Node, "limited_with", "1");
XML_Utils.Set_Attribute (Node, "limited_with", "1");
end if;
end Save_To_XML;

Expand All @@ -231,7 +231,8 @@ package body Browsers.Projects is
is
P : constant Project_Type :=
Get_Project_Tree (Self.Kernel).Project_From_Path
(Create (+Get_Attribute (Node, "path")));
(Create (+XML_Utils.Get_Attribute (Node, "path")));

begin
return Self.Add_Project_If_Not_Present (P);
end Load_From_XML;
Expand All @@ -247,7 +248,7 @@ package body Browsers.Projects is
begin
Self.Add_Link_If_Not_Present
(Project_Item (From), Project_Item (To),
Limited_With => Get_Attribute (Node, "limited_with") = "1");
Limited_With => XML_Utils.Get_Attribute (Node, "limited_with") = "1");
end Load_From_XML;

--------------------
Expand Down
1 change: 0 additions & 1 deletion browsers/src/browsers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ with GPS.Kernel.Preferences; use GPS.Kernel.Preferences;
with Gdk.RGBA; use Gdk.RGBA;
with Gdk.Types; use Gdk.Types;
with Glib.Object; use Glib, Glib.Object;
with Gtk.Enums; use Gtk.Enums;
with Gtkada.Canvas_View.Views; use Gtkada.Canvas_View.Views;
with Gtkada.Canvas_View; use Gtkada.Canvas_View;
with Pango.Enums; use Pango.Enums;
Expand Down
4 changes: 2 additions & 2 deletions browsers/src/browsers.ads
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

with Glib;
with Gtkada.Canvas_View;
with Gtkada.Style; use Gtkada.Style;
with XML_Utils; use XML_Utils;
with Gtkada.Style; use Gtkada.Style;
with XML_Utils;

package Browsers is

Expand Down
Loading

0 comments on commit 37c8df0

Please sign in to comment.