mirror of https://github.com/ipxe/ipxe.git
[build] Avoid strict-aliasing warnings when building with gcc 4.4
Conventional usage of the various struct sockaddr_xxx types involves liberal use of casting, which tends to trigger strict-aliasing warnings from gcc. Avoid these now and in future by marking all the relevant types with __attribute__((may_alias)).pull/1/head
parent
21cfab4fb8
commit
85e5e25c52
|
@ -71,7 +71,7 @@ struct sockaddr_in {
|
||||||
char pad[ sizeof ( struct sockaddr ) - sizeof ( sa_family_t )
|
char pad[ sizeof ( struct sockaddr ) - sizeof ( sa_family_t )
|
||||||
- sizeof ( uint16_t )
|
- sizeof ( uint16_t )
|
||||||
- sizeof ( struct in_addr ) ];
|
- sizeof ( struct in_addr ) ];
|
||||||
};
|
} __attribute__ (( may_alias ));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IPv6 socket address
|
* IPv6 socket address
|
||||||
|
@ -87,7 +87,7 @@ struct sockaddr_in6 {
|
||||||
uint32_t sin6_flowinfo; /* Flow number */
|
uint32_t sin6_flowinfo; /* Flow number */
|
||||||
struct in6_addr sin6_addr; /* 128-bit destination address */
|
struct in6_addr sin6_addr; /* 128-bit destination address */
|
||||||
uint32_t sin6_scope_id; /* Scope ID */
|
uint32_t sin6_scope_id; /* Scope ID */
|
||||||
};
|
} __attribute__ (( may_alias ));
|
||||||
|
|
||||||
extern int inet_aton ( const char *cp, struct in_addr *inp );
|
extern int inet_aton ( const char *cp, struct in_addr *inp );
|
||||||
extern char * inet_ntoa ( struct in_addr in );
|
extern char * inet_ntoa ( struct in_addr in );
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <gpxe/tables.h>
|
#include <gpxe/tables.h>
|
||||||
|
#include <gpxe/socket.h>
|
||||||
|
|
||||||
struct xfer_interface;
|
struct xfer_interface;
|
||||||
struct uri;
|
struct uri;
|
||||||
struct sockaddr;
|
|
||||||
|
|
||||||
/** Location types */
|
/** Location types */
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include <gpxe/refcnt.h>
|
#include <gpxe/refcnt.h>
|
||||||
#include <gpxe/interface.h>
|
#include <gpxe/interface.h>
|
||||||
#include <gpxe/tables.h>
|
#include <gpxe/tables.h>
|
||||||
|
#include <gpxe/socket.h>
|
||||||
|
|
||||||
struct sockaddr;
|
|
||||||
struct resolv_interface;
|
struct resolv_interface;
|
||||||
|
|
||||||
/** Name resolution interface operations */
|
/** Name resolution interface operations */
|
||||||
|
|
|
@ -94,6 +94,6 @@ struct sockaddr {
|
||||||
* family.
|
* family.
|
||||||
*/
|
*/
|
||||||
char pad[ SA_LEN - sizeof ( sa_family_t ) ];
|
char pad[ SA_LEN - sizeof ( sa_family_t ) ];
|
||||||
};
|
} __attribute__ (( may_alias ));
|
||||||
|
|
||||||
#endif /* _GPXE_SOCKET_H */
|
#endif /* _GPXE_SOCKET_H */
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct sockaddr_tcpip {
|
||||||
*/
|
*/
|
||||||
char pad[ sizeof ( struct sockaddr ) -
|
char pad[ sizeof ( struct sockaddr ) -
|
||||||
( sizeof ( sa_family_t ) + sizeof ( uint16_t ) ) ];
|
( sizeof ( sa_family_t ) + sizeof ( uint16_t ) ) ];
|
||||||
};
|
} __attribute__ (( may_alias ));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A transport-layer protocol of the TCP/IP stack (eg. UDP, TCP, etc)
|
* A transport-layer protocol of the TCP/IP stack (eg. UDP, TCP, etc)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <gpxe/if_ether.h>
|
#include <gpxe/if_ether.h>
|
||||||
|
|
||||||
struct xfer_interface;
|
struct xfer_interface;
|
||||||
struct sockaddr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDP constants
|
* UDP constants
|
||||||
|
|
Loading…
Reference in New Issue