mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-04 19:19:33 +00:00
e1efd2a2d7
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. |
||
---|---|---|
.. | ||
haproxy | ||
import |