This is the mail archive of the gcc-patches@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: [PATCH 3/6] Emit macro expansion related diagnostics


On Tue, Dec 14, 2010 at 2:22 AM, Dodji Seketeli <dodji@redhat.com> wrote:

>> However, models to look for are print_candidates(),
>> cxx_print_error_function, the newly introduced
>> qualified_name_lookup_errorr, etc.
>
> I see. Though, some of these functions call below the level error and
> inform by calling pp_base_set_prefix, pp_verbatim and the like. Are
> those pp_* calls intended as well?

Yes, that is another dimension to the diagnostic machinery.
The idea here is that every client (i.e. front-end) may have som
front-end specific actions to take (e.g. printing template instantiation
contexts) before the core diagnostic message is printed.  That
is the role of `diagnostic starter' functions (see the comments
in diagnostic.h).  Similarly we have `diagnostic finalizer' functions
which are supposed to do any sort of `cleanup' after a diagnostic
is printed.

Now, you can consider CPP as a sort of front-end that turns
raw input file into a stream of tokens which is then handed over
to the C or C++ parsers -- but I'm not sure that is the way it currently
works.

So, another option is to find a combination of these two dimensions.

>
>>
>> The point here is that I would expect CPP to define its own error print
>> diagnostic function that tracks macro expansion context
>> (at bit like what what we do with template instantiation contexts)
>> and combine calls to error_at() and inform().
>
> Okay, so I guess I will move the macro expansion unwinder into CPP and
> make it and use the CPP diagnostic routines that in turn use c_cpp_error
> (via the cpp_reader callbacks) that is at the same level as inform()
> error() etc.

It is my belief that the macro-expansion related diagnostics specific
improvements belong there.

>
> I will still have to make default_diagnostic_finalizer call that
> unwinder to make macro expansion context be printed implicitely, though.

something you can't do with CPP specific diagnostic finalizer?

-- Gaby


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