莫名奇妙的 -Wunused-but-set-variable 误报
本帖最后由 polejo 于 2014-12-25 17:38 编辑static unsigned int
ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out)
{
unsigned int ret;
struct in6_addr saddr, daddr;
u_int8_t hop_limit;
u_int32_t flowlabel, mark;
/* save source/dest address, mark, hoplimit, flowlabel, priority,*/
memcpy(&saddr, &ipv6_hdr(skb)->saddr, sizeof(saddr));
memcpy(&daddr, &ipv6_hdr(skb)->daddr, sizeof(daddr));
mark = skb->mark;
hop_limit = ipv6_hdr(skb)->hop_limit;
/* flowlabel and prio (includes version, which shouldn't change either */
flowlabel = *((u_int32_t *)ipv6_hdr(skb));
ret = ip6t_do_table(skb, NF_INET_LOCAL_OUT, NULL, out,
dev_net(out)->ipv6.ip6table_mangle);
if (ret != NF_DROP && ret != NF_STOLEN &&
(memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr)) ||
memcmp(&ipv6_hdr(skb)->daddr, &daddr, sizeof(daddr)) ||
skb->mark != mark ||
ipv6_hdr(skb)->hop_limit != hop_limit))
return ip6_route_me_harder(skb) == 0 ? ret : NF_DROP;
return ret;
}编译结果
CC net/ipv6/netfilter/ip6table_mangle.o
net/ipv6/netfilter/ip6table_mangle.c: In function 'ip6t_mangle_out':
net/ipv6/netfilter/ip6table_mangle.c:39:12: warning: variable 'flowlabel' set but not used [-Wunused-but-set-variable]
u_int32_t flowlabel, mark;
明明flowlabel已经use了,为什么编译还会提示这个,实际上我的内核编译时有非常多这个告警,都属于这种情况?莫名其妙啊
########@@@@@@########## KBUILD_CFLAGS = -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -I. -DBCMDRIVER -Dlinux -O2-ffreestanding -fno-dwarf2-cfi-asm -mabi=apcs-gnu -msoft-float -Uarm -ggdb -fomit-frame-pointer
########@@@@@@########## HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
########@@@@@@########## CFLAGS =
########@@@@@@########## EXTRA_CFLAGS =
页:
[1]