[dpdk-dev] [PATCH 1/7] mempool: fix build with debug enabled
Olivier MATZ
olivier.matz at 6wind.com
Wed Mar 4 10:59:33 CET 2015
Hi Thomas,
On 03/03/2015 04:23 PM, Thomas Monjalon wrote:
> error: format ‘%p’ expects argument of type ‘void *’,
> but argument 5 has type ‘const struct rte_mempool *’ [-Werror=format=]
>
> mp type is (const struct rte_mempool *) and must be casted into a simpler
> type to be printed.
I was a bit surprised to see this warning although the standard says:
The argument shall be a pointer to void. The value of the pointer is
converted to a sequence of printing wide characters, in an
implementation-defined manner.
But I think we often do this in dpdk, without any warning:
struct foo_s *foo = ...;
printf("%p\n", foo);
After some search, the reason why you get a warning here is that you
compile a C file that includes this header with the "-pedantic" flag.
So, I think doing this fix is justified for header files as we cannot
predict which options are used by the user of these headers.
So:
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
More information about the dev
mailing list