Manuel López-Ibáñez <lopeziba...@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

Reply via email to