From patchwork Thu Nov 12 13:25:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 543338 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 D48FE1413F2 for ; Fri, 13 Nov 2015 00:26:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=NjcDBYIp; 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=qZrNarfwECujA4ZNLv31LkWxOPSOiIdol3VMiHW0I1BGBx5tq1 L4/k7kxPdgrP0LNmTMa/3BAoi3XaYWpKYXNEGsA3bNwCwSEjhkN7qqTxYgks3di7 IuFraw41+zsb8DKpulVIlmzWpjPIpi8e3Sa+6fr8cKmuIsMXHeUnw80f8= 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=dfAH92LXaGG8h1lfTQ8hZvQXGSA=; b=NjcDBYIpfWx8CnGQ5i0V mVJaDAKzqv+hf49q9lWXRW7yK3q5Vk89bsStLN33i1G5MnBljhvp9Vv/SKCvGiK6 3Ujnf/LbEmFRrDaUZ5J1emdNL1Sj5oBVWh9vTmUynRxzawKHAPOHRHoneQpjwSAi /3IH4R8fFYPL4vQijvZjbLk= Received: (qmail 92644 invoked by alias); 12 Nov 2015 13:25:59 -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 92028 invoked by uid 89); 12 Nov 2015 13:25:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no 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; Thu, 12 Nov 2015 13:25:57 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8F57D2995E; Thu, 12 Nov 2015 08:25:55 -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 yvMmZhTkUerL; Thu, 12 Nov 2015 08:25:55 -0500 (EST) 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 7FAE729959; Thu, 12 Nov 2015 08:25:55 -0500 (EST) Received: by tron.gnat.com (Postfix, from userid 4192) id 7E6061A5; Thu, 12 Nov 2015 08:25:55 -0500 (EST) Date: Thu, 12 Nov 2015 08:25:55 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [Ada] Library-level error on aspects Message-ID: <20151112132555.GA63376@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) This patch fixes a bug where GNAT fails to detect an error on an aspect that must be applied to a library-level entity. The following test must give an error: tls.adb:2:26: entity for aspect "Thread_Local_Storage" must be library level entity procedure Tls is V : Natural := 0 with Thread_Local_Storage; begin null; end Tls; Tested on x86_64-pc-linux-gnu, committed on trunk 2015-11-12 Bob Duff * sem_prag.adb (Check_Arg_Is_Library_Level_Local_Name): A pragma that comes from an aspect does not "come from source", so we need to test whether it comes from an aspect. Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 230242) +++ sem_prag.adb (working copy) @@ -4328,8 +4328,12 @@ begin Check_Arg_Is_Local_Name (Arg); + -- If it came from an aspect, we want to give the error just as if it + -- came from source. + if not Is_Library_Level_Entity (Entity (Get_Pragma_Arg (Arg))) - and then Comes_From_Source (N) + and then (Comes_From_Source (N) + or else Present (Corresponding_Aspect (Parent (Arg)))) then Error_Pragma_Arg ("argument for pragma% must be library level entity", Arg);