From patchwork Tue Jun 22 12:34:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56471 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 814E0B6F18 for ; Tue, 22 Jun 2010 22:34:32 +1000 (EST) Received: (qmail 31967 invoked by alias); 22 Jun 2010 12:34:28 -0000 Received: (qmail 31920 invoked by uid 22791); 22 Jun 2010 12:34:25 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_YY, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jun 2010 12:34:19 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5C1F7CB026D; Tue, 22 Jun 2010 14:34:20 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SazoTQibgAUa; Tue, 22 Jun 2010 14:34:20 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 492B9CB024F; Tue, 22 Jun 2010 14:34:20 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 40216D9B31; Tue, 22 Jun 2010 14:34:20 +0200 (CEST) Date: Tue, 22 Jun 2010 14:34:20 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Fix casing of identifiers in error messages Message-ID: <20100622123420.GA23054@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 There are many cases in which we could give the casing from the actual source program in an error message and instead we give default casing, this is due to a one-token error in errout. Here is an example (compiled with -gnatj60) > Compiling: bad_casing.adb > > 1. package body Bad_Casing is > 2. procedure yy_Traverse_BU( yyt: access yy0_Environ ) is > 3. begin > 4. if (yyt = No_Ident_Table) then return; end if; > | > >>> invalid operand types for operator "=", left > operand has type access to "yy0_Environ" > defined at bad_casing.ads:7, right operand has > type "Ident_Table" defined at bad_casing.ads:3 > > 5. end yy_Traverse_BU; > 6. end Bad_Casing; > > Compiling: bad_casing.ads > > 1. package Bad_Casing is > 2. type yyt_Node is abstract tagged null record; > 3. type Ident_Table is access all yyt_Node'Class; > 4. procedure yy_Traverse_BU ( yyt: access yyt_Node ) is abstract; > 5. No_Ident_Table: constant Ident_Table := null; > 6. type yy0_Environ is new yyt_Node with null record; > 7. procedure yy_Traverse_BU (yyt:access yy0_Environ ); > 8. end Bad_Casing; Prior to this patch we had Yy0_Environ rather than yy0_Environ in the error message, we prefer the latter since it is the way the programmer spelled it in the source. Yy0_Environ Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-22 Robert Dewar * errout.adb (Set_Msg_Node): Fix incorrect reference to node. Index: errout.adb =================================================================== --- errout.adb (revision 161169) +++ errout.adb (working copy) @@ -2499,7 +2499,7 @@ package body Errout is -- in case, which is the case when we can copy from the source. declare - Src_Loc : constant Source_Ptr := Sloc (Error_Msg_Node_1); + Src_Loc : constant Source_Ptr := Sloc (Node); Sbuffer : Source_Buffer_Ptr; Ref_Ptr : Integer; Src_Ptr : Source_Ptr;