From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 13:25:00 -0000 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-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-11/txt/msg01513.txt.bz2 --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 603 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. --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=difs Content-length: 708 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); --n8g4imXOkfNTN/H1--