diff mbox

[Ada] Fix some warnings in compiler bootstrap

Message ID 20170428133326.GA7438@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet April 28, 2017, 1:33 p.m. UTC
This fixes some of the remaining warnings that appear in a compiler bootstrap.
The above ones are false positives of -Wmaybe-uninitialized and most are fixed
by initializing the variable in case the control flow is fairly complicated; a
couple of very local cases are fixed by just adding pragma Warnings.

No functional changes.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-04-28  Eric Botcazou  <ebotcazou@adacore.com>

	* exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body): Also
	initialize Block_Decls variable.
	(Expand_Entry_Barrier): Add pragma Warnings on Func_Body variable.
	(Build_Dispatching_Requeue): Add pragma Warnings on Op variable.
	* exp_disp.adb (Expand_Interface_Actuals): Initialize
	Formal_DDT and Actual_DDT variables.
	(Expand_Interface_Thunk): Initialize Iface_Formal.
	(Make_DT): Initialize Size_Comp.
	(Make_Select_Specific_Data_Table): Initialize Decls.
	* exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies):
	Also initialize more RPC_Receiver_* variables.
	(Build_To_Any_Function): Initialize Cstr_Formal.
	* exp_prag.adb (Expand_Pragma_Contract_Cases): Initialize Msg_Str.
diff mbox

Patch

Index: exp_prag.adb
===================================================================
--- exp_prag.adb	(revision 247299)
+++ exp_prag.adb	(working copy)
@@ -1000,7 +1000,7 @@ 
       Flag          : Entity_Id;
       Flag_Decl     : Node_Id;
       If_Stmt       : Node_Id;
-      Msg_Str       : Entity_Id;
+      Msg_Str       : Entity_Id := Empty;
       Multiple_PCs  : Boolean;
       Old_Evals     : Node_Id   := Empty;
       Others_Decl   : Node_Id;
Index: exp_ch9.adb
===================================================================
--- exp_ch9.adb	(revision 247326)
+++ exp_ch9.adb	(working copy)
@@ -2956,7 +2956,7 @@ 
                              Ekind (Corresponding_Spec (N)) = E_Procedure;
             --  Indicates if N is a protected procedure body
 
-            Block_Decls   : List_Id;
+            Block_Decls   : List_Id := No_List;
             Try_Write     : Entity_Id;
             Desired_Comp  : Entity_Id;
             Decl          : Node_Id;
@@ -6117,6 +6117,7 @@ 
       Cond_Id    : Entity_Id;
       Entry_Body : Node_Id;
       Func_Body  : Node_Id;
+      pragma Warnings (Off, Func_Body);
 
    --  Start of processing for Expand_Entry_Barrier
 
@@ -9985,6 +9986,7 @@ 
          declare
             Elmt : Elmt_Id;
             Op   : Entity_Id;
+            pragma Warnings (Off, Op);
 
          begin
             Elmt := First_Elmt (Primitive_Operations (Etype (Conc_Typ)));
Index: exp_disp.adb
===================================================================
--- exp_disp.adb	(revision 247383)
+++ exp_disp.adb	(working copy)
@@ -1546,8 +1546,8 @@ 
       Formal     : Entity_Id;
       Formal_Typ : Entity_Id;
       Subp       : Entity_Id;
-      Formal_DDT : Entity_Id;
-      Actual_DDT : Entity_Id;
+      Formal_DDT : Entity_Id := Empty;  -- initialize to prevent warning
+      Actual_DDT : Entity_Id := Empty;  -- initialize to prevent warning
 
    begin
       --  This subprogram is called directly from the semantics, so we need a
@@ -1729,7 +1729,7 @@ 
       Expr          : Node_Id;
       Formal        : Node_Id;
       Ftyp          : Entity_Id;
-      Iface_Formal  : Node_Id;
+      Iface_Formal  : Node_Id := Empty;  -- initialize to prevent warning
       New_Arg       : Node_Id;
       Offset_To_Top : Node_Id;
       Target_Formal : Entity_Id;
@@ -5274,7 +5274,7 @@ 
             declare
                Prim_Elmt : Elmt_Id;
                Prim      : Entity_Id;
-               Size_Comp : Node_Id;
+               Size_Comp : Node_Id := Empty;
 
             begin
                Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
@@ -6377,7 +6377,7 @@ 
       Loc         : constant Source_Ptr := Sloc (Typ);
 
       Conc_Typ  : Entity_Id;
-      Decls     : List_Id;
+      Decls     : List_Id := No_List;
       Prim      : Entity_Id;
       Prim_Als  : Entity_Id;
       Prim_Elmt : Elmt_Id;
Index: exp_dist.adb
===================================================================
--- exp_dist.adb	(revision 247293)
+++ exp_dist.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1364,10 +1364,10 @@ 
       RPC_Receiver                   : Entity_Id;
       RPC_Receiver_Statements        : List_Id;
       RPC_Receiver_Case_Alternatives : constant List_Id := New_List;
-      RPC_Receiver_Elsif_Parts       : List_Id;
-      RPC_Receiver_Request           : Entity_Id;
-      RPC_Receiver_Subp_Id           : Entity_Id;
-      RPC_Receiver_Subp_Index        : Entity_Id;
+      RPC_Receiver_Elsif_Parts       : List_Id          := No_List;
+      RPC_Receiver_Request           : Entity_Id        := Empty;
+      RPC_Receiver_Subp_Id           : Entity_Id        := Empty;
+      RPC_Receiver_Subp_Index        : Entity_Id        := Empty;
 
       Subp_Str : String_Id;
 
@@ -9434,7 +9434,7 @@ 
             Stms   : List_Id;
 
             Expr_Formal : Entity_Id;
-            Cstr_Formal : Entity_Id;
+            Cstr_Formal : Entity_Id := Empty;  -- initialize to prevent warning
             Any         : Entity_Id;
             Result_TC   : Node_Id;