]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix warnings about the use of `offsetof` on non-POD types 17463/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 May 2026 13:33:21 +0000 (15:33 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 May 2026 13:33:21 +0000 (15:33 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-lua-ffi.hh

index 8c58b4c4ba1d259711ab8ad4f71d1bfcf1fbc81e..ba98a8aa768d384d3031a78d6ac60fcc07308a4e 100644 (file)
@@ -61,6 +61,8 @@ struct dnsdist_ffi_dnsquestion_t
   {
   }
 
+  // these two fields (pointer to DNSQuestion, then objectType) should remain at the same offset
+  // here and in dnsdist_ffi_dnsresponse_t
   DNSQuestion* dq{nullptr};
   const dnsdist::lua::ffi::ObjectType objectType{dnsdist::lua::ffi::ObjectType::Question};
   ComboAddress maskedRemote;
@@ -103,6 +105,8 @@ struct dnsdist_ffi_dnsresponse_t
   {
   }
 
+  // these two fields (pointer to DNSResponse, then objectType) should remain at the same offset
+  // here and in dnsdist_ffi_dnsquestion_t
   DNSResponse* dr{nullptr};
   const dnsdist::lua::ffi::ObjectType objectType{dnsdist::lua::ffi::ObjectType::Response};
   std::optional<std::string> result{std::nullopt};
@@ -113,9 +117,6 @@ struct dnsdist_ffi_dnsresponse_t
 #endif /* DISABLE_PROTOBUF */
 };
 
-static_assert(offsetof(dnsdist_ffi_dnsresponse_t, dr) == offsetof(dnsdist_ffi_dnsquestion_t, dq), "The DNSQuestion object in dnsdist_ffi_dnsquestion_t and DNSResponse object in dnsdist_ffi_dnsresponse_t must be located at the same offset");
-static_assert(offsetof(dnsdist_ffi_dnsresponse_t, objectType) == offsetof(dnsdist_ffi_dnsquestion_t, objectType), "The object type in dnsdist_ffi_dnsquestion_t and dnsdist_ffi_dnsresponse_t must be located at the same offset");
-
 // dnsdist_ffi_server_t is a lightuserdata
 template <>
 struct LuaContext::Pusher<dnsdist_ffi_server_t*>