diff mbox

Some small C++ cleanup PATCHes

Message ID 4CC6ED26.20402@redhat.com
State New
Headers show

Commit Message

Jason Merrill Oct. 26, 2010, 3 p.m. UTC
A few minor things I ran across while working on something else:

1) stabilize_expr didn't know about xvalues.  I think this has no 
practical impact, given the current users of stabilize_expr--when it is 
called by stabilize_call, any reference arguments to the call have 
REFERENCE_TYPE rather than the dereferenced type--but I thought that it 
might be good to fix it for potential future users.

2) build_over_call was unnecessarily duplicating the logic for getting 
the 'this' argument that was previously used to set up argarray.

3) finish_function doesn't need special handling for function_depth > 1 
anymore; the comment talks about cxx_pop_function_context wanting to use 
current_function_decl, but that function no longer exists.

Tested x86_64-pc-linux-gnu, applied to trunk.

Comments

H.J. Lu Dec. 18, 2010, 3:34 p.m. UTC | #1
On Tue, Oct 26, 2010 at 8:00 AM, Jason Merrill <jason@redhat.com> wrote:
> A few minor things I ran across while working on something else:
>
> 1) stabilize_expr didn't know about xvalues.  I think this has no practical
> impact, given the current users of stabilize_expr--when it is called by
> stabilize_call, any reference arguments to the call have REFERENCE_TYPE
> rather than the dereferenced type--but I thought that it might be good to
> fix it for potential future users.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47003
diff mbox

Patch

commit 53c671d19db2b1e61843fd87d9859a213a3f1353
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Oct 23 10:32:30 2010 -0400

    	* decl.c (finish_function): Don't look at function_depth.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1409330..e513bc0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12660,7 +12660,6 @@  finish_function (int flags)
   tree fndecl = current_function_decl;
   tree fntype, ctype = NULL_TREE;
   int inclass_inline = (flags & 2) != 0;
-  int nested;
 
   /* When we get some parse errors, we can end up without a
      current_function_decl, so cope.  */
@@ -12672,7 +12671,6 @@  finish_function (int flags)
 
   record_key_method_defined (fndecl);
 
-  nested = function_depth > 1;
   fntype = TREE_TYPE (fndecl);
 
   /*  TREE_READONLY (fndecl) = 1;
@@ -12883,11 +12881,7 @@  finish_function (int flags)
   --function_depth;
 
   /* Clean up.  */
-  if (! nested)
-    /* Let the error reporting routines know that we're outside a
-       function.  For a nested function, this value is used in
-       cxx_pop_function_context and then reset via pop_function_context.  */
-    current_function_decl = NULL_TREE;
+  current_function_decl = NULL_TREE;
 
   defer_mark_used_calls = false;
   if (deferred_mark_used_calls)