This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c++/24985 caret diagnostics for macro expansions
- From: Dodji Seketeli <dodji at redhat dot com>
- To: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 04 May 2012 10:02:18 +0200
- Subject: Re: PR c++/24985 caret diagnostics for macro expansions
- References: <CAESRpQBpOiwbKR1Yca1VuHNuc-5RQc71Op7pENtga0Cu2AtEZg@mail.gmail.com>
Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> writes:
> This patch enables caret diagnostics for macro expansions. So now we will get:
>
> /home/manuel/macro-clang.c:2:91: error: invalid operands to binary <
> (have âstruct mystructâ and âfloatâ)
> #define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A);
> __typeof__(B) __b = (B); __a < __b ? __b : __a; })
>
> ^
> /home/manuel/macro-clang.c:2:91: note: in expansion of macro 'MYMAX'
> #define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A);
> __typeof__(B) __b = (B); __a < __b ? __b : __a; })
>
> ^
> /home/manuel/macro-clang.c:9:3: note: expanded from here
> MYMAX(p, f);
> ^
>
> In my opinion, the macro unwinder is too verbose. I think the output
> should be just:
>
> 2.91: error: invalid...
> #define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A);
> __typeof__(B) __b = (B); __a < __b ? __b : __a; })
>
> ^
> 9.3: note: in expansion of macro 'MYMAX'
> MYMAX(p, f);
> ^
Yes, I think that would be cool. I wanted to look into that once I am
done with what I am doing, unless someone beats me to it, of course.
:-)
--
Dodji