* [PATCH] Fix userspace compilation of ip_tables.h/ip6_tables.h in C++ mode
@ 2012-09-30 23:17 Jason Gunthorpe
2012-10-01 4:45 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2012-09-30 23:17 UTC (permalink / raw)
To: linux-kernel, netdev
The implicit cast from void * is not allowed for C++ compilers, and the
arithmetic on void * generates warnings in C++ mode.
$ g++ -c t.cc
ip_tables.h:221:24: warning: pointer of type 'void *' used in arithmetic
ip_tables.h:221:24: error: invalid conversion from 'void*' to 'xt_entry_target*'
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
include/linux/netfilter_ipv4/ip_tables.h | 2 +-
include/linux/netfilter_ipv6/ip6_tables.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index db79231..050ad8a 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -226,7 +226,7 @@ struct ipt_get_entries {
static __inline__ struct xt_entry_target *
ipt_get_target(struct ipt_entry *e)
{
- return (void *)e + e->target_offset;
+ return (struct xt_entry_target *)((__u8 *)e + e->target_offset);
}
/*
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 08c2cbb..3349bf1 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -263,7 +263,7 @@ struct ip6t_get_entries {
static __inline__ struct xt_entry_target *
ip6t_get_target(struct ip6t_entry *e)
{
- return (void *)e + e->target_offset;
+ return (struct xt_entry_target *)((__u8 *)e + e->target_offset);
}
/*
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix userspace compilation of ip_tables.h/ip6_tables.h in C++ mode
2012-09-30 23:17 [PATCH] Fix userspace compilation of ip_tables.h/ip6_tables.h in C++ mode Jason Gunthorpe
@ 2012-10-01 4:45 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-10-01 4:45 UTC (permalink / raw)
To: jgunthorpe; +Cc: linux-kernel, netdev
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date: Sun, 30 Sep 2012 17:17:37 -0600
> The implicit cast from void * is not allowed for C++ compilers, and the
> arithmetic on void * generates warnings in C++ mode.
>
> $ g++ -c t.cc
> ip_tables.h:221:24: warning: pointer of type 'void *' used in arithmetic
> ip_tables.h:221:24: error: invalid conversion from 'void*' to 'xt_entry_target*'
>
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Please post netfilter patches to netfilter-devel@vger.kernel.org
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-01 4:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 23:17 [PATCH] Fix userspace compilation of ip_tables.h/ip6_tables.h in C++ mode Jason Gunthorpe
2012-10-01 4:45 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).