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 <ebotca...@adacore.com> * inline.adb (Expand_Inlined_Call): Initialize Targ1 variable. * par-ch3.adb (P_Component_Items): Initialize Decl_Node variable. (P_Discrete_Choice_List): Initialize Expr_Node variable. * par-ch9.adb (P_Task): Initialize Aspect_Sloc variable. (P_Protected): Likewise. * sem_case.adb (Check_Duplicates): Add pragma Warnings on variable. * sem_ch12.adb (Preanalyze_Actuals): Initialize Vis variable. * sem_ch4.adb (List_Operand_Interps): Add pragma Warnings on variable. * sem_ch5.adb (Analyze_Assignment): Initialize Save_Full_Analysis. (Analyze_Exit_Statement): Initialize Scope_Id variable. (Analyze_Iterator_Specification): Initialize Bas variable. * sem_ch9.adb (Allows_Lock_Free_Implementation): Initialize Error_Count (Satisfies_Lock_Free_Requirements): Likewise. (Analyze_Accept_Statement): Initialize Task_Nam.
Index: par-ch9.adb =================================================================== --- par-ch9.adb (revision 247293) +++ par-ch9.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- -- @@ -79,7 +79,7 @@ -- Error recovery: cannot raise Error_Resync function P_Task return Node_Id is - Aspect_Sloc : Source_Ptr; + Aspect_Sloc : Source_Ptr := No_Location; Name_Node : Node_Id; Task_Node : Node_Id; Task_Sloc : Source_Ptr; @@ -425,7 +425,7 @@ -- Error recovery: cannot raise Error_Resync function P_Protected return Node_Id is - Aspect_Sloc : Source_Ptr; + Aspect_Sloc : Source_Ptr := No_Location; Name_Node : Node_Id; Protected_Node : Node_Id; Protected_Sloc : Source_Ptr; Index: sem_ch5.adb =================================================================== --- sem_ch5.adb (revision 247293) +++ sem_ch5.adb (working copy) @@ -107,7 +107,7 @@ T1 : Entity_Id; T2 : Entity_Id; - Save_Full_Analysis : Boolean; + Save_Full_Analysis : Boolean := False; -- initialize to prevent warning procedure Diagnose_Non_Variable_Lhs (N : Node_Id); -- N is the node for the left hand side of an assignment, and it is not @@ -1387,7 +1387,7 @@ procedure Analyze_Exit_Statement (N : Node_Id) is Target : constant Node_Id := Name (N); Cond : constant Node_Id := Condition (N); - Scope_Id : Entity_Id; + Scope_Id : Entity_Id := Empty; -- initialize to prevent warning U_Name : Entity_Id; Kind : Entity_Kind; @@ -1864,7 +1864,7 @@ Loc : constant Source_Ptr := Sloc (N); Subt : constant Node_Id := Subtype_Indication (N); - Bas : Entity_Id; + Bas : Entity_Id := Empty; -- initialize to prevent warning Typ : Entity_Id; -- Start of processing for Analyze_Iterator_Specification Index: inline.adb =================================================================== --- inline.adb (revision 247338) +++ inline.adb (working copy) @@ -2301,7 +2301,7 @@ -- this is the left-hand side of the assignment, else it is a temporary -- to which the return value is assigned prior to rewriting the call. - Targ1 : Node_Id; + Targ1 : Node_Id := Empty; -- A separate target used when the return type is unconstrained Temp : Entity_Id; Index: sem_ch9.adb =================================================================== --- sem_ch9.adb (revision 247338) +++ sem_ch9.adb (working copy) @@ -127,7 +127,7 @@ (N : Node_Id; Lock_Free_Given : Boolean := False) return Boolean is - Errors_Count : Nat; + Errors_Count : Nat := 0; -- Errors_Count is a count of errors detected by the compiler so far -- when Lock_Free_Given is True. @@ -257,7 +257,7 @@ Comp : Entity_Id := Empty; -- Track the current component which the body references - Errors_Count : Nat; + Errors_Count : Nat := 0; -- Errors_Count is a count of errors detected by the compiler -- so far when Lock_Free_Given is True. @@ -772,7 +772,7 @@ Entry_Nam : Entity_Id; E : Entity_Id; Kind : Entity_Kind; - Task_Nam : Entity_Id; + Task_Nam : Entity_Id := Empty; -- initialize to prevent warning begin Tasking_Used := True; Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 247338) +++ sem_ch12.adb (working copy) @@ -13620,7 +13620,7 @@ Cur : Entity_Id := Empty; -- Current homograph of the instance name - Vis : Boolean; + Vis : Boolean := False; -- Saved visibility status of the current homograph begin Index: sem_case.adb =================================================================== --- sem_case.adb (revision 247293) +++ sem_case.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-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- -- @@ -459,6 +459,7 @@ Choice_Hi : Uint; Choice_Lo : Uint; Prev_Choice : Node_Id; + pragma Warnings (Off, Prev_Choice); Prev_Hi : Uint; begin Index: sem_ch4.adb =================================================================== --- sem_ch4.adb (revision 247381) +++ sem_ch4.adb (working copy) @@ -340,6 +340,7 @@ procedure List_Operand_Interps (Opnd : Node_Id) is Nam : Node_Id; + pragma Warnings (Off, Nam); Err : Node_Id := N; begin Index: par-ch3.adb =================================================================== --- par-ch3.adb (revision 247333) +++ par-ch3.adb (working copy) @@ -3494,7 +3494,7 @@ procedure P_Component_Items (Decls : List_Id) is Aliased_Present : Boolean := False; CompDef_Node : Node_Id; - Decl_Node : Node_Id; + Decl_Node : Node_Id := Empty; -- initialize to prevent warning Scan_State : Saved_Scan_State; Not_Null_Present : Boolean := False; Num_Idents : Nat; @@ -3754,7 +3754,7 @@ function P_Discrete_Choice_List return List_Id is Choices : List_Id; - Expr_Node : Node_Id; + Expr_Node : Node_Id := Empty; -- initialize to prevent warning Choice_Node : Node_Id; begin