aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2004-02-23 21:43:18 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-02-23 21:43:18 +0000
commit3521b33c2fcc3f132e9b643042dad7caa5e46b15 (patch)
tree796f91d81523d174b9d97e4a2c0bf9200c831f94 /gcc/varasm.c
parenteac8a696d5418a3bd48d41980b2dc3095f711778 (diff)
downloadgcc-3521b33c2fcc3f132e9b643042dad7caa5e46b15.zip
gcc-3521b33c2fcc3f132e9b643042dad7caa5e46b15.tar.gz
gcc-3521b33c2fcc3f132e9b643042dad7caa5e46b15.tar.bz2
Remove -fwritable-strings.
gcc/ Remove -fwritable-strings. * c-common.c (fix_string_type): Don't check flag_writable_strings. (fix_string_type): Likewise. * c-opts.c (set_std_c89): Don't initialize flag_writable_strings. (set_std_c99): Likewise. * common.opt (fwritable-strings): Remove. * flags.h: Remove the external declaration of flag_writable_strings. * opts.c (common_handle_option) <OPT_fwritable_strings>: Remove. * toplev.c (flag_writable_strings): Remove. (f_options): Remove an entry for writable-strings. * varasm.c (const_hash_1) <STRING_CST>: Don't check flag_writable_strings. (compare_constant) <STRING_CST>: Likewise. (build_constant_desc): Likewise. * config/darwin.c (machopic_select_section): Likewise. * config/arm/arm.c (AOF_ASSEMBLER): Likewise. * config/arm/pe.c (arm_pe_encode_section_info): Likewise. * config/iq2000/iq2000.c (iq2000_select_section): Likewise. * config/mips/mips.c (mips_select_section): Likewise. (mips_encode_section_info): Likewise. * config/pa/pa.c (pa_select_section): Likewise. * config/pa/pa.h (TEXT_SPACE_P): Likewise. * config/v850/v850.c (v850_select_section): Likewise. * doc/invoke.texi (-fwritable-strings): Remove. (-fno-const-strings): Don't mention -fwritable-strings. * doc/trouble.texi: Don't mention -fwritable-strings. gcc/cp/ * decl.c (cxx_init_decl_processing): Don't check flag_writable_strings. gcc/testsuite/ * gcc.dg/fwritable-strings-1.c: Remove. Co-Authored-By: Kazu Hirata <kazu@cs.umass.edu> From-SVN: r78333
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 806224d..061cbca 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2029,16 +2029,8 @@ const_hash_1 (const tree exp)
return real_hash (TREE_REAL_CST_PTR (exp));
case STRING_CST:
- if (flag_writable_strings)
- {
- p = (char *) &exp;
- len = sizeof exp;
- }
- else
- {
- p = TREE_STRING_POINTER (exp);
- len = TREE_STRING_LENGTH (exp);
- }
+ p = TREE_STRING_POINTER (exp);
+ len = TREE_STRING_LENGTH (exp);
break;
case COMPLEX_CST:
@@ -2154,9 +2146,6 @@ compare_constant (const tree t1, const tree t2)
return REAL_VALUES_IDENTICAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
case STRING_CST:
- if (flag_writable_strings)
- return t1 == t2;
-
if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
return 0;
@@ -2359,10 +2348,7 @@ build_constant_desc (tree exp)
struct constant_descriptor_tree *desc;
desc = ggc_alloc (sizeof (*desc));
- if (flag_writable_strings && TREE_CODE (exp) == STRING_CST)
- desc->value = exp;
- else
- desc->value = copy_constant (exp);
+ desc->value = copy_constant (exp);
/* Create a string containing the label name, in LABEL. */
labelno = const_labelno++;
@@ -2444,9 +2430,9 @@ maybe_output_constant_def_contents (struct constant_descriptor_tree *desc,
/* Already output; don't do it again. */
return;
- /* The only constants that cannot safely be deferred, assuming the
- context allows it, are strings under flag_writable_strings. */
- if (defer && (TREE_CODE (exp) != STRING_CST || !flag_writable_strings))
+ /* We can always defer constants as long as the context allows
+ doing so. */
+ if (defer)
{
/* Increment n_deferred_constants if it exists. It needs to be at
least as large as the number of constants actually referred to
@@ -4486,7 +4472,7 @@ default_select_section (tree decl, int reloc,
readonly = true;
}
else if (TREE_CODE (decl) == STRING_CST)
- readonly = !flag_writable_strings;
+ readonly = true;
else if (! (flag_pic && reloc))
readonly = true;
@@ -4544,12 +4530,7 @@ categorize_decl_for_section (tree decl, int reloc, int shlib)
if (TREE_CODE (decl) == FUNCTION_DECL)
return SECCAT_TEXT;
else if (TREE_CODE (decl) == STRING_CST)
- {
- if (flag_writable_strings)
- return SECCAT_DATA;
- else
- return SECCAT_RODATA_MERGE_STR;
- }
+ return SECCAT_RODATA_MERGE_STR;
else if (TREE_CODE (decl) == VAR_DECL)
{
if (DECL_INITIAL (decl) == NULL