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]

Wordered-pointer-comparison (PR7651 Define -Wextra strictly in terms of other warning flags)


:ADDPATCH c:

This patch continues the effort to fix PR7651 [1].

A new option -Wordered-pointer-comparison takes over the pedantic
warning for a pointer  compared against integer zero with <, <=, >, or
=. The new
option is enabled by -Wextra and by -pedantic, so we keep the current
behaviour but add the ability to enable/disable this individual
warning. The patch also fixes the issue that -Wextra would warn for p
< 0 but not for 0 > p.

Suggestions for an apter name are always welcome.

Bootstrapped and regression tested with --enable-languages=all on
i686-pc-linux-gnu.

OK for mainline?

[1] http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01103.html

2007-01-07 Manuel Lopez-Ibanez <manu@gcc.gnu.org>

 PR middle-end/7651
 * c.opt (Wordered-pointer-comparison): New.
 * doc/invoke.texi (Wordered-pointer-comparison): Document it.
 (Wextra): Enabled by -Wextra.
 (C-only Warning Options): Add it.
 * c-opts.c (c_common_handle_option): Enabled by -pedantic.
 (c_common_post_options): Enabled by -Wextra.
 * c-typeck.c (build_binary_op): Replace pedantic and extra_warnings
by warn_ordered_pointer_comparison.

testsuite/
2007-01-07  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

 PR middle-end/7651
 * gcc.dg/Wordered-pointer-comparison.c: New.
 * gcc.dg/Wordered-pointer-comparison-Wextra.c: New.
 * gcc.dg/Wordered-pointer-comparison-pedantic.c: New.
 * gcc.dg/Wordered-pointer-comparison-no.c: New.

Attachment: wordered-pointer-comparison.diff
Description: Text document


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