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] | |
A new warning option Walways-true takes over from Wextra the function of warning about comparison of unsigned variables against zero with < or >=. To keep current behaviour, Walways-true is also enabled by Wextra.
Walways-true also includes an unnamed warning for comparisons that are always true because of type range limits. (This is the warning that RMS was talking about sometime ago).
PR 29694 and 23587 are about the inconsistency of having some warnings in Wextra and others issued unconditionally. Thus, this patch fixes those.
PR 11856 is about warning for templates. This patch is not a definitive fix, since Gabriel Dos Reis thinks that we should not warn at all, but it is a partial fix, since at least it gives to the user the option of disabling the warning (and it allows the use #pragma machinery), instead of using -w.
PR 12963 asks for a way to disable the unconditional warning without using -w. This patch fixes that.
I took testcases from the PRs, bootstrapped and regression tested with --enable-languages=all for i686-pc-linux-gnu.
PR middle-end/7651 PR c++/11856 PR c/12963 PR c/23587 PR other/29694 * c.opt (Walways-true): New. * doc/invoke.texi (Walways-true): Document it. (Wextra): Enabled by -Wextra. * c-opts.c (c_common_post_options): Enabled by -Wextra. * c-common.c (shorten_compare): Warn with Walways-true.
testsuite/ 2007-03-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651 PR c++/11856 PR c/12963 PR c/23587 PR other/29694 * gcc.dg/compare6.c: Replace Wall with Walways-true. * gcc.dg/Walways-true.c: New. * gcc.dg/Walways-true-Wextra.c: New. * gcc.dg/Walways-true-no.c: New. * g++.dg/warn/Walways-true.C: New. * g++.dg/warn/Walways-true-Wextra.C: New. * g++.dg/warn/Walways-true-no.C: New.
Attachment:
walways-true.diff
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |