All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mbuf & mempool: explicit typecast on function return
@ 2015-08-12  9:11 Sergey Balabanov
  2015-08-17  8:14 ` Olivier MATZ
  0 siblings, 1 reply; 5+ messages in thread
From: Sergey Balabanov @ 2015-08-12  9:11 UTC (permalink / raw)
  To: dev

When DPDK is being compiled in C++ project using g++ then
'invalid conversion from' error appears. Added explicit
typecast on function return to get rid of the error.

Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
---
 lib/librte_mbuf/rte_mbuf.h       | 2 +-
 lib/librte_mempool/rte_mempool.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index c3b8c98..8c2db1b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -882,7 +882,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
 static inline struct rte_mbuf *
 rte_mbuf_from_indirect(struct rte_mbuf *mi)
 {
-	return RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
+	return (struct rte_mbuf *)RTE_PTR_SUB(mi->buf_addr, sizeof(*mi) + mi->priv_size);
 }
 
 /**
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 075bcdf..8abeca9 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -268,7 +268,7 @@ struct rte_mempool {
 /* return the header of a mempool object (internal) */
 static inline struct rte_mempool_objhdr *__mempool_get_header(void *obj)
 {
-	return RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));
+	return (struct rte_mempool_objhdr *)RTE_PTR_SUB(obj, sizeof(struct rte_mempool_objhdr));
 }
 
 /**
@@ -290,7 +290,7 @@ static inline struct rte_mempool *rte_mempool_from_obj(void *obj)
 static inline struct rte_mempool_objtlr *__mempool_get_trailer(void *obj)
 {
 	struct rte_mempool *mp = rte_mempool_from_obj(obj);
-	return RTE_PTR_ADD(obj, mp->elt_size);
+	return (struct rte_mempool_objtlr *)RTE_PTR_ADD(obj, mp->elt_size);
 }
 
 /**
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mbuf & mempool: explicit typecast on function return
  2015-08-12  9:11 [PATCH] mbuf & mempool: explicit typecast on function return Sergey Balabanov
@ 2015-08-17  8:14 ` Olivier MATZ
  2015-08-17 12:28   ` Joongi Kim
  2015-08-17 15:38   ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Olivier MATZ @ 2015-08-17  8:14 UTC (permalink / raw)
  To: Sergey Balabanov, dev

Hi Sergey,

On 08/12/2015 11:11 AM, Sergey Balabanov wrote:
> When DPDK is being compiled in C++ project using g++ then
> 'invalid conversion from' error appears. Added explicit
> typecast on function return to get rid of the error.
> 
> Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>


Fixes: 7755baae8378 ("mbuf: silence warning on pointer arithmetic")
Fixes: 6cf14ce4ce6c ("mempool: silence warning on pointer arithmetic")

Acked-by: Olivier Matz <olivier.matz@6wind.com>

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mbuf & mempool: explicit typecast on function return
  2015-08-17  8:14 ` Olivier MATZ
@ 2015-08-17 12:28   ` Joongi Kim
  2015-08-17 12:50     ` Olivier MATZ
  2015-08-17 15:38   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Joongi Kim @ 2015-08-17 12:28 UTC (permalink / raw)
  To: Olivier MATZ, Sergey Balabanov, dev

I already have fixed this issue at http://dpdk.org/dev/patchwork/patch/6068/
 .
There is another issue related to "underlying type" for enum declarations
http://dpdk.org/dev/patchwork/patch/6067/, for C++11 compilers.

In the second patch I missed updating headers for architectures other than
x86,
so it needs to be updated before applying to the master branch.

It would be great for me to have this fixed on the master branch,
as I am manually applying above patches whenever I pull the latest codes.

Regards,
Joongi

2015년 8월 17일 (월) 오후 5:15, Olivier MATZ <olivier.matz@6wind.com>님이 작성:

