This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR c++/24985 caret diagnostics for macro expansions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]