Project

General

Profile

Bug #2179

best-route v2 test case: build error on OSX 10.9 with clang-500.2.79

Added by Junxiao Shi almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Forwarding
Target version:
Start date:
11/13/2014
Due date:
% Done:

100%

Estimated time:
0.50 h

Description

../tests/daemon/fw/best-route-strategy2.cpp:98:60: error: variable 'periodicalRetxFrom4' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
    retxFrom4Evt = scheduler::schedule(RETRANSMISSION_10P, periodicalRetxFrom4);
                                                           ^~~~~~~~~~~~~~~~~~~
1 error generated.

History

#1 Updated by Junxiao Shi almost 5 years ago

This appears only on our Mac Mini, but I'm afraid it would start appearing elsewhere.

#2 Updated by Alex Afanasyev almost 5 years ago

This error doesn't make sense for me. There is no "own initialization", unless there is some compiler optimization that creates such thing.

What if you try to replace capture with &, periodicalRetxFrom4 (to copy periodicalRetxFrom4, instead of taking reference). Would this make things better or worse?

#3 Updated by Junxiao Shi almost 5 years ago

The edit proposed in note-2 yields:

../tests/daemon/fw/best-route-strategy2.cpp:85:46: error: variable 'periodicalRetxFrom4' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
  function<void()> periodicalRetxFrom4 = [&, periodicalRetxFrom4] {
                   ~~~~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~
1 error generated.

I think scheduler should provide a periodical scheduling feature. It's useful for this test case and also #2056.

#4 Updated by Davide Pesavento almost 5 years ago

In fact, I think the error makes sense. Using capture-by-value as suggested is completely wrong here, you have to capture periodicalRetxFrom4 by reference, but with a small variation. Try this:

function<void()> periodicalRetxFrom4;
periodicalRetxFrom4 = [&] {
  ...
}

#5 Updated by Junxiao Shi almost 5 years ago

  • Status changed from New to In Progress

#6 Updated by Junxiao Shi almost 5 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 0 to 100

Solution in note-4 works.

http://gerrit.named-data.net/1432

#7 Updated by Junxiao Shi almost 5 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF