diff options
author | Rafael Ávila de Espíndola <espindola@google.com> | 2009-04-03 19:55:44 +0000 |
---|---|---|
committer | Rafael Ávila de Espíndola <espindola@google.com> | 2009-04-03 19:55:44 +0000 |
commit | 0a0505dce73757d64fe3cf86de2578189dbfc250 (patch) | |
tree | c5f703405fd2590dd59f96ee41f9ada2064b289c /gcc | |
parent | 1eef54a7cff3170a44e7f477a2a1d89d766e3af5 (diff) |
2009-04-03 Rafael Avila de Espindola <espindola@google.com>
* c-decl.c (match_builtin_function_types): Moved from tree.c
(merge_decls): Initialize olddecl_arguments.
* lto-symtab.c (lto_symtab_compatible): Remove special case for
builtin functions.
* tree.c (match_builtin_function_types): Move to c-decl.c.
* tree.h (match_builtin_function_types): Remove.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lto@145517 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.lto | 9 | ||||
-rw-r--r-- | gcc/c-decl.c | 42 | ||||
-rw-r--r-- | gcc/lto-symtab.c | 13 | ||||
-rw-r--r-- | gcc/tree.c | 40 | ||||
-rw-r--r-- | gcc/tree.h | 1 |
5 files changed, 50 insertions, 55 deletions
diff --git a/gcc/ChangeLog.lto b/gcc/ChangeLog.lto index 379bf13f966..60cd7de6fcb 100644 --- a/gcc/ChangeLog.lto +++ b/gcc/ChangeLog.lto @@ -1,3 +1,12 @@ +2009-04-03 Rafael Avila de Espindola <espindola@google.com> + + * c-decl.c (match_builtin_function_types): Moved from tree.c + (merge_decls): Initialize olddecl_arguments. + * lto-symtab.c (lto_symtab_compatible): Remove special case for + builtin functions. + * tree.c (match_builtin_function_types): Move to c-decl.c. + * tree.h (match_builtin_function_types): Remove. + 2009-04-02 Rafael Avila de Espindola <espindola@google.com> * cgraph.c (cgraph_is_master_clone): Remove check_overwrite. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 081e7c4da8e..41aaaa9204c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -967,6 +967,46 @@ pushtag (tree name, tree type) TYPE_CONTEXT (type) = DECL_CONTEXT (TYPE_STUB_DECL (type)); } +/* Subroutine of compare_decls. Allow harmless mismatches in return + and argument types provided that the type modes match. This function + return a unified type given a suitable match, and 0 otherwise. */ + +static tree +match_builtin_function_types (tree newtype, tree oldtype) +{ + tree newrettype, oldrettype; + tree newargs, oldargs; + tree trytype, tryargs; + + /* Accept the return type of the new declaration if same modes. */ + oldrettype = TREE_TYPE (oldtype); + newrettype = TREE_TYPE (newtype); + + if (TYPE_MODE (oldrettype) != TYPE_MODE (newrettype)) + return 0; + + oldargs = TYPE_ARG_TYPES (oldtype); + newargs = TYPE_ARG_TYPES (newtype); + tryargs = newargs; + + while (oldargs || newargs) + { + if (!oldargs + || !newargs + || !TREE_VALUE (oldargs) + || !TREE_VALUE (newargs) + || TYPE_MODE (TREE_VALUE (oldargs)) + != TYPE_MODE (TREE_VALUE (newargs))) + return 0; + + oldargs = TREE_CHAIN (oldargs); + newargs = TREE_CHAIN (newargs); + } + + trytype = build_function_type (newrettype, tryargs); + return build_type_attribute_variant (trytype, TYPE_ATTRIBUTES (oldtype)); +} + /* Subroutine of diagnose_mismatched_decls. Check for function type mismatch involving an empty arglist vs a nonempty one and give clearer diagnostics. */ @@ -1818,7 +1858,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) { unsigned olddecl_uid = DECL_UID (olddecl); tree olddecl_context = DECL_CONTEXT (olddecl); - tree olddecl_arguments; + tree olddecl_arguments = NULL_TREE; if (TREE_CODE (olddecl) == FUNCTION_DECL) olddecl_arguments = DECL_ARGUMENTS (olddecl); diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index e8567a658b9..37ddd9a9f12 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -266,19 +266,6 @@ lto_symtab_compatible (tree old_decl, tree new_decl) TREE_TYPE (new_decl)); else if (TREE_CODE (new_decl) == FUNCTION_DECL) { - if (DECL_IS_BUILTIN (old_decl) || DECL_IS_BUILTIN (new_decl)) - { - tree candidate; - - candidate = match_builtin_function_types (TREE_TYPE (new_decl), - TREE_TYPE (old_decl)); - - /* We don't really have source location information at this - point, so the above matching was a bit of a gamble. */ - if (candidate) - merged_type = candidate; - } - if (!merged_type /* We want either of the types to have argument types, but not both. */ diff --git a/gcc/tree.c b/gcc/tree.c index d79849a70c6..1a1d4850a9a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9750,46 +9750,6 @@ block_nonartificial_location (tree block) return ret; } -/* Allow harmless mismatches in return and argument types provided that - the type modes match. This function return a unified type given a - suitable match, and 0 otherwise. */ - -tree -match_builtin_function_types (tree newtype, tree oldtype) -{ - tree newrettype, oldrettype; - tree newargs, oldargs; - tree trytype, tryargs; - - /* Accept the return type of the new declaration if same modes. */ - oldrettype = TREE_TYPE (oldtype); - newrettype = TREE_TYPE (newtype); - - if (TYPE_MODE (oldrettype) != TYPE_MODE (newrettype)) - return 0; - - oldargs = TYPE_ARG_TYPES (oldtype); - newargs = TYPE_ARG_TYPES (newtype); - tryargs = newargs; - - while (oldargs || newargs) - { - if (!oldargs - || !newargs - || !TREE_VALUE (oldargs) - || !TREE_VALUE (newargs) - || TYPE_MODE (TREE_VALUE (oldargs)) - != TYPE_MODE (TREE_VALUE (newargs))) - return 0; - - oldargs = TREE_CHAIN (oldargs); - newargs = TREE_CHAIN (newargs); - } - - trytype = build_function_type (newrettype, tryargs); - return build_type_attribute_variant (trytype, TYPE_ATTRIBUTES (oldtype)); -} - /* If EXP is inlined from an __attribute__((__artificial__)) function, return the location of the original call expression. */ diff --git a/gcc/tree.h b/gcc/tree.h index 6cac393a5d2..713d4dd95a4 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4967,7 +4967,6 @@ extern void stack_protect_epilogue (void); extern void recompute_tree_invariant_for_addr_expr (tree); extern bool needs_to_live_in_memory (const_tree); extern tree reconstruct_complex_type (tree, tree); -extern tree match_builtin_function_types (tree, tree); extern int real_onep (const_tree); extern int real_twop (const_tree); |