From patchwork Fri Apr 28 13:38:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 756407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wDvzB73nvz9s89 for ; Fri, 28 Apr 2017 23:38:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jVyUGd68"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=F1ciPhclNUiLMAlaDMFzcCnYYKVEIesZPIKvquY39YS07ZzUuJ aw6nrJpNPM+WjWt2+TOwHNYwh6gj2iUgB79HYYKaUSU+wvaMdYADyVZRckdnARF6 +K5Ql1MqCvM+uKNWJ9o6NgaVy90wD9IVsULF1mccTgqNEmxfcBtZS8DEo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=wYYRpLadO6AWX16pHkby6iFt9jc=; b=jVyUGd689v1sOEmcXspj F0vRzgjbppLP4Mdv0VJZCNjp1QQj7oOAmImDsbUocaQIzsfUfWeF/qai0kL2VYjm h2rv7YhZ9FREKec4reJVScmOrVmCLb3kUiAGWOtpApvHWGfRaoGo43rsgF8SYNvL 7lGr26yz8WRboxcNKmuoVHw= Received: (qmail 89831 invoked by alias); 28 Apr 2017 13:38:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 89438 invoked by uid 89); 28 Apr 2017 13:38:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Comp X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Apr 2017 13:38:04 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 87DFA7AB2; Fri, 28 Apr 2017 09:38:05 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cewPo1f+RAVw; Fri, 28 Apr 2017 09:38:05 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 75B6128F42; Fri, 28 Apr 2017 09:38:05 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4192) id 747EA3B2; Fri, 28 Apr 2017 09:38:05 -0400 (EDT) Date: Fri, 28 Apr 2017 09:38:05 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Fix remaining warnings in compiler bootstrap #2 Message-ID: <20170428133805.GA40057@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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 * 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