diagnostic.c cleanup, 2 of 3

Zack Weinberg zack@codesourcery.com
Mon May 12 06:50:00 GMT 2003


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> Zack Weinberg <zack@codesourcery.com> writes:
> | The minimal change I needed was in the patch you're responding to: I
> | needed diagnostic_set_info (&d, ..., DK_ICE); report_diagnostic (&d);
> | to print the bug-report request and terminate compilation.  I thought
> | it would be a good idea to clean up other inconsistencies in
> | diagnostic.c while I was at it, hence the somewhat larger patch.
>
> I now understand where you're going.  I don't know if that is something
> you were considering, but it would be practical if we don't pass
> location information separately as file and line as arguments to
> diagnostic_set_info.

This may happen as part of Nathan Sidwell's work on location_t use.
I don't have any plans to do it myself.

> Agreed.  At some point, I will split the output_buffer logic from
> diagnostic.c so that the logic can be used by other parts of the
> compiler.  Also, one would need to get rid of tree specific thingies
> in diagnostic.c (which partly is why I would like to get rid of
> xxx_with_decl).  You will need that non dependency if you want to link
> cpplib against diagnostic.c and also make it standalone.

My plan is to interpose a callback hook, located in c-lex.c, between
the two; cpplib will not call diagnostic.c routines directly.

What do you think of creating a header "diag-severity.h" or similar
which declares _just_ the diagnostic_t type?  It would still make
reference to diagnostic.def.  Then, if and when I get around to giving
cpplib its own directory, that header and diagnostic.def can move to
include/ with minimal impact on the rest of the compiler.

zw



More information about the Gcc-patches mailing list