This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [C++ PATCH]: __FUNCTION__ handling



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]