]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: bug: refine HA_LINK_ERROR() to only be used on gcc and derivatives
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Mar 2021 09:08:05 +0000 (10:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Mar 2021 09:09:43 +0000 (10:09 +0100)
TCC happens to define __OPTIMIZE__ at -O2 but doesn't proceed with dead
code elimination, resulting in ha_free() to always reference the link
error symbol. Let's condition this test on __GCC__ which others like
Clang also define.

include/haproxy/bug.h

index 57b7fc061c9cd037c9df71a743d8a316a2a01dd7..f5509c8f26a33fc7b742ce82299c9355eae0b278 100644 (file)
@@ -74,7 +74,7 @@
 #endif
 
 /* When not optimizing, clang won't remove that code, so only compile it in when optimizing */
-#ifdef __OPTIMIZE__
+#if defined(__GNUC__) && defined(__OPTIMIZE__)
 #define HA_LINK_ERROR(what)                                                  \
        do {                                                                 \
                /* provoke a build-time error */                             \