From 58f3e191e81e27342c2afcd4e78ed62b9650d9de Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 12 May 2026 08:40:32 +0200 Subject: [PATCH] BUILD: compiler: fix redefinition of __nonstring Dmitry Sivachenko reported a build warning on FreeBSD -dev, where __nonstring is apparently already defined. Let's guard our own definition to avoid such issues. It could make sense to backport this to recent stable versions which may soon be exposed to modern compilers. --- include/haproxy/compiler.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index 608a668e6..3f7f3bc8e 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -583,10 +583,12 @@ * for such array declarations. But it's not the case for clang and other * compilers. */ -#if __has_attribute(nonstring) -#define __nonstring __attribute__ ((nonstring)) -#else -#define __nonstring +#ifndef __nonstring +# if __has_attribute(nonstring) +# define __nonstring __attribute__ ((nonstring)) +# else +# define __nonstring +# endif #endif #endif /* _HAPROXY_COMPILER_H */ -- 2.47.3