From patchwork Fri Jun 18 08:18:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56148 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]) by ozlabs.org (Postfix) with SMTP id 07EFB1007D2 for ; Fri, 18 Jun 2010 18:18:41 +1000 (EST) Received: (qmail 4075 invoked by alias); 18 Jun 2010 08:18:36 -0000 Received: (qmail 4056 invoked by uid 22791); 18 Jun 2010 08:18:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Jun 2010 08:18:30 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 80B94CB01E2; Fri, 18 Jun 2010 10:18:37 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sw5Od75pVdqp; Fri, 18 Jun 2010 10:18:37 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 6CC24CB01F8; Fri, 18 Jun 2010 10:18:37 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 82343D9B31; Fri, 18 Jun 2010 10:18:47 +0200 (CEST) Date: Fri, 18 Jun 2010 10:18:47 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Fix bad warning message for Unreferenced Message-ID: <20100618081847.GA11416@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 This patch fixes an incorrect warning suggesting use of Unreferenced instead of Warnings (Off), when in fact Unreferenced was incorrect. For the following m.adb should compile clean with no warnings: generic package D is type Handle_Type is private; function Create_Handle return Handle_Type; private type Handle_Type is record Initialised : Boolean; end record; end D; with D; generic with package My_D is new D; with procedure Method (Client : in out My_D.Handle_Type); package M is private procedure Call_Method; end M; package body D is function Create_Handle return Handle_Type is begin return (Initialised => False); end Create_Handle; end D; package body M is procedure Call_Method is Handle : My_D.Handle_Type := My_D.Create_Handle; pragma Warnings (Off, Handle); begin Method(Client => Handle); end Call_Method; end M; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-18 Robert Dewar * lib-xref.adb (Generate_Reference): Fix bad reference to Has_Pragma_Unreferenced (clients should always use Has_Unreferenced). Index: lib-xref.adb =================================================================== --- lib-xref.adb (revision 160959) +++ lib-xref.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2010, 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- -- @@ -666,7 +666,7 @@ package body Lib.Xref is -- Check for pragma Unreferenced given and reference is within -- this source unit (occasion for possible warning to be issued). - if Has_Pragma_Unreferenced (E) + if Has_Unreferenced (E) and then In_Same_Extended_Unit (E, N) then -- A reference as a named parameter in a call does not count