Subject: | patches from core |
Compiling the extension with the core and gcc -Wall -Wextra on a system without ipv6. Patch attached.
Subject: | 0001-printf-type-matching-unused-vars-if-no-ipv6.patch |
From efcace730b4a9a127935e2e855bcef5571256e89 Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Fri, 5 Dec 2014 21:29:01 -0500
Subject: [PATCH] printf type-matching + unused vars if no ipv6.
---
cpan/Socket/Socket.xs | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/cpan/Socket/Socket.xs b/cpan/Socket/Socket.xs
index 31571bf..d9b88ce 100644
--- a/cpan/Socket/Socket.xs
+++ b/cpan/Socket/Socket.xs
@@ -635,10 +635,10 @@ inet_ntoa(ip_address_sv)
* so let's use this sprintf() workaround everywhere.
* This is also more threadsafe than using inet_ntoa(). */
ST(0) = sv_2mortal(Perl_newSVpvf(aTHX_ "%d.%d.%d.%d", /* IPv6? */
- ((addr.s_addr >> 24) & 0xFF),
- ((addr.s_addr >> 16) & 0xFF),
- ((addr.s_addr >> 8) & 0xFF),
- ( addr.s_addr & 0xFF)));
+ (int)((addr.s_addr >> 24) & 0xFF),
+ (int)((addr.s_addr >> 16) & 0xFF),
+ (int)((addr.s_addr >> 8) & 0xFF),
+ (int)( addr.s_addr & 0xFF)));
}
void
@@ -876,6 +876,8 @@ pack_sockaddr_in6(port, sin6_addr, scope_id=0, flowinfo=0)
# endif
ST(0) = sv_2mortal(newSVpvn((char *)&sin6, sizeof(sin6)));
#else
+ PERL_UNUSED_VAR(port);
+ PERL_UNUSED_VAR(sin6_addr);
ST(0) = (SV*)not_here("pack_sockaddr_in6");
#endif
}
@@ -914,6 +916,7 @@ unpack_sockaddr_in6(sin6_sv)
mPUSHs(ip_address_sv);
}
#else
+ PERL_UNUSED_VAR(sin6_sv);
ST(0) = (SV*)not_here("pack_sockaddr_in6");
#endif
}
@@ -973,6 +976,8 @@ inet_ntop(af, ip_address_sv)
ST(0) = sv_2mortal(newSVpvn(str, strlen(str)));
#else
+ PERL_UNUSED_VAR(af);
+ PERL_UNUSED_VAR(ip_address_sv);
ST(0) = (SV*)not_here("inet_ntop");
#endif
@@ -1015,6 +1020,8 @@ inet_pton(af, host)
sv_setpvn( ST(0), (char *)&ip_address, addrlen);
}
#else
+ PERL_UNUSED_VAR(af);
+ PERL_UNUSED_VAR(host);
ST(0) = (SV*)not_here("inet_pton");
#endif
@@ -1116,6 +1123,8 @@ pack_ip_mreq_source(multiaddr, source, interface=&PL_sv_undef)
mreq.imr_interface.s_addr = INADDR_ANY;
ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
#else
+ PERL_UNUSED_VAR(multiaddr);
+ PERL_UNUSED_VAR(source);
not_here("pack_ip_mreq_source");
#endif
}
@@ -1138,6 +1147,7 @@ unpack_ip_mreq_source(mreq_sv)
mPUSHp((char *)&mreq.imr_sourceaddr, sizeof(mreq.imr_sourceaddr));
mPUSHp((char *)&mreq.imr_interface, sizeof(mreq.imr_interface));
#else
+ PERL_UNUSED_VAR(mreq_sv);
not_here("unpack_ip_mreq_source");
#endif
}
@@ -1163,6 +1173,8 @@ pack_ipv6_mreq(multiaddr, ifindex)
mreq.ipv6mr_interface = ifindex;
ST(0) = sv_2mortal(newSVpvn((char *)&mreq, sizeof(mreq)));
#else
+ PERL_UNUSED_VAR(multiaddr);
+ PERL_UNUSED_VAR(ifindex);
not_here("pack_ipv6_mreq");
#endif
}
@@ -1184,6 +1196,7 @@ unpack_ipv6_mreq(mreq_sv)
mPUSHp((char *)&mreq.ipv6mr_multiaddr, sizeof(mreq.ipv6mr_multiaddr));
mPUSHi(mreq.ipv6mr_interface);
#else
+ PERL_UNUSED_VAR(mreq_sv);
not_here("unpack_ipv6_mreq");
#endif
}
--
2.1.2