This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH]: __FUNCTION__ handling
- To: nathan at codesourcery dot com
- Subject: Re: [C++ PATCH]: __FUNCTION__ handling
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 05 Mar 2000 13:37:16 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <38C237E1.E4E4C579@codesourcery.com>
Nathan --
A few minor nits:
+ extern tree (*make_fname_decl) PARAMS ((tree, const char *, int));
+
I think this belongs in c-common.h, not tree.h, since it is a
C-like-languages-only notion.
+ static tree
+ c_make_fname_decl (id, name, type_dep)
+ tree id;
Needs a comment.
+ static tree
+ cp_make_fname_decl (id, name, type_dep)
Likewise.
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (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. */
! if (TREE_USED (decl))
! make_rtl_for_local_static (decl);
! }
I'd format this as:
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
&& TREE_USED (decl))
rather than nest the conditional.
! of its initializing constant. */
! else if (TREE_READONLY_DECL_P (exp) && code != ARRAY_TYPE)
Does this make us emit __FUNCTION__ just because the user says
something like:
const char *c = __FUNCTION__
? That should still not require that the actual __FUNCTION__ itself
be emitted; that should only happen if __FUNCTIO__ is addressed.
Assuming that works correctly, the patch is fine with these changes.
Thanks!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com