From b84a3874349ccc870c3d278b874d43763efbc9bb Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 26 Apr 2002 00:40:12 -0700 Subject: 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 --- gcc/objc/objc-act.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'gcc/objc/objc-act.c') 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; -- cgit v1.1