Tobias Burnus <bur...@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