X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree.c;h=e838ba1d632c67e71ee6b47702f62fe81a9ac1bd;hb=f67bd9ad79bc7ee36b0245d2f74e1685c3a471b6;hp=48f4614ceaeb949e8a0d3c4a8ac9d12e840f9420;hpb=a3a710aeb939f38dd83bdc3b8514ec33aab83f56;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree.c b/gcc/tree.c index 48f4614ceae..e838ba1d632 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2923,11 +2923,11 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) break; default: - if (TREE_CODE_CLASS (code) == tcc_unary + if ((TREE_CODE_CLASS (code) == tcc_unary || code == VIEW_CONVERT_EXPR) && node && !TYPE_P (node) && TREE_CONSTANT (node)) TREE_CONSTANT (t) = 1; - if (TREE_CODE_CLASS (code) == tcc_unary + if ((TREE_CODE_CLASS (code) == tcc_unary || code == VIEW_CONVERT_EXPR) && node && TREE_INVARIANT (node)) TREE_INVARIANT (t) = 1; if (TREE_CODE_CLASS (code) == tcc_reference @@ -3449,7 +3449,6 @@ is_attribute_with_length_p (const char *attr, int attr_len, tree ident) gcc_assert (attr[1] == '_'); gcc_assert (attr[attr_len - 2] == '_'); gcc_assert (attr[attr_len - 1] == '_'); - gcc_assert (attr[1] == '_'); if (ident_len == attr_len - 4 && strncmp (attr + 2, p, attr_len - 4) == 0) return 1; @@ -3499,6 +3498,28 @@ lookup_attribute (const char *attr_name, tree list) return NULL_TREE; } +/* Remove any instances of attribute ATTR_NAME in LIST and return the + modified list. */ + +tree +remove_attribute (const char *attr_name, tree list) +{ + tree *p; + size_t attr_len = strlen (attr_name); + + for (p = &list; *p; ) + { + tree l = *p; + gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); + if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l))) + *p = TREE_CHAIN (l); + else + p = &TREE_CHAIN (l); + } + + return list; +} + /* Return an attribute list that is the union of a1 and a2. */ tree @@ -3533,7 +3554,17 @@ merge_attributes (tree a1, tree a2) a = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)), TREE_CHAIN (a))) { - if (simple_cst_equal (TREE_VALUE (a), TREE_VALUE (a2)) == 1) + if (TREE_VALUE (a) != NULL + && TREE_CODE (TREE_VALUE (a)) == TREE_LIST + && TREE_VALUE (a2) != NULL + && TREE_CODE (TREE_VALUE (a2)) == TREE_LIST) + { + if (simple_cst_list_equal (TREE_VALUE (a), + TREE_VALUE (a2)) == 1) + break; + } + else if (simple_cst_equal (TREE_VALUE (a), + TREE_VALUE (a2)) == 1) break; } if (a == NULL_TREE) @@ -3685,9 +3716,18 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags, return NULL_TREE; } + if (TREE_CODE (node) != FUNCTION_DECL + && TREE_CODE (node) != VAR_DECL) + { + *no_add_attrs = true; + warning (OPT_Wattributes, "%qs attribute ignored", + IDENTIFIER_POINTER (name)); + return NULL_TREE; + } + /* Report error on dllimport ambiguities seen now before they cause any damage. */ - if (is_attribute_p ("dllimport", name)) + else if (is_attribute_p ("dllimport", name)) { /* Honor any target-specific overrides. */ if (!targetm.valid_dllimport_attribute_p (node)) @@ -4344,15 +4384,21 @@ attribute_list_contained (tree l1, tree l2) attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), TREE_CHAIN (attr))) { - if (simple_cst_equal (TREE_VALUE (t2), TREE_VALUE (attr)) == 1) + if (TREE_VALUE (t2) != NULL + && TREE_CODE (TREE_VALUE (t2)) == TREE_LIST + && TREE_VALUE (attr) != NULL + && TREE_CODE (TREE_VALUE (attr)) == TREE_LIST) + { + if (simple_cst_list_equal (TREE_VALUE (t2), + TREE_VALUE (attr)) == 1) + break; + } + else if (simple_cst_equal (TREE_VALUE (t2), TREE_VALUE (attr)) == 1) break; } if (attr == 0) return 0; - - if (simple_cst_equal (TREE_VALUE (t2), TREE_VALUE (attr)) != 1) - return 0; } return 1; @@ -5136,7 +5182,11 @@ build_array_type (tree elt_type, tree index_type) if (index_type == 0) { - layout_type (t); + tree save = t; + hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); + t = type_hash_canon (hashcode, t); + if (save == t) + layout_type (t); return t; } @@ -6664,6 +6714,26 @@ build_common_builtin_nodes (void) "__builtin_nonlocal_goto", ECF_NORETURN | ECF_NOTHROW); + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); + ftype = build_function_type (void_type_node, tmp); + local_define_builtin ("__builtin_setjmp_setup", ftype, + BUILT_IN_SETJMP_SETUP, + "__builtin_setjmp_setup", ECF_NOTHROW); + + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + ftype = build_function_type (ptr_type_node, tmp); + local_define_builtin ("__builtin_setjmp_dispatcher", ftype, + BUILT_IN_SETJMP_DISPATCHER, + "__builtin_setjmp_dispatcher", + ECF_PURE | ECF_NOTHROW); + + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + ftype = build_function_type (void_type_node, tmp); + local_define_builtin ("__builtin_setjmp_receiver", ftype, + BUILT_IN_SETJMP_RECEIVER, + "__builtin_setjmp_receiver", ECF_NOTHROW); + ftype = build_function_type (ptr_type_node, void_list_node); local_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE, "__builtin_stack_save", ECF_NOTHROW);