libcody as originally added to GCC fails 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


Okay to push?

Gerald


libcody/ChangeLog:

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

        * netclient.cc: Include <netinet/in.h>.
        * netserver.cc: Ditto.
---
 libcody/netclient.cc | 1 +
 libcody/netserver.cc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libcody/netclient.cc b/libcody/netclient.cc
index 8cccface71c..c97ed4ca126 100644
--- a/libcody/netclient.cc
+++ b/libcody/netclient.cc
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/un.h>
+#include <netinet/in.h>
 
 #ifndef AI_NUMERICSERV
 #define AI_NUMERICSERV 0
diff --git a/libcody/netserver.cc b/libcody/netserver.cc
index 7e43eb033f4..4e55089161e 100644
--- a/libcody/netserver.cc
+++ b/libcody/netserver.cc
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/un.h>
+#include <netinet/in.h>
 
 #ifndef AI_NUMERICSERV
 #define AI_NUMERICSERV 0
-- 
2.29.2

Reply via email to