Fix building with clang.

This commit is contained in:
Vanilla I. Shu 2017-10-06 06:27:43 +00:00
parent ffd33f5a10
commit f3fe8e4041
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=451352
11 changed files with 153 additions and 5 deletions

View File

@ -18,11 +18,8 @@ USE_GITHUB= yes
GH_ACCOUNT= rumpkernel
GH_PROJECT= buildrump.sh
GH_TAGNAME= b914579
GH_TUPLE= rumpkernel:src-netbsd:82f3a69:netbsd/src
GH_TUPLE= rumpkernel:src-netbsd:82f3a69:netbsd/src
USE_LDCONFIG= yes
USE_GCC= any
.include <bsd.port.pre.mk>
do-build:
cd ${WRKSRC}; ${SETENV} CC=${CC} AR=${AR} NM=${NM} OBJCOPY=${OBJCOPY} ./buildrump.sh -r fullbuild
@ -30,4 +27,4 @@ do-build:
do-install:
cd ${WRKSRC}/rump; ${PAX} -wr lib include ${STAGEDIR}${PREFIX}/
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -0,0 +1,11 @@
--- src/share/mk/bsd.sys.mk.orig 2016-08-02 11:51:10 UTC
+++ src/share/mk/bsd.sys.mk
@@ -83,7 +83,7 @@ CFLAGS+= -Wreturn-type -Wswitch -Wshadow
.endif
.if ${WARNS} > 2
CFLAGS+= -Wcast-qual -Wwrite-strings
-CFLAGS+= -Wextra -Wno-unused-parameter
+CFLAGS+= -Wextra -Wno-unused-parameter -Wno-address-of-packed-member -Wno-varargs
# Readd -Wno-sign-compare to override -Wextra with clang
CFLAGS+= -Wno-sign-compare
CXXFLAGS+= -Wabi

View File

