if test $lv_cv_gcc_pragma_push_works = no; then
dontwarn="$dontwarn -Wmissing-prototypes"
dontwarn="$dontwarn -Wmissing-declarations"
+ dontwarn="$dontwarn -Wcast-align"
fi
dnl Check whether strchr(s, char variable) causes a bogus compile
while (att[idx].name != NULL) {
prop = virXMLPropString(node, att[idx].name);
+ VIR_WARNINGS_NO_CAST_ALIGN
item = (nwItemDesc *)((char *)nwf + att[idx].dataIdx);
+ VIR_WARNINGS_RESET
flags = &item->flags;
flags_set = match_flag;
nwItemDesc *item;
while (att[i].name) {
+ VIR_WARNINGS_NO_CAST_ALIGN
item = (nwItemDesc *)((char *)def + att[i].dataIdx);
+ VIR_WARNINGS_RESET
enum virNWFilterEntryItemFlags flags = item->flags;
if ((flags & NWFILTER_ENTRY_ITEM_FLAG_EXISTS)) {
if (!typeShown) {
# endif
# endif /* __GNUC__ */
+
+# if __GNUC_PREREQ (4, 6)
+# define VIR_WARNINGS_NO_CAST_ALIGN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
+
+# define VIR_WARNINGS_RESET \
+ _Pragma ("GCC diagnostic pop")
+# else
+# define VIR_WARNINGS_NO_CAST_ALIGN
+# define VIR_WARNINGS_RESET
+# endif
+
/*
* Use this when passing possibly-NULL strings to printf-a-likes.
*/
/* go through the protocol headers */
switch (ntohs(pep->eh_type)) {
case ETHERTYPE_IP:
+ VIR_WARNINGS_NO_CAST_ALIGN;
pip = (struct iphdr *) pep->eh_data;
+ VIR_WARNINGS_RESET;
len -= offsetof(virNWFilterSnoopEthHdr, eh_data);
break;
default:
if (len < 0)
return -2;
+ VIR_WARNINGS_NO_CAST_ALIGN
pup = (struct udphdr *) ((char *) pip + (pip->ihl << 2));
+ VIR_WARNINGS_RESET
len -= pip->ihl << 2;
if (len < 0)
return -2;
case DHCP_OPT_BCASTADDRESS: /* Broadcast address */
if (dhcp_opts_len >= 6) {
+ VIR_WARNINGS_NO_CAST_ALIGN
uint32_t *tmp = (uint32_t *)&dhcpopt->value;
+ VIR_WARNINGS_RESET
(*bcastaddr) = ntohl(*tmp);
}
break;
if (etherType == ETHERTYPE_IP &&
(header.len >= ethHdrSize +
sizeof(struct iphdr))) {
+ VIR_WARNINGS_NO_CAST_ALIGN
struct iphdr *iphdr = (struct iphdr*)(packet +
ethHdrSize);
+ VIR_WARNINGS_RESET
vmaddr = iphdr->saddr;
/* skip mcast addresses (224.0.0.0 - 239.255.255.255),
* class E (240.0.0.0 - 255.255.255.255, includes eth.
} else if (etherType == ETHERTYPE_ARP &&
(header.len >= ethHdrSize +
sizeof(struct f_arphdr))) {
+ VIR_WARNINGS_NO_CAST_ALIGN
struct f_arphdr *arphdr = (struct f_arphdr*)(packet +
ethHdrSize);
+ VIR_WARNINGS_RESET
switch (ntohs(arphdr->arphdr.ar_op)) {
case ARPOP_REPLY:
vmaddr = arphdr->ar_sip;
if (etherType == ETHERTYPE_IP &&
(header.len >= ethHdrSize +
sizeof(struct iphdr))) {
+ VIR_WARNINGS_NO_CAST_ALIGN
struct iphdr *iphdr = (struct iphdr*)(packet +
ethHdrSize);
+ VIR_WARNINGS_RESET
if ((iphdr->protocol == IPPROTO_UDP) &&
(header.len >= ethHdrSize +
iphdr->ihl * 4 +
sizeof(struct udphdr))) {
+ VIR_WARNINGS_NO_CAST_ALIGN
struct udphdr *udphdr= (struct udphdr *)
((char *)iphdr + iphdr->ihl * 4);
+ VIR_WARNINGS_RESET
if (ntohs(udphdr->source) == 67 &&
ntohs(udphdr->dest) == 68 &&
header.len >= ethHdrSize +
/* Given the way libdevmapper returns its data, I don't see
* any way to avoid this series of casts. */
+ VIR_WARNINGS_NO_CAST_ALIGN
next = names->next;
names = (struct dm_names *)(((char *)names) + next);
+ VIR_WARNINGS_RESET
} while (next);