diff mbox

[C++] fix timer thinko

Message ID f30ca37f-f643-35a3-4494-5cc006e8d280@acm.org
State New
Headers show

Commit Message

Nathan Sidwell May 11, 2017, 2:52 p.m. UTC
Bernhard's pestering finally got through.  There was an early out that 
failed to stop the timer.

fixed by rearranging the code.

nathan

Comments

Bernhard Reutner-Fischer May 11, 2017, 3:02 p.m. UTC | #1
On 11 May 2017 at 16:52, Nathan Sidwell <nathan@acm.org> wrote:
> Bernhard's pestering finally got through.  There was an early out that
> failed to stop the timer.
>
> fixed by rearranging the code.

:) thanks.
LGTM but i cannot approve it.
Nathan Sidwell May 11, 2017, 3:03 p.m. UTC | #2
On 05/11/2017 11:02 AM, Bernhard Reutner-Fischer wrote:
> On 11 May 2017 at 16:52, Nathan Sidwell <nathan@acm.org> wrote:
>> Bernhard's pestering finally got through.  There was an early out that
>> failed to stop the timer.
>>
>> fixed by rearranging the code.
> 
> :) thanks.
> LGTM but i cannot approve it.

Oh, already committed. thanks for cluebatting

nathan
diff mbox

Patch

2017-05-11  Nathan Sidwell  <nathan@acm.org>

	* name-lookup.c (pushdecl_outermost_localscope): Always
	conditionally stop timer.

Index: name-lookup.c
===================================================================
--- name-lookup.c	(revision 247909)
+++ name-lookup.c	(working copy)
@@ -2874,19 +2874,17 @@  pushdecl_with_scope_1 (tree x, cp_bindin
 tree
 pushdecl_outermost_localscope (tree x)
 {
+  cp_binding_level *b = NULL;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
-  cp_binding_level *b  = NULL, *n = current_binding_level;
 
-  if (n->kind == sk_function_parms)
-    return error_mark_node;
-  do
-    {
-      b = n;
-      n = b->level_chain;
-    }
-  while (n->kind != sk_function_parms);
-  tree ret = pushdecl_with_scope_1 (x, b, false);
+  /* Find the scope just inside the function parms.  */
+  for (cp_binding_level *n = current_binding_level;
+       n->kind != sk_function_parms; n = b->level_chain)
+    b = n;
+
+  tree ret = b ? pushdecl_with_scope_1 (x, b, false) : error_mark_node;
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
+
   return ret;
 }