> Hi Sergey,
>
> On 08/12/2015 11:11 AM, Sergey Balabanov wrote:
> > When DPDK is being compiled in C++ project using g++ then
> > 'invalid conversion from' error appears. Added explicit
> > typecast on function return to get rid of the error.
> >
> > Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
>
>
> Fixes: 7755baae8378 ("mbuf: silence warning on pointer arithmetic")
> Fixes: 6cf14ce4ce6c ("mempool: silence warning on pointer arithmetic")
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
>
> Thanks
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mbuf & mempool: explicit typecast on function return
  2015-08-17 12:28   ` Joongi Kim
@ 2015-08-17 12:50     ` Olivier MATZ
  0 siblings, 0 replies; 5+ messages in thread
From: Olivier MATZ @ 2015-08-17 12:50 UTC (permalink / raw)
  To: Joongi Kim, Sergey Balabanov, dev

Hi Joongi,

On 08/17/2015 02:28 PM, Joongi Kim wrote:
> I already have fixed this issue
> at http://dpdk.org/dev/patchwork/patch/6068/ .
> There is another issue related to "underlying type" for enum
> declarations http://dpdk.org/dev/patchwork/patch/6067/, for C++11 compilers.
> 
> In the second patch I missed updating headers for architectures other
> than x86,
> so it needs to be updated before applying to the master branch.
> 
> It would be great for me to have this fixed on the master branch,
> as I am manually applying above patches whenever I pull the latest codes.
> 

+CC Thomas.

Sorry, I missed your previous patches. I think it would indeed be
helpful to have them included before the release to allow compilation
of C++ programs.

I'm wondering if we should add a C++ example in dpdk/examples: people
would see the problem before commiting, or if they miss it, I know some
people are doing automatic compilation tests every day.

Regards,
Olivier



> Regards,
> Joongi
> 
> 2015년 8월 17일 (월) 오후 5:15, Olivier MATZ <olivier.matz@6wind.com
> <mailto:olivier.matz@6wind.com>>님이 작성:
> 
>     Hi Sergey,
> 
>     On 08/12/2015 11:11 AM, Sergey Balabanov wrote:
>     > When DPDK is being compiled in C++ project using g++ then
>     > 'invalid conversion from' error appears. Added explicit
>     > typecast on function return to get rid of the error.
>     >
>     > Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru
>     <mailto:balabanovsv@ecotelecom.ru>>
> 
> 
>     Fixes: 7755baae8378 ("mbuf: silence warning on pointer arithmetic")
>     Fixes: 6cf14ce4ce6c ("mempool: silence warning on pointer arithmetic")
> 
>     Acked-by: Olivier Matz <olivier.matz@6wind.com
>     <mailto:olivier.matz@6wind.com>>
> 
>     Thanks
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mbuf & mempool: explicit typecast on function return
  2015-08-17  8:14 ` Olivier MATZ
  2015-08-17 12:28   ` Joongi Kim
@ 2015-08-17 15:38   ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-08-17 15:38 UTC (permalink / raw)
  To: Sergey Balabanov; +Cc: dev

2015-08-17 10:14, Olivier MATZ:
> Hi Sergey,
> 
> On 08/12/2015 11:11 AM, Sergey Balabanov wrote:
> > When DPDK is being compiled in C++ project using g++ then
> > 'invalid conversion from' error appears. Added explicit
> > typecast on function return to get rid of the error.
> > 
> > Signed-off-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
> 
> 
> Fixes: 7755baae8378 ("mbuf: silence warning on pointer arithmetic")
> Fixes: 6cf14ce4ce6c ("mempool: silence warning on pointer arithmetic")
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Split and applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-17 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12  9:11 [PATCH] mbuf & mempool: explicit typecast on function return Sergey Balabanov
2015-08-17  8:14 ` Olivier MATZ
2015-08-17 12:28   ` Joongi Kim
2015-08-17 12:50     ` Olivier MATZ
2015-08-17 15:38   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.