aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-09-24 13:21:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-09-24 13:21:30 +0000
commit116f30c3fe6af8ea6211f5cf8e0ac3b67fee1f18 (patch)
tree900072c0be45209de4c62493ca2c3e567bc209d5 /gcc/c-decl.c
parentde6ba7aee152a0c20572bf6250426862c5caf323 (diff)
downloadgcc-116f30c3fe6af8ea6211f5cf8e0ac3b67fee1f18.zip
gcc-116f30c3fe6af8ea6211f5cf8e0ac3b67fee1f18.tar.gz
gcc-116f30c3fe6af8ea6211f5cf8e0ac3b67fee1f18.tar.bz2
c-decl.c (pop_scope): Always set file-scope DECL_CONTEXT.
2010-09-24 Richard Guenther <rguenther@suse.de> * c-decl.c (pop_scope): Always set file-scope DECL_CONTEXT. Make sure to not call set_type_context with error_mark_node. * langhooks.c (lhd_set_decl_assembler_name): Use DECL_FILE_SCOPE_P. * gcc.dg/lto/20091006-2_0.c: Prune warnings. From-SVN: r164591
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index f8be06b..35f3d29 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1203,15 +1203,14 @@ pop_scope (void)
DECL_CHAIN (extp) = BLOCK_VARS (block);
BLOCK_VARS (block) = extp;
}
- /* If this is the file scope, and we are processing more
- than one translation unit in this compilation, set
- DECL_CONTEXT of each decl to the TRANSLATION_UNIT_DECL.
- This makes same_translation_unit_p work, and causes
- static declarations to be given disambiguating suffixes. */
- if (scope == file_scope && num_in_fnames > 1)
+ /* If this is the file scope set DECL_CONTEXT of each decl to
+ the TRANSLATION_UNIT_DECL. This makes same_translation_unit_p
+ work. */
+ if (scope == file_scope)
{
DECL_CONTEXT (p) = context;
- if (TREE_CODE (p) == TYPE_DECL)
+ if (TREE_CODE (p) == TYPE_DECL
+ && TREE_TYPE (p) != error_mark_node)
set_type_context (TREE_TYPE (p), context);
}