DINGUX: Only evaluate the toupper() macro argument once #3961
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.
There are currently some
tolower()
ortoupper()
calls where its argument has some side effects:The Dingux/OpenDingux port currently defines its own
toupper()
macro "to avoid triggering an assert in uClibc dingux library", but it currently does so this way:and so if
(c)
has side effects, they're going to happen more times than intended on this platform.Fixing the toupper()/tolower() callers is a solution, but sometimes the error comes back, so making a safer macro shouldn't hurt.
The following PR does so with a GCC statement expression. That's a GCC-ism by definition (clang also accepts it), but AFAICS this port is only ever built with GCC anyway, and we're already in the middle of a hack in a
DINGUX
ifdef.__extension__
should make-pedantic
happy.I don't have any device to test this, though. I see that there was some OpenDingux port activity in 2021.