X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Fasync_netdb.h;h=a72f4d599d3aef8962482d3168a47e9d6848b138;hp=df6c59c63534081cb8925cea59e196a447505c67;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hpb=88cfe534a698a0562e81345957a50714af1453bc diff --git a/utils/async_netdb.h b/utils/async_netdb.h index df6c59c6..a72f4d59 100644 --- a/utils/async_netdb.h +++ b/utils/async_netdb.h @@ -53,13 +53,25 @@ #if ASYNC_NETDB_USE_GAI -typedef struct sockaddr_storage async_netdb_sockaddr_storage_t; +/* Without using union, gcc-6 warns for + breaking strict aliasing rules + */ +typedef union { + struct sockaddr_storage x_sockaddr_storage; + struct sockaddr_in x_sockaddr_in; + struct sockaddr_in6 x_sockaddr_in6; +} async_netdb_sockaddr_storage_t; int _async_netdb_is_done (struct io_thread *io); #else -typedef struct sockaddr_in async_netdb_sockaddr_storage_t; +/* Because the definition for the above case is now union, + the definition for this case must also be union... +*/ +typedef union { + struct sockaddr_in x_sockaddr_in; +} async_netdb_sockaddr_storage_t; # ifndef EAI_SYSTEM /* The EAI_* codes are specified specifically as preprocessor macros, so