#5591 closed defect (fixed)

Eliminate unused-lambda-capture warnings

Reported by: marcin Owned by: fdupont
Priority: medium Milestone: Kea1.4-final
Component: build system Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0.5
Total Hours: 0 Internal?: no

Description

We have quite a few places where the compilers complain about the unused lambda capture of "this":
One example:

shared_network_unittest.cc:2458:19: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    testAssigned([this, &client2] {

Subtickets

Change History (13)

comment:1 follow-up: Changed 15 months ago by fdupont

I added this comment about the captured object by a closure (does not matter if it is by a bind template or a lambda):

// The closure captures either a shared pointer (memory leak)
// or a raw pointer (pointing to a deleted object).

so I join you and the compiler saying that unused captures must fix.
BTW can you give more details on compiler/system (or better Jenkins project)?

comment:2 in reply to: ↑ 1 Changed 15 months ago by marcin

Replying to fdupont:

I added this comment about the captured object by a closure (does not matter if it is by a bind template or a lambda):

// The closure captures either a shared pointer (memory leak)
// or a raw pointer (pointing to a deleted object).

so I join you and the compiler saying that unused captures must fix.
BTW can you give more details on compiler/system (or better Jenkins project)?

I am seeing it on macOS 10.13.4 with clang Apple LLVM version 9.1.0 (clang-902.0.39.1).

comment:3 Changed 14 months ago by fdupont

  • Owner set to fdupont
  • Status changed from new to accepted

comment:4 Changed 14 months ago by fdupont

  • Resolution set to wontfix
  • Status changed from accepted to closed

comment:5 Changed 14 months ago by fdupont

  • Resolution wontfix deleted
  • Status changed from closed to reopened

comment:6 Changed 14 months ago by fdupont

  • Add Hours to Ticket changed from 0 to 0.5
  • Owner changed from fdupont to UnAssigned
  • Status changed from reopened to reviewing

Done. Ready for review (BTW these bugs block with-werror on up-to-date macOS).

comment:7 Changed 14 months ago by fdupont

Was classified for 1.4-final low but as it is ready and really convenient for macOS users (so including me) I propose to reclassify it to 1.4.

comment:8 follow-up: Changed 14 months ago by tomek

We will not deal with this ticket until all tickets planned for 1.4 and 1.4-final (medium or high) are done.

Francis, you can't simply ignore what we all agreed and do as you please. Sorry.

comment:9 in reply to: ↑ 8 Changed 14 months ago by fdupont

Replying to tomek:

We will not deal with this ticket until all tickets planned for 1.4 and 1.4-final (medium or high) are done.

Francis, you can't simply ignore what we all agreed and do as you please. Sorry.

=> I just need the patch to apply it each time I compile something on my box... Now you can defer the review and merge as I have what I need (BTW I applied again the patch a few minutes ago :-).

comment:10 Changed 14 months ago by tomek

  • Milestone changed from Kea-proposed to Kea1.4-final

This is just a compilation warning. This kind of fixes are appropriate for final. Moving to 1.4-final as previously agreed on Kea call.

comment:11 Changed 13 months ago by marcin

  • Owner changed from UnAssigned to marcin

comment:12 Changed 13 months ago by marcin

  • Owner changed from marcin to fdupont

The code changes look good. Compiling on my mac did not reveal any lambda/this specific warnings so it can be merged. However, I'd provide a changelog entry for this change.

comment:13 Changed 13 months ago by fdupont

  • Resolution set to fixed
  • Status changed from reviewing to closed

Merged with a ChangeLog entry. Closing.

Note: See TracTickets for help on using tickets.