This fixes some of the remaining warnings that appear in a compiler bootstrap. The above ones are false positives of -Wmaybe-uninitialized and some are fixed by initializing the variable in case the control flow is complicated; the rest is fixed by just adding pragma Warnings.
No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-28 Eric Botcazou <ebotca...@adacore.com> * exp_ch3.adb (Build_Init_Statements): Likewise on Nam. * freeze.adb (Check_Component_Storage_Order): And on Comp_Byte_Aligned. * sem_aggr.adb (Resolve_Record_Aggregate): Initialize Box_Node. * sem_attr.adb (Loop_Entry): Initialize Encl_Loop. * sem_ch12.adb (Build_Operator_Wrapper): Add pragma Warnings on Expr. * sem_ch13.adb (Validate_Address_Clauses): Initialize Y_Alignment and Y_Size. * sem_eval.adb (Why_Not_Static): Initialize Typ. * sem_prag.adb (Analyze_Pragma): Add pragma Warnings on Str.
Index: sem_aggr.adb =================================================================== --- sem_aggr.adb (revision 247293) +++ sem_aggr.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- -- @@ -3205,7 +3205,7 @@ -- -- This variable is updated as a side effect of function Get_Value. - Box_Node : Node_Id; + Box_Node : Node_Id := Empty; Is_Box_Present : Boolean := False; Others_Box : Integer := 0; -- Ada 2005 (AI-287): Variables used in case of default initialization Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 247387) +++ sem_prag.adb (working copy) @@ -12667,6 +12667,7 @@ Eloc : Source_Ptr; Expr : Node_Id; Str : Node_Id; + pragma Warnings (Off, Str); begin -- Pragma Check is Ghost when it applies to a Ghost entity. Set Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 247387) +++ sem_ch12.adb (working copy) @@ -5652,6 +5652,7 @@ Decl : Node_Id; Expr : Node_Id; + pragma Warnings (Off, Expr); F1, F2 : Entity_Id; Func : Entity_Id; Op_Name : Name_Id; Index: freeze.adb =================================================================== --- freeze.adb (revision 247338) +++ freeze.adb (working copy) @@ -1174,6 +1174,7 @@ Component_Aliased : Boolean; Comp_Byte_Aligned : Boolean; + pragma Warnings (Off, Comp_Byte_Aligned); -- Set for the record case, True if Comp starts on a byte boundary -- (in which case it is allowed to have different storage order). Index: sem_attr.adb =================================================================== --- sem_attr.adb (revision 247383) +++ sem_attr.adb (working copy) @@ -4322,7 +4322,7 @@ Context : constant Node_Id := Parent (N); Attr : Node_Id; - Encl_Loop : Node_Id; + Encl_Loop : Node_Id := Empty; Encl_Prag : Node_Id := Empty; Loop_Id : Entity_Id := Empty; Scop : Entity_Id; Index: sem_eval.adb =================================================================== --- sem_eval.adb (revision 247333) +++ sem_eval.adb (working copy) @@ -6457,8 +6457,8 @@ -------------------- procedure Why_Not_Static (Expr : Node_Id) is - N : constant Node_Id := Original_Node (Expr); - Typ : Entity_Id; + N : constant Node_Id := Original_Node (Expr); + Typ : Entity_Id := Empty; E : Entity_Id; Alt : Node_Id; Exp : Node_Id; Index: sem_ch13.adb =================================================================== --- sem_ch13.adb (revision 247387) +++ sem_ch13.adb (working copy) @@ -13334,10 +13334,10 @@ Expr : Node_Id; X_Alignment : Uint; - Y_Alignment : Uint; + Y_Alignment : Uint := Uint_0; X_Size : Uint; - Y_Size : Uint; + Y_Size : Uint := Uint_0; X_Offs : Uint; Index: exp_ch3.adb =================================================================== --- exp_ch3.adb (revision 247320) +++ exp_ch3.adb (working copy) @@ -2875,6 +2875,7 @@ declare Exp : Node_Id; Nam : Name_Id; + pragma Warnings (Off, Nam); Ritem : Node_Id; begin