diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-09 16:28:26 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-09 16:28:26 +0000 |
commit | 390be14e0fd6f0c7f292a480c01410c151968efa (patch) | |
tree | b179cc85dddedf0fe8e6f465783c974cde2e7b0a /gcc/c-common.c | |
parent | 86efa74d1f043cf591357baba9be2048c82b78f6 (diff) | |
download | gcc-390be14e0fd6f0c7f292a480c01410c151968efa.tar.gz |
2006-02-09 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-common.h (flag_const_strings): Don't declare.
* c-common.c (flag_const_strings): Remove.
* c.opt (fconst_strings): Remove.
* c-opts.c (c_common_handle_option): Remove
* <OPT_fconst_strings>.
<OPT_Wwrite_strings>: Don't set flag_const_strings.
(c_common_init_options): Don't set flag_const_strings.
* doc/invoke.texi (-fno-const-strings): Remove documentation.
cp/
2006-02-09 Gabriel Dos Reis <gdr@integrable-solutions.net>
* typeck.c (string_conv_p): Don't test for flag_const_strings.
testsuite/
2006-02-09 Gabriel Dos Reis <gdr@integrable-solutions.net>
* g++.old-deja/g++.benjamin/15351-2.C: Likewise.
* g++.old-deja/g++.benjamin/15351-1.C: Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 5be33635216..4c10bf4dd81 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -261,11 +261,6 @@ int flag_ms_extensions; int flag_no_asm; -/* Nonzero means give string constants the type `const char *', as mandated - by the standard. */ - -int flag_const_strings; - /* Nonzero means to treat bitfields as signed unless they say `unsigned'. */ int flag_signed_bitfields = 1; @@ -869,10 +864,14 @@ fix_string_type (tree value) nchars - 1, nchars_max, relevant_std); } - /* Create the array type for the string constant. flag_const_strings - says make the string constant an array of const char so that - copying it to a non-const pointer will get a warning. For C++, - this is the standard behavior. + /* Create the array type for the string constant. The ISO C++ + standard says that a string literal has type `const char[N]' or + `const wchar_t[N]'. We use the same logic when invoked as a C + front-end with -Wwrite-strings. + ??? We should change the type of an expression depending on the + state of a warning flag. We should just be warning -- see how + this is handled in the C++ front-end for the deprecated implicit + conversion from string literals to `char*' or `wchar_t*'. The C++ front end relies on TYPE_MAIN_VARIANT of a cv-qualified array type being the unqualified version of that type. @@ -883,7 +882,7 @@ fix_string_type (tree value) e_type = wide_flag ? wchar_type_node : char_type_node; i_type = build_index_type (build_int_cst (NULL_TREE, nchars - 1)); a_type = build_array_type (e_type, i_type); - if (flag_const_strings) + if (c_dialect_cxx() || warn_write_strings) a_type = c_build_qualified_type (a_type, TYPE_QUAL_CONST); TREE_TYPE (value) = a_type; |