This is the mail archive of the gcc-help@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: C macro expansion tracking


On 14 May 2014 16:59, Florian Weimer <fweimer@redhat.com> wrote:
> I'm somewhat confused how GCC decides when to print a macro expansion trace
> when a warning is generated.
[...]
> main.c: In function 'f':
> main.c:5:3: warning: suggest parentheses around assignment used as truth
> value [-Wparentheses]
>    Z(i = 1) return 1;
>    ^
[...]
> No macro expansion trace is shown in this case.

This seems to me like a bug. Is the location pointing to Z? If so, the
unwinder should unwind up to the  '(' token. You'll have to debug with
this isn't happening.

> But if I change "header.h" to mark the final macro as part of a system
> header, like this:

I think this is PR55252

> The lack of macro trace in the first case seems like a bug to me as well,
> but maybe not, so some suggestions how this feature is supposed to work
> would be appreciated.

How this is supposed to work is explained in the comment above
maybe_unwind_expanded_macro_loc.

However, there are a couple of open PRs in bugzilla about the
unwinder. See I) at https://gcc.gnu.org/wiki/Better_Diagnostics

Cheers,

Manuel.


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