meekrosoft / fff

A testing micro framework for creating function test doubles
Other
761 stars 167 forks source link

Getting Error error: overloaded function with no contextual type information #83

Closed raghuiisc closed 4 years ago

raghuiisc commented 4 years ago

I am Trying to fake the below function using FFF and getting below compilation issue.

int redisClusterAsyncFormattedCommand(redisClusterAsyncContext acc, redisClusterCallbackFn fn, void privdata, char cmd, int len);

typedef void (redisClusterCallbackFn)(struct redisClusterAsyncContext, void, void*);

I have defined as below: FAKE_VALUE_FUNC(int, redisClusterAsyncFormattedCommand, redisClusterAsyncContext , redisClusterCallbackFn , void , char , int);

I am getting below compilation issues: error: expected ‘,’ or ‘...’ before ‘void’ FAKE_VALUE_FUNC(int, redisClusterAsyncFormattedCommand, redisClusterAsyncContext , redisClusterCallbackFn , void , char , int);

error: ‘arg2’ was not declared in this scope memcpy((void)&FUNCNAME##_fake.arg##n##_val, (void)&arg##n, sizeof(arg##n));

error: ‘arg3’ was not declared in this scope memcpy((void)&FUNCNAME##_fake.arg##n##_val, (void)&arg##n, sizeof(arg##n));

error: ‘arg4’ was not declared in this scope memcpy((void)&FUNCNAME##_fake.arg##n##_val, (void)&arg##n, sizeof(arg##n));

error: overloaded function with no contextual type information FAKE_VALUE_FUNC(int, redisClusterAsyncFormattedCommand, redisClusterAsyncContext , redisClusterCallbackFn , void , char , int); ^

raghuiisc commented 4 years ago

My Bad

in library function there was some comma deleted which caused this issue.

define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \

 FUNCNAME##_Fake FUNCNAME##_fake; \