aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-04-26 00:40:12 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-04-26 00:40:12 -0700
commitb84a3874349ccc870c3d278b874d43763efbc9bb (patch)
treef89357e36b49124025bfcd5e54bb2778e043f4e6 /gcc/objc
parent4d7ea4fc78df072028a41875a967d49f9b4c9dea (diff)
downloadgcc-b84a3874349ccc870c3d278b874d43763efbc9bb.zip
gcc-b84a3874349ccc870c3d278b874d43763efbc9bb.tar.gz
gcc-b84a3874349ccc870c3d278b874d43763efbc9bb.tar.bz2
c-common.c (fix_string_type): Split out of ...
* c-common.c (fix_string_type): Split out of ... (combine_strings): ... here. Take a varray, not a tree list. (c_expand_builtin_printf): Use fix_string_type. * c-common.h: Update decls. * c-parse.in (string): Remove. Update all uses to use STRING instead, and not call combine_strings. (yylexstring): New. (_yylex): Use it. * c-typeck.c (simple_asm_stmt): Don't call combine_strings. (build_asm_stmt): Likewise. * objc/objc-act.c (my_build_string): Use fix_string_type. (build_objc_string_object): Build varray for combine_strings. * parse.y (string): Remove. Update all uses to use STRING instead, and not call combine_strings. * rtti.c (tinfo_name): Use fix_string_type. * semantics.c (finish_asm_stmt): Don't call combine_strings. * spew.c (yylexstring): New. (read_token): Use it. * g++.dg/parse/concat1.C: New. * gcc.dg/concat2.c: New. From-SVN: r52790
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/objc-act.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 827a5a7..4795160 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1201,21 +1201,7 @@ my_build_string (len, str)
int len;
const char *str;
{
- int wide_flag = 0;
- tree a_string = build_string (len, str);
-
- /* Some code from combine_strings, which is local to c-parse.y. */
- if (TREE_TYPE (a_string) == int_array_type_node)
- wide_flag = 1;
-
- TREE_TYPE (a_string)
- = build_array_type (wide_flag ? integer_type_node : char_type_node,
- build_index_type (build_int_2 (len - 1, 0)));
-
- TREE_CONSTANT (a_string) = 1; /* Puts string in the readonly segment */
- TREE_STATIC (a_string) = 1;
-
- return a_string;
+ return fix_string_type (build_string (len, str));
}
/* Given a chain of STRING_CST's, build a static instance of
@@ -1241,7 +1227,23 @@ build_objc_string_object (strings)
add_class_reference (constant_string_id);
- string = combine_strings (strings);
+ if (TREE_CHAIN (strings))
+ {
+ varray_type vstrings;
+ VARRAY_TREE_INIT (vstrings, 32, "strings");
+
+ for (; strings ; strings = TREE_CHAIN (strings))
+ VARRAY_PUSH_TREE (vstrings, strings);
+
+ string = combine_strings (vstrings);
+
+ VARRAY_FREE (vstrings);
+ }
+ else
+ string = strings;
+
+ string = fix_string_type (string);
+
TREE_SET_CODE (string, STRING_CST);
length = TREE_STRING_LENGTH (string) - 1;