@ -0,0 +1,19 @@
--- src/sys/net/agr/if_agr.c.orig 2016-08-02 11:51:10 UTC
+++ src/sys/net/agr/if_agr.c
@@ -317,6 +317,7 @@ agr_clone_create(struct if_clone *ifc, i
{
struct agr_softc *sc;
struct ifnet *ifp;
+ int tmp = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
sc = agr_alloc_softc();
TAILQ_INIT(&sc->sc_ports);
@@ -330,7 +331,7 @@ agr_clone_create(struct if_clone *ifc, i
ifc->ifc_name, unit);
ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = tmp;
ifp->if_start = agr_start;
ifp->if_ioctl = agr_ioctl;
IFQ_SET_READY(&ifp->if_snd);

View File

@ -0,0 +1,12 @@
--- src/sys/net/if_gif.c.orig 2017-09-26 10:05:48 UTC
+++ src/sys/net/if_gif.c
@@ -192,7 +192,8 @@ gifattach0(struct gif_softc *sc)
sc->gif_if.if_addrlen = 0;
sc->gif_if.if_mtu = GIF_MTU;
- sc->gif_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
+ int tmp = IFF_POINTOPOINT | IFF_MULTICAST;
+ sc->gif_if.if_flags = tmp;
sc->gif_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE;
sc->gif_if.if_ioctl = gif_ioctl;
sc->gif_if.if_output = gif_output;

View File

@ -0,0 +1,18 @@
--- src/sys/net/if_loop.c.orig 2016-08-02 11:51:10 UTC
+++ src/sys/net/if_loop.c
@@ -150,13 +150,14 @@ static int
loop_clone_create(struct if_clone *ifc, int unit)
{
struct ifnet *ifp;
+ int tmp = IFF_LOOPBACK | IFF_MULTICAST | IFF_RUNNING;
ifp = if_alloc(IFT_LOOP);
if_initname(ifp, ifc->ifc_name, unit);
ifp->if_mtu = LOMTU;
- ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST | IFF_RUNNING;
+ ifp->if_flags = tmp;
ifp->if_extflags = IFEF_OUTPUT_MPSAFE;
ifp->if_ioctl = loioctl;
ifp->if_output = looutput;

View File

@ -0,0 +1,12 @@
--- src/sys/net/if_pppoe.c.orig 2017-09-26 10:07:00 UTC
+++ src/sys/net/if_pppoe.c
@@ -227,7 +227,8 @@ pppoe_clone_create(struct if_clone *ifc,
if_initname(&sc->sc_sppp.pp_if, "pppoe", unit);
sc->sc_sppp.pp_if.if_softc = sc;
sc->sc_sppp.pp_if.if_mtu = PPPOE_MAXMTU;
- sc->sc_sppp.pp_if.if_flags = IFF_SIMPLEX|IFF_POINTOPOINT|IFF_MULTICAST;
+ int tmp = IFF_SIMPLEX|IFF_POINTOPOINT|IFF_MULTICAST;
+ sc->sc_sppp.pp_if.if_flags = tmp;
sc->sc_sppp.pp_if.if_type = IFT_PPP;
sc->sc_sppp.pp_if.if_hdrlen = sizeof(struct ether_header) + PPPOE_HEADERLEN;
sc->sc_sppp.pp_if.if_dlt = DLT_PPP_ETHER;

View File

@ -0,0 +1,29 @@
--- src/sys/net/if_spppsubr.c.orig 2016-08-02 11:51:10 UTC
+++ src/sys/net/if_spppsubr.c
@@ -3185,7 +3185,7 @@ sppp_ipcp_scr(struct sppp *sp)
#ifdef notyet
if (sp->ipcp.opts & (1 << IPCP_OPT_COMPRESSION)) {
- opt[i++] = IPCP_OPT_COMPRESSION;
+ opt[i++] = (char)IPCP_OPT_COMPRESSION;
opt[i++] = 6;
opt[i++] = 0; /* VJ header compression */
opt[i++] = 0x2d; /* VJ header compression */
@@ -3210,7 +3210,7 @@ sppp_ipcp_scr(struct sppp *sp)
#endif
if (sp->query_dns & 1) {
- opt[i++] = IPCP_OPT_PRIMDNS;
+ opt[i++] = (char)IPCP_OPT_PRIMDNS;
opt[i++] = 6;
opt[i++] = sp->dns_addrs[0] >> 24;
opt[i++] = sp->dns_addrs[0] >> 16;
@@ -3218,7 +3218,7 @@ sppp_ipcp_scr(struct sppp *sp)
opt[i++] = sp->dns_addrs[0];
}
if (sp->query_dns & 2) {
- opt[i++] = IPCP_OPT_SECDNS;
+ opt[i++] = (char)IPCP_OPT_SECDNS;
opt[i++] = 6;
opt[i++] = sp->dns_addrs[1] >> 24;
opt[i++] = sp->dns_addrs[1] >> 16;

View File

@ -0,0 +1,12 @@
--- src/sys/net/if_tap.c.orig 2017-09-26 10:11:03 UTC
+++ src/sys/net/if_tap.c
@@ -332,7 +332,8 @@ tap_attach(device_t parent, device_t sel
ifp = &sc->sc_ec.ec_if;
strcpy(ifp->if_xname, device_xname(self));
ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ int tmp = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = tmp;
ifp->if_ioctl = tap_ioctl;
ifp->if_start = tap_start;
ifp->if_stop = tap_stop;

View File

@ -0,0 +1,14 @@
--- src/sys/netinet/in_offload.c.orig 2016-08-02 11:51:10 UTC
+++ src/sys/netinet/in_offload.c
@@ -210,9 +210,10 @@ ip_undefer_csum(struct mbuf *m, size_t h
if (__predict_true(hdrlen + sizeof(struct ip) <= m->m_len)) {
struct ip *ip = (struct ip *)(mtod(m, uint8_t *) + hdrlen);
+ short tmp = ip->ip_sum;
ip_len = ip->ip_len;
- csump = &ip->ip_sum;
+ csump = &tmp;
} else {
const size_t ip_len_offset =
hdrlen + offsetof(struct ip, ip_len);

View File

@ -0,0 +1,12 @@
--- src/sys/netinet/ip_carp.c.orig 2017-09-26 10:03:06 UTC
+++ src/sys/netinet/ip_carp.c
@@ -827,7 +827,8 @@ carp_clone_create(struct if_clone *ifc,
ifp->if_softc = sc;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "%s%d", ifc->ifc_name,
unit);
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ int tmp = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = tmp;
ifp->if_ioctl = carp_ioctl;
ifp->if_start = carp_start;
ifp->if_output = carp_output;

View File

@ -0,0 +1,12 @@
--- src/sys/rump/net/lib/libshmif/if_shmem.c.orig 2017-09-26 10:09:42 UTC
+++ src/sys/rump/net/lib/libshmif/if_shmem.c
@@ -176,7 +176,8 @@ allocif(int unit, struct shmif_sc **scp)
snprintf(ifp->if_xname, sizeof(ifp->if_xname), "shmif%d", unit);
ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ int tmp = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+ ifp->if_flags = tmp;
ifp->if_init = shmif_init;
ifp->if_ioctl = shmif_ioctl;
ifp->if_start = shmif_start;