BUILD: compiler: implement unreachable for older compilers too

Benoit Dolez reported that gcc-4.4 emits several "may be used
uninitialized" warnings around places where there are BUG_ON()
or ABORT_NOW(). The reason is that __builtin_unreachable() was
introduced in gcc-4.5 thus older ones do not know that the code
after such statements is not reachable.

This patch solves the problem by deplacing the statement with
an infinite loop on older versions. The compiler knows that the
code following it cannot be reached, and this is quite cheap
(2 to 4 bytes depending on architectures). It even reduces the
code size a little bit as the compiler doesn't have to optimize
for branches that do not exist.

This may be backported to older versions.

(cherry picked from commit 7d318ed8cc28f068c29309504f8dc6b2681addd8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 2229d18cd87d436ef170df6290d8378b9db9fe85)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit d1c54ae59e405453303b139764c037e836364103)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed