From patchwork Mon Oct 9 15:19:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 823300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463775-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="v3L308an"; dkim-atps=neutral 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 3y9kRy3FtMz9t5Q for ; Tue, 10 Oct 2017 02:19:26 +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=MLqALU/OQ1OH9xUJs0zQCIe3do6k8Tedb+UbEV2Huib214visn 8QmEes0CyXVSN1sMLU5zkqGIuv0AQQpDWhY/VhnoMA6nvaor31mJ0hI0i+xkRJi0 dxIHk2ZZV1INr2gwgp2ssDpm+oSVSVto3ssxFlobdTG/fJsvUG24e67II= 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=pjEhe8cf37lzh61uM0nhvgFWGj4=; b=v3L308anfWuYjNURlrlU 7eboSeZFhU5Yuf0H3BHeK69uji8meZmzStvNerpjfOeGW5VehCMTxWdgNrNSok9d TEkBa/HOGU+/vWfCyrRKsyG1B572WD9c0ESfH1TrHsIKk4fN28BEIn/u/EDq0n19 5RfOPydd9EtQJhtdVOptwSs= Received: (qmail 94154 invoked by alias); 9 Oct 2017 15:19:16 -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 93856 invoked by uid 89); 9 Oct 2017 15:19:16 -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=piotr, Piotr 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; Mon, 09 Oct 2017 15:19:10 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B6475562A3; Mon, 9 Oct 2017 11:19:08 -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 ZzaIricT3ms6; Mon, 9 Oct 2017 11:19:08 -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 A5F1856079; Mon, 9 Oct 2017 11:19:08 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id A4E3243A; Mon, 9 Oct 2017 11:19:08 -0400 (EDT) Date: Mon, 9 Oct 2017 11:19:08 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Detect protected types as program units Message-ID: <20171009151908.GA113750@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Routine Unit_Declaration_Node now recognizes protected types as program units and returns their declaration nodes; previously it returned declaration nodes of the enclosing program units. This was an oversight. ------------ -- Source -- ------------ -- illegal.ads package Illegal with SPARK_Mode is protected type PT with SPARK_Mode => Off is end PT; end Illegal; -- illegal.adb package body Illegal with SPARK_Mode is protected body PT with SPARK_Mode -- Error is end PT; end Illegal; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c illegal.adb illegal.adb:5:11: incorrect use of SPARK_Mode illegal.adb:5:11: value Off was set for SPARK_Mode on "PT" at illegal.ads:5 Tested on x86_64-pc-linux-gnu, committed on trunk 2017-10-09 Piotr Trojanek * sem_aux.adb (Unit_Declaration_Node): Detect protected declarations, just like other program units listed in Ada RM 10.1(1). Index: sem_aux.adb =================================================================== --- sem_aux.adb (revision 253546) +++ sem_aux.adb (working copy) @@ -1693,6 +1693,7 @@ and then Nkind (N) /= N_Package_Renaming_Declaration and then Nkind (N) /= N_Procedure_Instantiation and then Nkind (N) /= N_Protected_Body + and then Nkind (N) /= N_Protected_Type_Declaration and then Nkind (N) /= N_Subprogram_Declaration and then Nkind (N) /= N_Subprogram_Body and then Nkind (N) /= N_Subprogram_Body_Stub