diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 92f6d140b4b..ad622605280 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1200,7 +1200,40 @@ duplicate_decls (tree newdecl, tree olddecl) { /* Avoid warnings redeclaring anticipated built-ins. */ if (DECL_ANTICIPATED (olddecl)) - ; /* Do nothing yet. */ + { + /* Deal with fileptr_type_node. FILE type is not known + at the time we create the builtins. */ + tree t1, t2; + + for (t1 = TYPE_ARG_TYPES (TREE_TYPE (newdecl)), + t2 = TYPE_ARG_TYPES (TREE_TYPE (olddecl)); + t1 || t2; + t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2)) + if (!t1 || !t2) + break; + else if (TREE_VALUE (t2) == fileptr_type_node) + { + tree t = TREE_VALUE (t1); + + if (TREE_CODE (t) == POINTER_TYPE + && TYPE_NAME (TREE_TYPE (t)) + && DECL_NAME (TYPE_NAME (TREE_TYPE (t))) + == get_identifier ("FILE") + && compparms (TREE_CHAIN (t1), TREE_CHAIN (t2))) + { + tree oldargs = TYPE_ARG_TYPES (TREE_TYPE (olddecl)); + + TYPE_ARG_TYPES (TREE_TYPE (olddecl)) + = TYPE_ARG_TYPES (TREE_TYPE (newdecl)); + types_match = decls_match (newdecl, olddecl); + if (types_match) + return duplicate_decls (newdecl, olddecl); + TYPE_ARG_TYPES (TREE_TYPE (olddecl)) = oldargs; + } + } + else if (! same_type_p (TREE_VALUE (t1), TREE_VALUE (t2))) + break; + } else if ((DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), |