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: [C PATCH] Clamp down "incomplete type" error (PR c/63543)


On Wed, Oct 15, 2014 at 03:48:20PM -0600, Jeff Law wrote:
> On 10/15/14 15:46, Joseph S. Myers wrote:
> >On Wed, 15 Oct 2014, Marek Polacek wrote:
> >
> >>We've got a complaint that the "dereferencing pointer to incomplete
> >>type" error is printed for all occurrences of the incomplete type,
> >>which is too verbose.  Also it'd be nicer to print the type as well.
> >>This patch fixes this; if we find an incomplete type, mark it with error
> >>node, then we don't print the error message more than once.
> >
> >I don't like this approach of modifying the type; type nodes are shared
> >objects and this could affect all sorts of other logic subsequently
> >working with the type.  I think there should be some sort of annotation of
> >the type (either in the type itself, or on the side) that *only* means an
> >error has been given for the type being incomplete, rather than inserting
> >error_mark_node into the type.
> Isn't slamming error_mark_node well established at this point?  I fact I
> recall seeing it documented to be used in this kind of way to prevent future
> errors.

I think in this case it is way too risky to put error_mark_node there,
it will affect also all the places where the object with that type isn't
dereferenced.
If there are spare bits on the type, either using one for this error, or
to represent some error has been diagnosed for the particular type and
hash table lookup could be used to look up which exactly, or just hash table
without any bit...

	Jakub


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