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
Replace uses of cassert with Common/Assert.h #9621
Conversation
| @@ -696,7 +695,7 @@ bool VolumeVerifier::ShouldHaveChannelPartition() const | |||
| "RFNE01", "RFNJ01", "RFNK01", "RFNP01", "RFNW01", "RFPE01", "RFPJ01", "RFPK01", "RFPP01", | |||
| "RFPW01", "RGWE41", "RGWJ41", "RGWP41", "RGWX41", "RMCE01", "RMCJ01", "RMCK01", "RMCP01", | |||
| }; | |||
| assert(std::is_sorted(channel_discs.cbegin(), channel_discs.cend())); | |||
| DEBUG_ASSERT(std::is_sorted(channel_discs.cbegin(), channel_discs.cend())); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (along with ShouldBeDualLayer) is the only place where I used DEBUG_ASSERT, as this isn't an assertion that needs to be run in most cases. In C++20, is_sorted becomes constexpr, so it could be replaced with static_assert.
|
Removing the cassert in pch.h shouldn't be an issue; the externals don't depend on Dolphin, so anything that needs assert already includes it directly. I cleaned and rebuilt the VS solution to double check and it worked fine. There's one assert left in AudioCommon/PulseAudioStream.cpp and a handful in VideoCommon/TextureDecoder_x64.cpp, though the latter are all in inactive include guards. |
|
I'm pretty sure it would still build if cassert was removed from pch.h, but to my understanding the precompiled headers are used when building all projects (not just DolphinLib) in which case we'd still want cassert to be precompiled for faster build times. I've fixed the PulseAudioStream and TextureDecoder_x64 ones (and tested to make sure that it works with |
|
Ah, I misunderstood what you were referring to in the PR. |
This replaces the standard library
assertwith Dolphin'sASSERTmacro.I haven't changed any uses of cassert or assert.h in Externals, nor in pch (because the precompiled headers are used for externals, I'm pretty sure).