From 0e55cc962d8ee2666a2d990fd65dad1eb6129043 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 31 May 2018 16:26:39 +0200 Subject: [PATCH] Revert EDNS0Record to a trivial type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Adding brace initializers makes it non-trivial, which does not seem like a very good idea for a packed structure. gcc 8.1.0 complains with: ``` warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘struct EDNS0Record’ from an array of ‘uint32_t’ {aka ‘unsigned int’} [-Wclass-memaccess] memcpy(&stuff, &ttl, sizeof(stuff)); ``` --- pdns/dns.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/dns.hh b/pdns/dns.hh index dff9a80dfd..bb990dc6ac 100644 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@ -134,8 +134,8 @@ struct dnsrecordheader struct EDNS0Record { - uint8_t extRCode{0}, version{0}; - uint16_t extFlags{0}; + uint8_t extRCode, version; + uint16_t extFlags; } GCCPACKATTRIBUTE; static_assert(sizeof(EDNS0Record) == 4, "EDNS0Record size must be 4"); -- 2.47.2