]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compiler: always define __has_feature()
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Jun 2020 17:13:24 +0000 (19:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Jun 2020 17:13:24 +0000 (19:13 +0200)
This macro is provided by clang but gcc lacks it. Not having it makes
it painful to test features on both compilers. Better define it to zero
when not available so that __has_feature(foo) never errors.

include/haproxy/compiler.h

index ec9d4f393a7302bc12412dcc05f25c317ee1ece3..dbfcb62286100f3dc0e20036160f8742eac12a19 100644 (file)
 #define __decl_thread(decl)
 #endif
 
+/* clang has a __has_feature() macro which reports true/false on a number of
+ * internally supported features. Let's make sure this macro is always defined
+ * and returns zero when not supported.
+ */
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
 #endif /* _HAPROXY_COMPILER_H */