haproxy/include
Willy Tarreau e1efd2a2d7 BUILD: sched: workaround crazy and dangerous warning in Clang 14
Ilya reported in issue #1638 that Clang 14 has invented a new warning
that encourages to modify the code in a way that is not always
equivalent, by turning "|" to "||" between some logical operators,
except that the first one guarantees that all members of the expression
will always be evaluated while the latter will stop at the first one
which is true!

This warning triggers in thread_has_tasks(), which is not sensitive to
such change of behavior but which is built this way because it results
in branchless code for something that most often evaluates to false for
all terms. As such it was out of question to turn this to less efficient
compare-and-jump that needlessly pollute the branch predictor, so the
workaround consists in casting each expression to (int). It was verified
that the code is the same.

Yet another example of how-to-introduce-bugs-by-fixing-valid-code
through warnings invented around a beer without thinking longer!

This may need to be backported to a few older branches in case this
compiler lands in recent distros or if gcc finds it wise to imitate it.
2022-04-14 15:11:12 +02:00
..
haproxy BUILD: sched: workaround crazy and dangerous warning in Clang 14 2022-04-14 15:11:12 +02:00
import CLEANUP: tree-wide: remove a few rare non-ASCII chars 2022-03-04 08:58:32 +01:00