diff options
author | Roger Sayle <sayle@gcc.gnu.org> | 2005-12-04 19:58:37 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2005-12-04 19:58:37 +0000 |
commit | d77314ece616e1a2626ebd2f6abf55ecda0b440f (patch) | |
tree | 52d2bc4b847d5c936893d4cd757172df53b8a26e /gcc/doc | |
parent | e994a705a9d8447c17486c13d741c2692c475f67 (diff) | |
download | gcc-d77314ece616e1a2626ebd2f6abf55ecda0b440f.zip gcc-d77314ece616e1a2626ebd2f6abf55ecda0b440f.tar.gz gcc-d77314ece616e1a2626ebd2f6abf55ecda0b440f.tar.bz2 |
re PR c/7776 (const char* p = "foo"; if (p == "foo") ... is compiled without warning!)
PR c/7776
* doc/invoke.texi: Document new -Wstring-literal-comparison option.
From-SVN: r108019
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8935749..d51aef0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -244,6 +244,7 @@ Objective-C and Objective-C++ Dialects}. -Wreturn-type -Wsequence-point -Wshadow @gol -Wsign-compare -Wstack-protector @gol -Wstrict-aliasing -Wstrict-aliasing=2 @gol +-Wstring-literal-comparison @gol -Wswitch -Wswitch-default -Wswitch-enum @gol -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol -Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol @@ -3403,9 +3404,19 @@ This option is only supported for C and Objective-C@. Make all warnings into errors. @item -Wstack-protector +@opindex Wstack-protector This option is only active when @option{-fstack-protector} is active. It warns about functions that will not be protected against stack smashing. +@item -Wstring-literal-comparison +@opindex Wstring-literal-comparison +Warn about suspicious comparisons to string literal constants. In C, +direct comparisons against the memory address of a string literal, such +as @code{if (x == "abc")}, typically indicate a programmer error, and +even when intentional, result in unspecified behavior and are not portable. +Usually these warnings alert that the programmer intended to use +@code{strcmp}. This warning is enabled by @option{-Wall}. + @end table @node Debugging Options |