Re: [PATCH 0/5] cmocka: Make casting macros public
- Subject: Re: [PATCH 0/5] cmocka: Make casting macros public
- From: Jakub Hrozek <jakub.hrozek@xxxxxxxxx>
- Date: Wed, 11 Feb 2015 19:53:34 +0100
- To: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
- Cc: asn@xxxxxxxxxxxxxx, cmocka@xxxxxxxxxxxxxx, p.szewczyk@xxxxxxxxxxx, s.wadas@xxxxxxxxxxx
On 11.02.2015 18:58, Krzysztof Opasiak wrote:
Dear Andreas and Jakub,
I'm using cmocka to wrap file system operations. Some functions,
for example fopen() takes path as its argument. In linux path
elements can be separated using unlimited number of slashes.
So, for example:
points to the same directory and both are correct. To check
if argument which contains path is correct we have implemented
our own comparison function and use expect_check() macro to
store its value. To use this macro, our function should take
LargestIntegralType parameter. We need to cast this int to
const char * but it causes ugly warnings:
warning: cast to pointer from integer of different size
After reading cmocka source I have found some macros which
does exactly the job. My commit makes those macros available
for all cmocka users by moving their definitions to public
First of all, thank you very much for the patches.
First commit helps doxygen generate more suitable documentation
by adding code section around include suggestions.
Second commit takes all the ifndef stuff from cmocka.h to
separate header to improve cmocka API readability.
I couldn't apply this commit on master, can you rebase? Chances are we
pushed quite a lot of stuff today...a git tree is fine as well for
But after scrolling through the diff, I don't see any issues. I'm not
sure I like the cmocka_extra.h name but I can't think of a better one
either.. (cmocka_ptr? cmocka_platform? dunno)
The vast majority of users wouldn't even notice this split, since
Third commit make casting macros public to fix issues described
LGTM, not tested since I couldn't apply the patches
Fourth commit replace usage of cast_to_largest_integral_type()
with cast_ptr_to_largest_integral_type() in places where macros
are supposed to take pointer as its parameter.
I would prefer if Andreas reviewed this one, he did fixes precisely in
this area today.
Last one is a small fix of examples to use correct assert macros
make them simpler and avoid compiler warnings.
Visual ACK, but I couldn't apply the patch.