[master] d2540ce11 __containerof is already defined on bsd

Nils Goroll nils.goroll at uplex.de
Sat Jun 14 20:33:05 UTC 2025


commit d2540ce118d15362c0f3945ca0512eb87ba88f70
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Jun 14 22:31:53 2025 +0200

    __containerof is already defined on bsd

diff --git a/include/vdef.h b/include/vdef.h
index d71716c47..5c5b5325a 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -302,6 +302,7 @@ typedef struct {
  * assign pointer x to a local variable, to check that its type is
  * compatible with member m.
  */
+#ifndef __containerof
 #if __GNUC_PREREQ__(3, 1)
 #define __containerof(x, s, m) ({                                       \
         const volatile __typeof(((s *)0)->m) *__x = (x);                \
@@ -311,3 +312,4 @@ typedef struct {
 #define __containerof(x, s, m)                                          \
         __DEQUALIFY(s *, (const volatile char *)(x) - offsetof(s, m))
 #endif
+#endif


More information about the varnish-commit mailing list