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

Prevent unused variable warning using jassert in release #920

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/juce_core/system/juce_PlatformDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace juce
#if JUCE_LOG_ASSERTIONS
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON (if (! (expression)) jassertfalse;)
#else
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( ; )
#define jassert(expression) JUCE_BLOCK_WITH_FORCED_SEMICOLON ( [[maybe_unused]] constexpr bool jassert_unused = false && (expression); )
Copy link

Choose a reason for hiding this comment

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

Is there a reason to prefer [[maybe_unused]] over juce::ignoreUnused (which has wider C++ support)?

Copy link
Author

Choose a reason for hiding this comment

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

Doesn't JUCE basically require c++11 anyways? Given that, I don't think it should matter.

Copy link

Choose a reason for hiding this comment

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

Doesn't JUCE basically require c++11 anyways? Given that, I don't think it should matter.

A short google search indicates that this might be a C++17 feature

Copy link
Author

Choose a reason for hiding this comment

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

Wow, you're right! I've been using it for so many years already that I must have forgotten we haven't had it since 11. Anyways, I think this PR is superfluous now that 46e62b9 is available.

#endif

#endif
Expand Down