]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: compiler: fix redefinition of __nonstring
authorWilly Tarreau <w@1wt.eu>
Tue, 12 May 2026 06:40:32 +0000 (08:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 12 May 2026 06:40:32 +0000 (08:40 +0200)
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

index 608a668e6ef0e83460854495430c4bbba584baa6..3f7f3bc8ec3cfe9c24bff8582b41707222acaa56 100644 (file)
  * 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 */