Merged
Conversation
Variadic macros always expect at least one argument. Consequently, when one wants to declare a macro that takes a formatting string and an optional list of varibles then one cannot declare the formatting string itself as a separate argument to the function. In the newly introduced integer comparison functions we do exactly that though. Consequently, all callers must pass at least one variable to the formatting string, even if they don't want to use any formatting in the first place. Fix this by dropping the explicit formatting string parameter. Add tests to catch this issue going forward.
The `cl_assert_eq_i()` function has been newly introduced with the typesafe integer comparison functions. This function and its cousin `cl_assert_eq_i_()` are so similar to the preexisting functions `cl_assert_equal_i()` and `cl_assert_equal_i_()` to cause some confusion. The only difference is the exact output format. So let's merge those two and drop the newly introduced functions again. Also rename equivalent functions for unsigned integers to match.
The error message that we use for all the integer comparison functions is repeated for every macro. This was done because we reused the same infra for both deprecated comparison functions (`cl_assert_equal_i()`) and the new replacements (`cl_assert_eq_i()`), and the resulting error messages are expected to be different there. That has changed in the preceding commit though, where we started to open-code the deprecated functions. Consequently, we can now deduplicate the error message for the new comparison functions. Do so.
Same as with a preceding comimt we also have double evaluation of arguments in the newly introduced integer comparison macros. Fix this issue by storing the values in a local variable first.
55dd71a to
db09c85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #117 we have introduced type-safe wrappers for integer comparison functions. This wrapper introduces an issue though where arguments are getting evaluated twice now. This PR here fixes that bug.