BUILD: compiler: fix __equals_1() on older compilers
It appeared that __has_attribute() doesn't work on gcc 4.4 and older
because the concatenation of __has_attribute##x isn't resolved as a one
before being passed to __equals_1() which immediately concatenates it to
comma_for_one. We first need to pass it through an extra layer to resolve
this name to a value. The new version was tested with gcc 4.2 to 11.3.
This may be backported though it's pretty minor.
diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h
index 5b9c668..3e00493 100644
--- a/include/haproxy/compiler.h
+++ b/include/haproxy/compiler.h
@@ -50,9 +50,10 @@
* second one.
*/
#define comma_for_one1 ,
-#define ____equals_1(x, y, ...) (y)
-#define ___equals_1(x, ...) ____equals_1(x, 0)
-#define __equals_1(x) ___equals_1(comma_for_one ## x 1)
+#define _____equals_1(x, y, ...) (y)
+#define ____equals_1(x, ...) _____equals_1(x, 0)
+#define ___equals_1(x) ____equals_1(comma_for_one ## x 1)
+#define __equals_1(x) ___equals_1(x)
/* gcc 5 and clang 3 brought __has_attribute(), which is not well documented in
* the case of gcc, but is convenient since handled at the preprocessor level.