diff options
author | Marek Polacek <polacek@redhat.com> | 2015-05-07 19:36:31 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-05-07 19:36:31 +0000 |
commit | 0173bd2a038cbeef871b22b312a6856ab1dcda2a (patch) | |
tree | 12367850915ce482968be36f7c2f4344d74b5ed5 /gcc/doc/invoke.texi | |
parent | d57c99458933a21fdf94f508191f145ad8d5ec58 (diff) | |
download | gcc-0173bd2a038cbeef871b22b312a6856ab1dcda2a.zip gcc-0173bd2a038cbeef871b22b312a6856ab1dcda2a.tar.gz gcc-0173bd2a038cbeef871b22b312a6856ab1dcda2a.tar.bz2 |
re PR c/65179 (Introduce new C warning: -Wshift-negative-value)
PR c/65179
* c-common.c (c_fully_fold_internal): Warn when left shifting a
negative value.
* c.opt (Wshift-negative-value): New option.
* c-opts.c (c_common_post_options): Set warn_shift_negative_value
when -Wextra and C99/C++11 mode.
* c-typeck.c (build_binary_op): Warn when left shifting a negative
value.
* typeck.c (cp_build_binary_op): Warn when left shifting a negative
value.
* doc/invoke.texi: Document -Wshift-negative-value.
* c-c++-common/Wshift-negative-value-1.c: New test.
* testsuite/c-c++-common/Wshift-negative-value-2.c: New test.
* testsuite/c-c++-common/Wshift-negative-value-3.c: New test.
* testsuite/c-c++-common/Wshift-negative-value-4.c: New test.
* testsuite/c-c++-common/Wshift-negative-value-5.c: New test.
* testsuite/c-c++-common/Wshift-negative-value-6.c: New test.
* testsuite/gcc.dg/c90-left-shift-1.c: New test.
* testsuite/gcc.dg/c99-const-expr-7.c: Add dg-error.
* testsuite/gcc.dg/c99-left-shift-1.c: New test.
From-SVN: r222889
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2c58a0d..934edd6 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -271,7 +271,7 @@ Objective-C and Objective-C++ Dialects}. -Wpointer-arith -Wno-pointer-to-int-cast @gol -Wredundant-decls -Wno-return-local-addr @gol -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol --Wshift-count-negative -Wshift-count-overflow @gol +-Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol @@ -3489,6 +3489,7 @@ name is still supported, but the newer name is more descriptive.) -Wsign-compare @gol -Wtype-limits @gol -Wuninitialized @gol +-Wshift-negative-value @gol -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol } @@ -3922,6 +3923,12 @@ Warn if shift count is negative. This warning is enabled by default. @opindex Wno-shift-count-overflow Warn if shift count >= width of type. This warning is enabled by default. +@item -Wshift-negative-value +@opindex Wshift-negative-value +@opindex Wno-shift-negative-value +Warn if left shifting a negative value. This warning is enabled by +@option{-Wextra} in C99 and C++11 modes (and newer). + @item -Wswitch @opindex Wswitch @opindex Wno-switch |