Project

General

Profile

Actions

Bug #2179

closed

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

Added by Junxiao Shi about 10 years ago. Updated about 10 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.
Actions #1

Updated by Junxiao Shi about 10 years ago

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

Actions #2

Updated by Alex Afanasyev about 10 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?

Actions #3

Updated by Junxiao Shi about 10 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.

Actions #4

Updated by Davide Pesavento about 10 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 = [&] {
  ...
}
Actions #5

Updated by Junxiao Shi about 10 years ago

  • Status changed from New to In Progress
Actions #6

Updated by Junxiao Shi about 10 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

Actions #7

Updated by Junxiao Shi about 10 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF