C++ diagnostic PATCH: fix pr 8586
Paolo Carlini
pcarlini@suse.de
Mon Nov 20 01:54:00 GMT 2006
Hi Gaby,
>2006-11-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
>
> PR c++/8586
> * c-opts.c (c_common_handle_option): Enable -Wwrite-strings if -Wall.
>
>
out of curiosity, I checked the documentation, and I'm not completely
sure it's consistent with the new behavior of -Wall, in particular the
last sentence of the below. Also, the -Wwrite-strings entry is grouped
together the other options not implied by -Wall...
What do you think?
Paolo.
//////////
|-Wwrite-strings|
When compiling C, give string constants the type |const
char[|length|]| so that copying the address of one into a
non-|const| |char *| pointer will get a warning; when compiling C++,
warn about the deprecated conversion from string literals to |char
*|. This warning, by default, is enabled for C++ programs. These
warnings will help you find at compile time code that can try to
write into a string constant, but only if you have been very careful
about using |const| in declarations and prototypes. Otherwise, it
will just be a nuisance; this is why we did not make -Wall request
these warnings.
||
More information about the Gcc-patches
mailing list