From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8430 invoked by alias); 14 Dec 2010 07:24:43 -0000 Received: (qmail 8422 invoked by uid 22791); 14 Dec 2010 07:24:41 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Dec 2010 07:24:37 +0000 Received: by qwg5 with SMTP id 5so207644qwg.20 for ; Mon, 13 Dec 2010 23:24:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.189.145 with SMTP id de17mr4577503qcb.257.1292311474024; Mon, 13 Dec 2010 23:24:34 -0800 (PST) Received: by 10.229.75.70 with HTTP; Mon, 13 Dec 2010 23:24:33 -0800 (PST) In-Reply-To: References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <1291979498-1604-5-git-send-email-dodji@redhat.com> <4D063157.3050901@gnu.org> Date: Tue, 14 Dec 2010 07:28:00 -0000 Message-ID: Subject: Re: [PATCH 3/6] Emit macro expansion related diagnostics From: Gabriel Dos Reis To: Dodji Seketeli Cc: Paolo Bonzini , gcc-patches@gcc.gnu.org, tromey@redhat.com, joseph@codesourcery.com, lopezibanez@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2010-12/txt/msg01064.txt.bz2 On Tue, Dec 14, 2010 at 12:54 AM, Dodji Seketeli wrote: > The macro expansion context is unwound implicitly. That is, the client > code calls e.g: > > =A0 =A0error_at (some_location, "An error occured") > > and if some_location appears to be the location of a token resulting > from macro expansion the diagnostic machinery unwinds the expansion > context and displays it to the user, regardless of what the diagnostic > kind was. =A0So the context lines are not prefixed with " note:" as > the context is generated implicitely. =A0This is similar to what G++ does > when it displays template instantiation contexts. Let me add some background about this aspect of the diagnostic machinery. The functions inform(), error(), error_at(), etc. are offered as some `high-level' building blocks for constructing more advanced diagnostic functions. It is just that we have not been very disciplined at factorizing things correctly, and instead we tend to go for the easier road of `inlining' calls to error() or inform(). However, models to look for are print_candidates(), cxx_print_error_function, the newly introduced qualified_name_lookup_errorr, etc. The point here is that I would expect CPP to define its own error print diagnostic function that tracks macro expansion context (at bit like what what we do with template instantiation contexts) and combine calls to error_at() and inform(). Note also that we don't capitalize diagnostic messages (and they don't end with periods either.) -- Gaby