This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 0/7] Tracking locations of tokens resulting from macro expansion
- From: Dodji Seketeli <dodji at redhat dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches at gcc dot gnu dot org, tromey at redhat dot com, gdr at integrable-solutions dot net, joseph at codesourcery dot com, charlet at act-europe dot fr, bonzini at gnu dot org, jason at redhat dot com
- Date: Sat, 16 Jul 2011 19:05:18 +0200
- Subject: Re: [PATCH 0/7] Tracking locations of tokens resulting from macro expansion
- References: <1291979498-1604-1-git-send-email-dodji@redhat.com> <cover.1310812267.git.dodji@redhat.com> <4E21AF83.80101@net-b.de>
Tobias Burnus <burnus@net-b.de> a Ãcrit:
> Dodji Seketeli wrote:
>> Support -fdebug-cpp option
>
> Regarding Fortran: I think having a full support for the macro
> expansion would be quite a lot of work,
I know nothing about Fortran, but I would hope that adding support for
this feature to it should not be hard. Here is what happens basically,
when -ftrack-macro-expansion is on:
1/ locations that are instance of source_location are now virtual
locations. They encode locations of tokens across macro expansion.
2/ the code that unwinds and prints the "stack" of macro expansion is
the function maybe_unwind_expanded_macro_loc, and is called by the
diagnostic finalizer, which passes it the (now virtual) location of the
diagnostic.
Each front ends provide its own diagnostic finalizer. By default (in
general_init) I have set this diagnostic finalizer to
virt_loc_aware_diagnostic_finalizer which calls
maybe_unwind_expanded_macro_loc. This is done in the patch "[PATCH 3/7]
Emit macro expansion related diagnostics".
If Fortran provides its own different diagnostic finalizer, it can call
maybe_unwind_expanded_macro_loc in there. I believe this should be
enough.
> but I think -fdebug-cpp comes for free as it is handled by libcpp.
> Thus, how about adding support for that flag also to Fortran?
Except that I know zilsh about Fortran and it would take me some time,
at least for testing. But yes, I think it would be good to have it for
Fortran. I'll put that on my TODO list, unless someone beats me to it.
--
Dodji