From patchwork Wed Jan 7 10:12:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 425982 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 6705D14009B for ; Wed, 7 Jan 2015 21:12:57 +1100 (AEDT) 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=u6uISFaL+jeMgGJV6VPhwJxKt5ZWHynWdBFFWeVBNNSZZtNe7h twnlW2t+cfqICAYHFzGfZCfYJsew8tNza4ZITOqFlOoJmzBtj6wc7k9NlOFECFyl 8SKQrNgXsCZrahM31f76Dpgcot03x2ey7xIGdCV2Mw9CtysadngF+lp1U= 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=P6U57DNnSbCgKuNcJTv8OlGjUsg=; b=Ncaty0mjsGCFQaDrQIl7 oiSA5iSDN7fkTIORgVirQJvQYYc+v5mA/tESBTl628u1w1gcF2+tyPFaH7KfPIAH 8MNaa/KZgN8r0uVmLjepQtxu8lNK9a3sbZKbC/UmZYy9T7KWUjT6wp+AXRy8OSM1 Mk/jrmxqQnY6Gi3fthNXQLQ= Received: (qmail 27086 invoked by alias); 7 Jan 2015 10:12:49 -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 27065 invoked by uid 89); 7 Jan 2015 10:12:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 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 (AES256-SHA encrypted) ESMTPS; Wed, 07 Jan 2015 10:12:45 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8746F11653B; Wed, 7 Jan 2015 05:12:43 -0500 (EST) 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 FiOxxrW65w9z; Wed, 7 Jan 2015 05:12:43 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 6358B116521; Wed, 7 Jan 2015 05:12:43 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 5F55E91A7D; Wed, 7 Jan 2015 05:12:43 -0500 (EST) Date: Wed, 7 Jan 2015 05:12:43 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Avoid incorrect warning on limited with that item is unreferenced Message-ID: <20150107101243.GA14133@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Under certain complex circumstances, a LIMITED WITH clause can result in an incorrect warning that the with'ed item is not referenced, when in fact it is referenced. No simple test is available. Tested on x86_64-pc-linux-gnu, committed on trunk 2015-01-07 Robert Dewar * sem_warn.adb (Check_One_Unit): Guard against context item with no Entity field. Index: sem_warn.adb =================================================================== --- sem_warn.adb (revision 219191) +++ sem_warn.adb (working copy) @@ -2350,6 +2350,13 @@ if Nkind (Item) = N_With_Clause and then not Implicit_With (Item) and then In_Extended_Main_Source_Unit (Item) + + -- Guard for no entity present. Not clear under what conditions + -- this happens, but it does occur, and since this is only a + -- warning, we just suppress the warning in this case. + + and then Nkind (Name (Item)) in N_Has_Entity + and then Present (Entity (Name (Item))) then Lunit := Entity (Name (Item));