mirror of
https://github.com/ipxe/ipxe
synced 2026-01-01 00:07:27 +03:00
[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)).
This commit is contained in:
@@ -71,7 +71,7 @@ struct sockaddr_in {
|
||||
char pad[ sizeof ( struct sockaddr ) - sizeof ( sa_family_t )
|
||||
- sizeof ( uint16_t )
|
||||
- sizeof ( struct in_addr ) ];
|
||||
};
|
||||
} __attribute__ (( may_alias ));
|
||||
|
||||
/**
|
||||
* IPv6 socket address
|
||||
@@ -87,7 +87,7 @@ struct sockaddr_in6 {
|
||||
uint32_t sin6_flowinfo; /* Flow number */
|
||||
struct in6_addr sin6_addr; /* 128-bit destination address */
|
||||
uint32_t sin6_scope_id; /* Scope ID */
|
||||
};
|
||||
} __attribute__ (( may_alias ));
|
||||
|
||||
extern int inet_aton ( const char *cp, struct in_addr *inp );
|
||||
extern char * inet_ntoa ( struct in_addr in );
|
||||
|
||||
Reference in New Issue
Block a user