Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: fix macOS warning #413

Merged
merged 2 commits into from
May 30, 2018
Merged

core: fix macOS warning #413

merged 2 commits into from
May 30, 2018

Conversation

julianoes
Copy link
Collaborator

Clang and MSVC are not agreeing on this issue, so we'll ignore
the clang warning for now.

// an implicit capture. However, this makes clang sad, so we have to
// ignore its warning.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-lambda-capture"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not doing that at the CMake level?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure whether to apply this everywhere. I was hoping it only ever comes up here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you want :).

As a principle, I don't like macros in the code, and I prefer to keep my code independent from the build system (as much as possible). But I'm fine with this as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convinced 😄

@JonasVautherin
Copy link
Collaborator

Note that you've changed it only for AppleClang, now (not sure if it is necessary for Clang, too).

@julianoes
Copy link
Collaborator Author

Note that you've changed it only for AppleClang, now (not sure if it is necessary for Clang, too).

You're right:

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
make
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
...
/home/julianoes/src/DroneCore/core/thread_pool_test.cpp:70:17: error: lambda capture 'first' is not required to be captured for this use
      [-Werror,-Wunused-lambda-capture]
    tp.enqueue([first, &second]() {
                ^

Clang and MSVC are not agreeing on this issue. MSVC complains about an
implicit capture while Clang says it's an unused lambda capture.
For now, we'll ignore the Clang warning.
@julianoes julianoes merged commit 4fec0ee into develop May 30, 2018
@julianoes julianoes deleted the fix-mac-warning branch May 30, 2018 18:29
rt-2pm2 pushed a commit to rt-2pm2/DronecodeSDK that referenced this pull request Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants