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] |
On Fri, 30 Apr 2010, Shujing Zhao wrote:I agree with to warn the serious problems firstly.
Ifyou also want to warn - not pedwarn, and so under -Wextra only - for ordered comparisons with a pointer-type null pointer constant, I think you should do so inside the case where comp_target_types has passed.If warn ordered comparison of pinter with null pointer, I think besides the void pointer with null pointer, the other pointer with null pointer need be warned too.
I can't make sense of what you are saying here, but this patch is also wrong. By turning the
if (comp_target_types (location, type0, type1))
into an "else if", you are losing both the errors and pedwarns if comp_target_types fails (for comparisons of distinct types) and those if it succeeds (for comparison of pointers to complete and incomplete, or of pointers to functions). That is, your patch would cause cases that violate constraints not to get the required errors with -pedantic-errors.
As I said, put this *inside* the above conditional. If something is more seriously wrong - if the types don't match and so ISO C requires a diagnostic - there is no need to try to give this additional optional diagnostic; the user will need to fix the serious problems in their program first before dealing with -Wextra issues. Either make this new check independent of the checks inside that conditional (complete and incomplete, function pointers), or only give the new warning if neither of the previous pedwarn conditions passed.
void *p; if ( p > (void *)0)
extern void p() if ( p > (void *)0)
Thanks Pearly
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |