-
Notifications
You must be signed in to change notification settings - Fork 394
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
Change TR_ASSERT_FATAL to static_assert in TR_AliasSetInterface #4933
Comments
Hi! I'm starting off contributing to open source. Can I check this? |
@PaulinaQuintero sure, we're always happy to accept new contributions! Feel free to open up a PR if you wish to tackle this one. |
Those port library test failures are unrelated to your change (I suspect they will fail without your change too). It should be safe for you to re-open your PR. When the CI tests run, we can verify that those failures are not your problem. |
This patch elimates use of TR_ASSERT_FATAL to static assert in AliasSetInterface.hpp Issue: eclipse#4933
Replace some uses of TR_ASSERT_FATAL with static_assert in AliasSetInterface.hpp Issue: eclipse#4933
Replace some uses of TR_ASSERT_FATAL with static_assert in AliasSetInterface.hpp Issue: eclipse#4933
Replace some uses of TR_ASSERT_FATAL with static_assert in AliasSetInterface.hpp Issue: eclipse#4933
There are some instances of
TR_ASSERT_FATAL
inTR_AliasSetInterface
[1,2,3] that should really bestatic_asserts
._AliasSetInterface
is a template parameter so its value is known at compile time. Therefore,_AliasSetInterface == UseDefAliasSet || _AliasSetInterface == UseOnlyAliasSet
can also be checked at compile time.Note: the
AliasSetInterface
enum only hasUseDefAliasSet
andUseOnlyAliasSet
as variants, so_AliasSetInterface == UseDefAliasSet || _AliasSetInterface == UseOnlyAliasSet
may seem like a tautology. Unfortunatly, C++ allows casting arbitraty integers values to enum types, so it's possible to have code likeTR_AliastSetInterface<(AliasSetInterface)42>
. As a result, checking that the value of_AliasSetInterface
makes sense is still a good idea.[1]
omr/compiler/il/AliasSetInterface.hpp
Line 259 in 5384dad
[2]
omr/compiler/il/AliasSetInterface.hpp
Line 277 in 5384dad
[3]
omr/compiler/il/AliasSetInterface.hpp
Line 360 in 5384dad
The text was updated successfully, but these errors were encountered: