When using the fake function framework to mock a function that takes a const pointer as Argument, e.g.
FAKE_VOID_FUNC(my_function, int *const)
I get four compiler warnings:
fff.h:66:12: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
fff.h:66:50: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
fff.h:76:12: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
fff.h:76:85: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
As I read through the documentation and through merged pull requests, it seems this should be possible. Am I doing something wrong, or do I have to life with the warnings?
When using the fake function framework to mock a function that takes a const pointer as Argument, e.g.
FAKE_VOID_FUNC(my_function, int *const)
I get four compiler warnings:
fff.h:66:12: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
fff.h:66:50: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
fff.h:76:12: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
fff.h:76:85: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
As I read through the documentation and through merged pull requests, it seems this should be possible. Am I doing something wrong, or do I have to life with the warnings?