From patchwork Tue Jan 29 14:01:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 216542 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 948382C0090 for ; Wed, 30 Jan 2013 01:02:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360072929; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=hqKGpghj+z+LDbn1BoWK XJ3sBs4=; b=HjGuD9w5vugNILBgyi+F/NCPhorruUPvzZQqGc7ZQRwRVO5mrEGE stFVyK4JdqCKu04MBLeSZ8ueCRkJu4iQBeX+B3Ds4RcJ0P2EHYqww2ZqlyJLj+nZ w7pM9zaC/yvu0CBd7CzvswlylTnuBFnflbx7btT3w0T0WlJsxB+ArEg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=j9cnIHseq2mN/x+R+/ACVy5rt3o5C+Ru/y27w56dFdVSuefgQ1YQMlw7kTdnbt cuGV9DGBYKFYY/cEGZC0R/Ru3+/TqPR3xfWWp//Vx3oZcZLZ1Vv7FiEWvFVtoFjY gvoDVRD8viTAb/i6XT2gkYPzyek2VIcu+3z7/GIaNz7pg=; Received: (qmail 2097 invoked by alias); 29 Jan 2013 14:01:50 -0000 Received: (qmail 2083 invoked by uid 22791); 29 Jan 2013 14:01:47 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL, BAYES_50, KHOP_SPAMHAUS_DROP, RCVD_IN_HOSTKARMA_NO, TW_TW X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 29 Jan 2013 14:01:40 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 61B042E716; Tue, 29 Jan 2013 09:01:39 -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 BoRqdlf7aIAj; Tue, 29 Jan 2013 09:01:39 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 3944A2E2AB; Tue, 29 Jan 2013 09:01:39 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 3935D919E3; Tue, 29 Jan 2013 09:01:39 -0500 (EST) Date: Tue, 29 Jan 2013 09:01:39 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Obsolescence considerations for pragma Interface/Interface_Name Message-ID: <20130129140139.GA21465@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 Interface is now flagged as violating restriction No_Obsolescent_Features even in Ada 95 mode. Both Interface and Interface_Name cause warnings to be issued with -gnatwj (but we don't consider that Interface_Name violates the restriction, since Interface_Name is a GNAT defined pragma that is not in the RM, and in particular not in Annex J). The following is compiled with -gnatwj 1. pragma Restrictions (No_Obsolescent_Features); 2. package ObsInter is 3. procedure q; 4. pragma Interface (C, q); 1 3 >>> warning: pragma Interface is an obsolescent feature >>> warning: use pragma Import instead >>> violation of restriction "no_obsolescent_features" at line 1 5. pragma Interface_Name (q, "qroutine"); | >>> warning: pragma Interface_Name is an obsolescent feature >>> warning: use pragma Import instead 6. end; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-29 Robert Dewar * sem_prag.adb (Analyze_Pragma, case Interface): Consider to be a violation of No_Obsolescent_Features even in Ada 95. Also generates a warning in -gnatwj mode. (Analyze_Pragma, case Interface_Name): Generates a warning in -gnatwj mode. * gnat_ugn.texi: Additional documentation on -gnatwj and pragma Interface[_Name]. Index: gnat_ugn.texi =================================================================== --- gnat_ugn.texi (revision 195533) +++ gnat_ugn.texi (working copy) @@ -5523,7 +5523,9 @@ GNAT features that have been provided in past versions but which have been superseded (typically by features in the new Ada standard). For example, @code{pragma Ravenscar} will be flagged since its -function is replaced by @code{pragma Profile(Ravenscar)}. +function is replaced by @code{pragma Profile(Ravenscar)}, and +@code{pragma Interface_Name} will be flagged since its function +is replaced by @code{pragma Import}. Note that this warning option functions differently from the restriction @code{No_Obsolescent_Features} in two respects. Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 195533) +++ sem_prag.adb (working copy) @@ -11095,11 +11095,19 @@ Process_Import_Or_Interface; -- In Ada 2005, the permission to use Interface (a reserved word) - -- as a pragma name is considered an obsolescent feature. + -- as a pragma name is considered an obsolescent feature, and this + -- pragma was already obsolescent in Ada 95. - if Ada_Version >= Ada_2005 then + if Ada_Version >= Ada_95 then Check_Restriction (No_Obsolescent_Features, Pragma_Identifier (N)); + + if Warn_On_Obsolescent_Feature then + Error_Msg_N + ("pragma Interface is an obsolescent feature?j?", N); + Error_Msg_N + ("|use pragma Import instead?j?", N); + end if; end if; -------------------- @@ -11126,6 +11134,19 @@ Id := Get_Pragma_Arg (Arg1); Analyze (Id); + -- This is obsolete from Ada 95 on, but it is an implementation + -- defined pragma, so we do not consider that it violates the + -- restriction (No_Obsolescent_Features). + + if Ada_Version >= Ada_95 then + if Warn_On_Obsolescent_Feature then + Error_Msg_N + ("pragma Interface_Name is an obsolescent feature?j?", N); + Error_Msg_N + ("|use pragma Import instead?j?", N); + end if; + end if; + if not Is_Entity_Name (Id) then Error_Pragma_Arg ("first argument for pragma% must be entity name", Arg1);