net/dns: fix build on gcc 11
net/dns: fix build on gcc 11

gcc 11 has a false-positive warning (described in the gcc issue
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96003):

Seastar uses the c-ares API which uses traditional C-style callbacks:
The user gives a void* argument which is then passed to the callback
function. In our case, we take a C++ object, pass its address as this
argument, and then want the callback function to cast it back to an
object and call methods on this object.

The problem is that gcc 11 started to complain that this object pointer
may be a null pointer (the actual warning message is that it *is* a null
pointer, but that's just wrong). We know for a fact that it can't be
(we created this pointer from a valid object's address) but the compiler
doesn't know. Unfortunately trying to "convince" the compiler that the
address is not null (e.g., by adding an assert(p)) doesn't seem to work.

So the only way I found to change the compiler's mind is to disable this
warning (-Wnonnull) in dns.cc.

Fixes #914.

Signed-off-by: Nadav Har'El <625169824b719df98706d88646d0aae6f368ae4d@scylladb.com>
Message-Id: <20210615214501.38806-1-625169824b719df98706d88646d0aae6f368ae4d@scylladb.com>

cloudius-systems/seastar,syuu1228/seastar,avikivity/seastar,cloudius-systems/seastar,scylladb/seastar,avikivity/seastar,syuu1228/seastar,avikivity/seastar,scylladb/seastar,cloudius-systems/seastar,scylladb/seastar,syuu1228/seastar