On 03/08/2013 05:25 PM, Jakub Hrozek wrote:
On Fri, Mar 08, 2013 at 02:46:10PM +0100, Jakub Hrozek wrote:
> On Wed, Mar 06, 2013 at 09:33:12PM +0100, Sumit Bose wrote:
>> On Tue, Mar 05, 2013 at 05:25:45PM +0100, Jakub Hrozek wrote:
>>> On Fri, Mar 01, 2013 at 02:38:08PM +0100, Pavel Březina wrote:
>>>
>>>>
>>>> Create a macro for:
>>>> *body = (uint8_t *) mock() => mock_as(uint8_t*)
>>>
>>> OK, done.
>>>
>>> New tests attached.
>>
>> Maybe you can consider the attached patch for inclusion as well? It will
>> silence a "cast to pointer from integer of different size
>> [-Wint-to-pointer-cast]" compiler warning.
>>
>> What do you think of asking upstream if they would like to include
>>
>> #define mock_type(type) ((type) mock())
>>
>> and maybe
>>
>> #define mock_ptr_type(type) ((type) (uintptr_t) mock())
>>
>> or similar? To avoid conflicts I would recommend to add a prefix, e.g.
>> sss_mock_type and sss_mock_ptr_type.
>
> Thank you, I've merged your patch and used prefix for the macros. I will
> ask cmocka upstream to provide their macros so when/if they are
> available we can simply use those.
>
> New patches are attached.
Pavel asked me off-list to use an enum for deciding whether we are
calling a real function or a wrapper. New patches are attached.
Ack!