diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 24 | ||||
-rw-r--r-- | gcc/cp/inc/cxxabi.h | 8 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 11 | ||||
-rw-r--r-- | gcc/cp/tree.c | 12 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 6 | ||||
-rw-r--r-- | gcc/cp/vec.cc | 29 |
8 files changed, 78 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bce0fea..0caff7f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2000-07-09 Mark Mitchell <mark@codesourcery.com> + + * cp-tree.h (char_type_p): New function. + * decl.c (init_decl_processing): Don't initialize + signed_wchar_type_node or unsigned_wchar_type_node. + (complete_array_type): Handle brace-enclosed string-constants. + * rtti.c (emit_support_tinfos): Remove #if 0'd code. + * tree.c (char_type_p): New function. + * typeck2.c (digest_init): Use char_type_p. + 2000-07-06 Nathan Sidwell <nathan@codesourcery.com> * pt.c (tsubst): Don't layout type, if it's error_mark. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a5fea50..a87a8b7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4547,7 +4547,8 @@ extern void remap_save_expr PARAMS ((tree *, splay_tree, tre extern tree build_shared_int_cst PARAMS ((int)); extern special_function_kind special_function_p PARAMS ((tree)); extern int count_trees PARAMS ((tree)); - +extern int char_type_p PARAMS ((tree)); + /* in typeck.c */ extern int string_conv_p PARAMS ((tree, tree, int)); extern tree condition_conversion PARAMS ((tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2c1b7ed..ee0d058 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6549,12 +6549,10 @@ init_decl_processing () : WCHAR_TYPE); wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node)); wchar_type_size = TYPE_PRECISION (wchar_type_node); - signed_wchar_type_node = make_signed_type (wchar_type_size); - unsigned_wchar_type_node = make_unsigned_type (wchar_type_size); - wchar_type_node - = TREE_UNSIGNED (wchar_type_node) - ? unsigned_wchar_type_node - : signed_wchar_type_node; + if (TREE_UNSIGNED (wchar_type_node)) + wchar_type_node = make_signed_type (wchar_type_size); + else + wchar_type_node = make_unsigned_type (wchar_type_size); record_builtin_type (RID_WCHAR, "__wchar_t", wchar_type_node); /* Artificial declaration of wchar_t -- can be bashed */ @@ -8637,8 +8635,18 @@ complete_array_type (type, initial_value, do_default) if (initial_value) { - /* Note MAXINDEX is really the maximum index, - one less than the size. */ + /* An array of character type can be initialized from a + brace-enclosed string constant. */ + if (char_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type))) + && TREE_CODE (initial_value) == CONSTRUCTOR + && CONSTRUCTOR_ELTS (initial_value) + && (TREE_CODE (TREE_VALUE (CONSTRUCTOR_ELTS (initial_value))) + == STRING_CST) + && TREE_CHAIN (CONSTRUCTOR_ELTS (initial_value)) == NULL_TREE) + initial_value = TREE_VALUE (CONSTRUCTOR_ELTS (initial_value)); + + /* Note MAXINDEX is really the maximum index, one less than the + size. */ if (TREE_CODE (initial_value) == STRING_CST) { int eltsize diff --git a/gcc/cp/inc/cxxabi.h b/gcc/cp/inc/cxxabi.h index 8987b6d..b9a19d2 100644 --- a/gcc/cp/inc/cxxabi.h +++ b/gcc/cp/inc/cxxabi.h @@ -445,6 +445,14 @@ void __cxa_vec_ctor (void *__array_address, void (*__constructor) (void *), void (*__destructor) (void *)); +extern "C++" +void __cxa_vec_cctor (void *dest_array, + void *src_array, + __SIZE_TYPE__ element_count, + __SIZE_TYPE__ element_size, + void (*constructor) (void *, void *), + void (*destructor) (void *)); + /* destruct array */ extern "C++" void __cxa_vec_dtor (void *__array_address, diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 376d384..63c1e3c 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1970,23 +1970,12 @@ emit_support_tinfos () &void_type_node, &boolean_type_node, &wchar_type_node, -#if 0 - &signed_wchar_type_node, &unsigned_wchar_type_node, -#endif &char_type_node, &signed_char_type_node, &unsigned_char_type_node, &short_integer_type_node, &short_unsigned_type_node, &integer_type_node, &unsigned_type_node, &long_integer_type_node, &long_unsigned_type_node, &long_long_integer_type_node, &long_long_unsigned_type_node, &float_type_node, &double_type_node, &long_double_type_node, - - /* GCC extension types */ -#if 0 - &complex_integer_type_node, - &complex_float_type_node, &complex_double_type_node, - &complex_long_double_type_node, -#endif - 0 }; int ix; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index f055899..b17915f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2488,3 +2488,15 @@ special_function_p (decl) return sfk_none; } + +/* Returns non-zero if TYPE is a character type, including wchar_t. */ + +int +char_type_p (type) + tree type; +{ + return (same_type_p (type, char_type_node) + || same_type_p (type, unsigned_char_type_node) + || same_type_p (type, signed_char_type_node) + || same_type_p (type, wchar_type_node)); +} diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index ce962e9..7b947d2 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -573,11 +573,7 @@ digest_init (type, init, tail) } typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type)); - if ((typ1 == char_type_node - || typ1 == signed_char_type_node - || typ1 == unsigned_char_type_node - || typ1 == unsigned_wchar_type_node - || typ1 == signed_wchar_type_node) + if (char_type_p (typ1) && ((init && TREE_CODE (init) == STRING_CST) || (element && TREE_CODE (element) == STRING_CST))) { diff --git a/gcc/cp/vec.cc b/gcc/cp/vec.cc index e88e48d..5e963ca 100644 --- a/gcc/cp/vec.cc +++ b/gcc/cp/vec.cc @@ -94,6 +94,35 @@ __cxa_vec_ctor (void *array_address, } } +/* construct an array by copying */ + +extern "C++" void +__cxa_vec_cctor (void *dest_array, + void *src_array, + size_t element_count, + size_t element_size, + void (*constructor) (void *, void *), + void (*destructor) (void *)) +{ + size_t ix = 0; + char *dest_ptr = static_cast <char *> (dest_array); + char *src_ptr = static_cast <char *> (src_array); + + try + { + if (constructor) + for (; ix != element_count; + ix++, src_ptr += element_size, dest_ptr += element_size) + constructor (dest_ptr, src_ptr); + } + catch (...) + { + __uncatch_exception (); + __cxa_vec_dtor (dest_array, ix, element_size, destructor); + throw; + } +} + /* destruct array */ extern "C++" void __cxa_vec_dtor (void *array_address, |