From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6642 invoked by alias); 14 Dec 2010 07:19:17 -0000 Received: (qmail 6630 invoked by uid 22791); 14 Dec 2010 07:19:16 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from seketeli.net (HELO ms.seketeli.net) (91.121.166.71) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Dec 2010 07:19:09 +0000 Received: from adjoa.torimasen.com (torimasen.com [82.237.12.13]) by ms.seketeli.net (Postfix) with ESMTP id 38AE91608038; Tue, 14 Dec 2010 08:19:07 +0100 (CET) Received: from adjoa.seketeli.net (localhost.localdomain [127.0.0.1]) by adjoa.torimasen.com (Postfix) with ESMTP id B84BF8E6015; Tue, 14 Dec 2010 08:19:05 +0100 (CET) From: Dodji Seketeli To: Paolo Bonzini Cc: gcc-patches@gcc.gnu.org, tromey@redhat.com, joseph@codesourcery.com, gdr@integrable-solutions.net, lopezibanez@gmail.com Subject: Re: [PATCH 3/6] Emit macro expansion related diagnostics References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <1291979498-1604-5-git-send-email-dodji@redhat.com> <4D063157.3050901@gnu.org> X-URL: http://www.redhat.com Date: Tue, 14 Dec 2010 07:28:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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/msg01063.txt.bz2 Paolo Bonzini writes: > > test.c:5:14: error: invalid operands to binary<< (have =E2=80=98double= =E2=80=99 and =E2=80=98int=E2=80=99) > test.c:2:9: note: while expanding macro 'OPERATE' > test.c:5:14: note: while expanding macro 'SHIFTL' > test.c:8:3: note: while expanding macro 'MULT' > test.c:13:3: note: expanded from here > In the absence of caret diagnostic I think it is useful to explicitely make the difference between a location in the definition of the macro, and the location of the macro expansion point, i.e: In this error message: test.c: In function =E2=80=98g=E2=80=99: test.c:5:14: error: invalid operands to binary << (have =E2=80=98double=E2= =80=99 and =E2=80=98int=E2=80=99) In macro 'OPERATE' at test.c:2:9 Expanded at test.c:5:3 [...] Here is what we are trying to show: 1 #define OPERATE(OPRD1, OPRT, OPRD2) \ 2 OPRD1 OPRT OPRD2; ^ | ---< location in the /definition/ of OPERATE pointed to by: "In macro OPERATE at test.c:2:9" 3 4 #define SHIFTL(A,B) \ 5 OPERATE (A,<<,B) ^ | ---< location of /expansion point/ of OPERATE pointed to by "Expanded at test.c:5:3" [...] I think that's more explicit (and informative) than just saying: > test.c:5:14: error: invalid operands to binary<< (have =E2=80=98double= =E2=80=99 and =E2=80=98int=E2=80=99) > test.c:2:9: note: while expanding macro 'OPERATE' > test.c:5:14: note: while expanding macro 'SHIFTL' But when we have caret diagnostic where we actually show the user the code we are talking about we can use the "while expanding" just fine. --=20 Dodji