mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-28 23:20:59 +01:00
When the strict level is zero and BUG_ON() is not implemented, some possible null-deref warnings are emitted again because some were covering for these cases. Let's make it fall back to ASSUME() so that the compiler continues to know that the tested expression never happens. It also allows to further optimize certain functions by helping the compiler eliminate certain tests for impossible values. However it requires that the expression is really evaluated before passing the result through ASSUME() otherwise it was shown that gcc-11 and above will fail to evaluate its implications and will continue to emit the null-deref warnings in case the expression is non-trivial (e.g. it has multiple terms). We don't do it for BUG_ON_HOT() however because the extra cost of evaluating the condition is generally not welcome in fast paths, particularly when that BUG_ON_HOT() was kept disabled for performance reasons.