[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc
Subject: Re: infrastructure to detect whether code originates from macro expansion
From: Dodji Seketeli <dodji () seketeli ! org>
Date: 2013-11-29 15:46:22
Message-ID: 87zjonky7l.fsf () seketeli ! org
[Download RAW message or body]
Hello Robert,
Robert Schiele <rschiele@gmail.com> a écrit:
> in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48778 Manuel
> López-Ibáñez mentioned that starting with gcc 4.7 there is supposed to
> be infrastructure to figure out for diagnostics whether the location
> of an error was created by macro expansion and that this can be used
> to disable a warning in that case.
Indeed.
> Can anyone point me to the name of a function/macro I should use to
> check that or another example in the code that already does this?
I think you want to use the function
linemap_location_from_macro_expansion_p() from libcpp/line-map.c. The
pointer to struct line_maps set you pass is usually the global variable named
'line_table'.
> I mean I can see how maybe_unwind_expanded_macro_loc figures out
> whether it needs to unwind macro expansions but I am not sure whether
> this linemap_lookup/linemap_macro_expansion_map_p stuff is what I am
> supposed to use in the place where I check for the diagnostics to emit
> or whether there is a higher level abstraction of this functionality.
You are right, linemap_macro_expansion_map_p is a tad lower level than
what you want.
I hope this helps.
Cheers.
--
Dodji
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic