[Ada] GNAT.Sockets: refactor Has_Sockaddr_Len

Use a field offset computation trick to avoid maintaining a list of
platforms.

2019-07-01  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

	* gsocket.h (Has_Sockaddr_Len): Use the offset of sin_family offset in
	the sockaddr_in structure to determine the existence of length field
	before the sin_family.

From-SVN: r272877
This commit is contained in:
Dmitriy Anisimkov 2019-07-01 13:37:16 +00:00 committed by Pierre-Marie de Rodat
parent d8f8b16648
commit a2902a6f23
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2019-07-01 Dmitriy Anisimkov <anisimko@adacore.com>
* gsocket.h (Has_Sockaddr_Len): Use the offset of sin_family offset in
the sockaddr_in structure to determine the existence of length field
before the sin_family.
2019-07-01 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Weak_External): Pragma only

View File

@ -185,6 +185,7 @@
#include <limits.h>
#include <errno.h>
#include <stddef.h>
#if defined (__vxworks) && ! defined (__RTP__)
#include <sys/times.h>
@ -252,12 +253,7 @@
# endif
#endif
#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__) \
|| defined (__DragonFly__) || defined (__NetBSD__) || defined (__OpenBSD__)
# define Has_Sockaddr_Len 1
#else
# define Has_Sockaddr_Len 0
#endif
# define Has_Sockaddr_Len (offsetof(struct sockaddr_in, sin_family) != 0)
#if !(defined (_WIN32) || defined (__hpux__) || defined (VMS))
# define HAVE_INET_PTON