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] [PR13086] Clarification of diagnostic on delete of an incomplete type (regression on 3.3/trunk)


"Giovanni Bajo" <giovannibajo@libero.it> writes:

| > Also scratch the "possible problem detected..." bits.
| 
| There is an issue here. If I scratch that, the first warning you see is
| reported on the line containing the declaration of the variable, so it's not
| clear anymore that this is related to the pointer deletion:
| 
| incomplete1.C:14: warning: `a' has incomplete type
| incomplete1.C:12: warning: forward declaration of `struct A'
| incomplete1.C:19: note: the generated code will not work.
                                             ^^^^

s/will/might/

| If you get a diagnostic like this, you seem to have two different problems,
| note only one. The first line was used exactly to point immediatly the
| attention to line 19 (and it ended with a semicolon, as in: explanation
| follows).

Then amend cxx_incomplete_type_diagnostic not to use xxx_at.  Also,
change its third parameter type to diagnostic_t and use DK_ERROR or
DK_WARNING.  Note that the comment aveno
cxx_incomplete_type_diagnostic says VALUE is an *expression*, so I
suggest you make the code match what is says:

  if (value)
    msg ("pointer-value '%E' points to an object of incomplete type",
         value);

| > I suggest you change
| >
| >   incomplete1.C:14: warning: `a' has incomplete type
| >
| > to
| >
| >   incomplete1.C:14: warning: pointer 'a' points to an object of
| >      incomplete type
| >
| > The object/pointer 'a' has a *complete* type -- a pointer to data
| > always has a complete type.
| 
| This text is emitted by cxx_incomplete_type_diagnostic.

Yes, I know.  I think that is where you want to make this diagnostic
less obscure.

Thanks,

-- Gaby


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