mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-02-06 18:01:05 +01:00
Modern compilers sometimes perform function tail merging and identical code folding, which consist in merging identical occurrences of same code paths, generally final ones (e.g. before a return, a jump or an unreachable statement). In the case of ABORT_NOW(), it can happen that the compiler merges all of them into a single one in a function, defeating the purpose of the check which initially was to figure where the bug occurred. Here we're creating a DO_NO_FOLD() macro which makes use of the line number and passes it as an integer argument to an empty asm() statement. The effect is a code position dependency which prevents the compiler from merging the code till that point (though it may still merge the following code). In practice it's efficient at stopping the compilers from merging calls to ha_crash_now(), which was the initial purpose. It may also be used to force certain optimization constructs since it gives more control to the developer.