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

Replace uses of cassert with Common/Assert.h #9621

Merged
merged 1 commit into from Apr 3, 2021

Conversation

Pokechu22
Copy link
Contributor

This replaces the standard library assert with Dolphin's ASSERT macro.

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).

@@ -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()));
Copy link
Contributor Author

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.

@Dentomologist
Copy link
Contributor

Dentomologist commented Apr 2, 2021

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.

@Pokechu22
Copy link
Contributor Author

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 CHECK defined).

@Dentomologist
Copy link
Contributor

Ah, I misunderstood what you were referring to in the PR.

@leoetlino leoetlino merged commit 6d1eb6a into dolphin-emu:master Apr 3, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants