CVS g++ new warning [-Winline -Werror -O1]
Jason Merrill
jason@cygnus.com
Fri Mar 10 16:21:00 GMT 2000
I applied this, as well as the following fix:
TREE_STATIC means "not auto"; you want !TREE_PUBLIC.
I don't think we want to suppress user-written statics.
We should set DECL_IGNORED_P on decls that we aren't writing out, so we
don't get debugging information for them.
2000-03-10 Jason Merrill <jason@casey.cygnus.com>
* semantics.c (expand_stmt): Only leave out rtl for unused
artificials, and set DECL_IGNORED_P on them as well.
* decl.c (wrapup_globals_for_namespace): Likewise.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.563
diff -c -p -r1.563 decl.c
*** decl.c 2000/03/10 11:56:00 1.563
--- decl.c 2000/03/11 00:18:09
*************** wrapup_globals_for_namespace (namespace,
*** 1789,1797 ****
/* Pretend we've output an unused static variable. This ensures
that the toplevel __FUNCTION__ etc won't be emitted, unless
needed. */
! if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
! && !TREE_USED (decl))
! TREE_ASM_WRITTEN (decl) = 1;
vec[len - i - 1] = decl;
}
--- 1789,1800 ----
/* Pretend we've output an unused static variable. This ensures
that the toplevel __FUNCTION__ etc won't be emitted, unless
needed. */
! if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)
! && !TREE_PUBLIC (decl) && !TREE_USED (decl))
! {
! TREE_ASM_WRITTEN (decl) = 1;
! DECL_IGNORED_P (decl) = 1;
! }
vec[len - i - 1] = decl;
}
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/semantics.c,v
retrieving revision 1.129
diff -c -p -r1.129 semantics.c
*** semantics.c 2000/03/08 11:21:28 1.129
--- semantics.c 2000/03/11 00:18:10
*************** expand_stmt (t)
*** 2392,2403 ****
expand_anon_union_decl (decl, NULL_TREE,
DECL_ANON_UNION_ELEMS (decl));
}
! else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
! && TREE_USED (decl))
! /* Do not emit unused decls. This is not just an
! optimization. We really do not want to emit
! __PRETTY_FUNCTION__ etc, if they're never used. */
! make_rtl_for_local_static (decl);
}
break;
--- 2392,2407 ----
expand_anon_union_decl (decl, NULL_TREE,
DECL_ANON_UNION_ELEMS (decl));
}
! else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
! {
! if (DECL_ARTIFICIAL (decl) && ! TREE_USED (decl))
! /* Do not emit unused decls. This is not just an
! optimization. We really do not want to emit
! __PRETTY_FUNCTION__ etc, if they're never used. */
! DECL_IGNORED_P (decl) = 1;
! else
! make_rtl_for_local_static (decl);
! }
}
break;
More information about the Gcc-patches
mailing list