From patchwork Fri Sep 2 10:10:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 113095 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 67858B6F81 for ; Fri, 2 Sep 2011 20:11:01 +1000 (EST) Received: (qmail 22105 invoked by alias); 2 Sep 2011 10:11:00 -0000 Received: (qmail 22094 invoked by uid 22791); 2 Sep 2011 10:10:59 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 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; Fri, 02 Sep 2011 10:10:44 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 346832BB2A6; Fri, 2 Sep 2011 06:10:44 -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 WC+tv8ZOLEmo; Fri, 2 Sep 2011 06:10:44 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 202292BB2A5; Fri, 2 Sep 2011 06:10:44 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 1E5AC3FEE8; Fri, 2 Sep 2011 06:10:44 -0400 (EDT) Date: Fri, 2 Sep 2011 06:10:44 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Marc Sango Subject: [Ada] Improved message for the restriction use of unconstrained type in SPARK Message-ID: <20110902101044.GA8335@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 When the SPARK restriction mode was set, check that a declaration of unconstrained type is allowed only for constants of type string. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-02 Marc Sango * sem_ch3.adb (Analyze_Object_Declaration): Change comment and add additional check to differentiate constant of type string from others unconstrained type. Index: sem_ch3.adb =================================================================== --- sem_ch3.adb (revision 178461) +++ sem_ch3.adb (working copy) @@ -3320,13 +3320,12 @@ -- In SPARK, a declaration of unconstrained type is allowed -- only for constants of type string. - -- Why no check for Comes_From_Source here, seems wrong ??? - -- Where is check to differentiate string case ??? + if Nkind (E) = N_String_Literal then + Check_SPARK_Restriction + ("declaration of object of unconstrained type not allowed", + E); + end if; - Check_SPARK_Restriction - ("declaration of object of unconstrained type not allowed", - E); - -- Unconstrained variables not allowed in Ada 83 mode if Ada_Version = Ada_83