diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2006-01-29 03:30:47 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2006-01-29 03:30:47 +0000 |
commit | 89a42ac8a1c85ee240df92c7ccd0c973bc95a24c (patch) | |
tree | d4a553c734fb691a872f7a7a3de2bf60d8a30c00 /gcc/doc/invoke.texi | |
parent | 0f7868fed2674fab28566ce47b388c5a48a9c8aa (diff) | |
download | gcc-89a42ac8a1c85ee240df92c7ccd0c973bc95a24c.zip gcc-89a42ac8a1c85ee240df92c7ccd0c973bc95a24c.tar.gz gcc-89a42ac8a1c85ee240df92c7ccd0c973bc95a24c.tar.bz2 |
c.opt: Add -W(no-)overlength-strings.
gcc:
* c.opt: Add -W(no-)overlength-strings.
* doc/invoke.texi: Document it.
* c-opts.c (c_common_handle_option): -pedantic implies
-Woverlength-strings, if not explicitly disabled already.
(c_common_post_options): -Woverlength-strings defaults to off, and
is always off for C++.
* c-common.c (fix_string_type): Issue warning about strings longer
than is portable only if warn_overlength_strings. Rearrange code
a little for clarity.
* configure.in: Check for -Wno-overlength-strings as well before
enabling -pedantic in stage 1.
* Makefile.in (STRICT2_WARN): Add -Wno-overlength-strings.
(gcc.o-warn, insn-automata.o-warn, build/gencondmd.o-warn): Delete.
* genconditions.c (write_header, write_one_condition)
(write_conditions, write_writer): Consolidate very long strings
that were broken up to fit in C89 portable limit. Don't use
printf when fputs will do.
gcc/testsuite:
* gcc.dg/Woverlength-strings.c
* gcc.dg/Woverlength-strings-pedantic-c89.c
* gcc.dg/Woverlength-strings-pedantic-c89-no.c
* gcc.dg/Woverlength-strings-pedantic-c99.c
* gcc.dg/Woverlength-strings-pedantic-c99-no.c: New tests.
==================================================================
From-SVN: r110360
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8301a0a..d8f69e8 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -238,7 +238,7 @@ Objective-C and Objective-C++ Dialects}. -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol --Wno-multichar -Wnonnull -Wpacked -Wpadded @gol +-Wno-multichar -Wnonnull -Woverlength-strings -Wpacked -Wpadded @gol -Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol -Wredundant-decls @gol -Wreturn-type -Wsequence-point -Wshadow @gol @@ -3444,6 +3444,21 @@ 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}. +@item -Woverlength-strings +@opindex Woverlength-strings +Warn about string constants which are longer than the ``minimum +maximum'' length specified in the C standard. Modern compilers +generally allow string constants which are much longer than the +standard's minimum limit, but very portable programs should avoid +using longer strings. + +The limit applies @emph{after} string constant concatenation, and does +not count the trailing NUL@. In C89, the limit was 509 characters; in +C99, it was raised to 4095. C++98 does not specify a normative +minimum maximum, so we do not diagnose overlength strings in C++@. + +This option is implied by @option{-pedantic}, and can be disabled with +@option{-Wno-overlength-strings}. @end table @node Debugging Options |