From 6d4c81db96ed28449cd2f753570830e21ace8fb9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 16 Jun 2020 19:13:24 +0200 Subject: [PATCH] MINOR: compiler: always define __has_feature() 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index ec9d4f393..dbfcb6228 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -243,4 +243,12 @@ #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 */