This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C macro expansion tracking
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 14 May 2014 17:33:15 +0200
- Subject: Re: C macro expansion tracking
- Authentication-results: sourceware.org; auth=none
- References: <537384DF dot 4030702 at redhat dot com>
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.