aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-11-13 12:59:26 -0500
committerJason Merrill <jason@gcc.gnu.org>2009-11-13 12:59:26 -0500
commitd7f1df66b24583dde50993c2aed5e4d517c44026 (patch)
treef9d3c9aa30a408ec448ad5914b9f091633af6b13 /gcc/dwarf2out.c
parenta3119b91dc67118b407a742b03279a14dc6fa5ec (diff)
downloadgcc-d7f1df66b24583dde50993c2aed5e4d517c44026.zip
gcc-d7f1df66b24583dde50993c2aed5e4d517c44026.tar.gz
gcc-d7f1df66b24583dde50993c2aed5e4d517c44026.tar.bz2
re PR c++/26965 (Unnecessary debug info for unused consts in C++)
PR debug/26965 * dwarf2out.c (gen_variable_die): Don't worry about DECL_COMDAT. Don't emit a second declaration at any scope. From-SVN: r154157
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index e3a6412..2ebe0ae 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17926,26 +17926,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL;
dw_die_ref origin_die;
int declaration = (DECL_EXTERNAL (decl_or_origin)
- /* If DECL is COMDAT and has not actually been
- emitted, we cannot take its address; there
- might end up being no definition anywhere in
- the program. For example, consider the C++
- test case:
-
- template <class T>
- struct S { static const int i = 7; };
-
- template <class T>
- const int S<T>::i;
-
- int f() { return S<int>::i; }
-
- Here, S<int>::i is not DECL_EXTERNAL, but no
- definition is required, so the compiler will
- not emit a definition. */
- || (TREE_CODE (decl_or_origin) == VAR_DECL
- && DECL_COMDAT (decl_or_origin)
- && !TREE_ASM_WRITTEN (decl_or_origin))
|| class_or_namespace_scope_p (context_die));
if (!origin)
@@ -18059,8 +18039,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
and if we already emitted a DIE for it, don't emit a second
DIE for it again. */
if (old_die
- && declaration
- && old_die->die_parent == context_die)
+ && declaration)
return;
/* For static data members, the declaration in the class is supposed