libcody: Include <netinet/in.h> as needed
authorGerald Pfeifer <gerald@pfeifer.com>
Sun, 20 Dec 2020 23:21:13 +0000 (00:21 +0100)
committerGerald Pfeifer <gerald@pfeifer.com>
Mon, 21 Dec 2020 16:11:43 +0000 (17:11 +0100)
libcody as originally added to GCC fail to build on *-unknown-freebsd11.4
and presumably others:

  c++ -std=c++11 -g -include config.h -I ... -MMD -MP -MF netclient.d -c
    -o netclient.o
  .../libcody/netclient.cc:114:3: error: unknown type sockaddr_in6 addr;
                                                      ^~~~~~~~~~~~

sockaddr_in6 is declared in /usr/include/netinet6/in6.h,
which is included by /usr/include/netinet/in.h.

Indeed, per https://man7.org/linux/man-pages/man7/ipv6.7.html

    #include <sys/socket.h>
    #include <netinet/in.h>

should be included, and our own gcc/ada/gsocket.h also has

    #if !(defined (VMS) || defined (__MINGW32__))
    #include <sys/socket.h>
    #include <sys/un.h>
    #include <netinet/in.h>
    :
    #endif

libcody/ChangeLog:

2020-12-21  Gerald Pfeifer  <gerald@pfeifer.com>

* netserver.cc: Include <netinet/in.h>.

libcody/netserver.cc

index 7e43eb033f47553c834af70de25e7bb6766d263a..30202c5106ab9dac6bb4394ed527d3e3b30a6a19 100644 (file)
@@ -12,6 +12,7 @@
 #include <netdb.h>
 #include <unistd.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #include <sys/un.h>
 
 #ifndef AI_NUMERICSERV