From: Mark Mitchell Date: Tue, 15 Apr 2003 16:35:52 +0000 (+0000) Subject: c-decl.c (implicitly_declare): Copy declarations that are going to be placed in a... X-Git-Tag: releases/gcc-3.4.0~7270 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8b718bae9f54b8c8d33a73546c632cd7568a8db;p=thirdparty%2Fgcc.git c-decl.c (implicitly_declare): Copy declarations that are going to be placed in a local scope. * c-decl.c (implicitly_declare): Copy declarations that are going to be placed in a local scope. From-SVN: r65646 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e62bc233510..23feddfdbec0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-04-15 Mark Mitchell + + * c-decl.c (implicitly_declare): Copy declarations that are going + to be placed in a local scope. + 2003-04-15 James A. Morrison * invoke.texi (Spec Files): Wrap if-exists-else example. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 50b7219b3935..0614476c00e2 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1872,7 +1872,13 @@ implicitly_declare (functionid) warning_with_decl (decl, "previous declaration of `%s'"); C_DECL_IMPLICIT (decl) = 1; } - return pushdecl (decl); + /* If this function is global, then it must already be in the + global binding level, so there's no need to push it again. */ + if (current_binding_level == global_binding_level) + return decl; + /* If this is a local declaration, make a copy; we can't have + the same DECL listed in two different binding levels. */ + return pushdecl (copy_node (decl)); } /* Not seen before. */