I met a problem when using fff in ceedling.
If a function with a const pointer retruned is used in my test,
its stub function is generated as a non-const return one
and the build stops.
Test 'test_foo.c'
-----------------
Creating mock for bar...
Creating mock: build/test/mocks/mock_bar.h
Compiling mock_bar.c...
In file included from build/test/mocks/mock_bar.c:2:0:
build/test/mocks/mock_bar.c:11:32: error: conflicting types for ‘bar_get_message’
DEFINE_FAKE_VALUE_FUNC0(char*, bar_get_message);
^
/home/wang/test/temp_sensor/vendor/ceedling/plugins/fake_function_framework/vendor/fff/fff.h:1415:21: note: in definition of macro ‘DEFINE_FAKE_VALUE_FUNC0’
RETURN_TYPE FUNCNAME(){ \
^
In file included from build/test/mocks/mock_bar.h:6:0,
from build/test/mocks/mock_bar.c:3:
src/bar.h:13:13: note: previous declaration of ‘bar_get_message’ was here
const char *bar_get_message(void);
^
ERROR: Shell command failed.
> Shell executed command:
'gcc -I"test" -I"src" -I"src/subfolder" -I"/home/wang/test/temp_sensor/vendor/ceedling/vendor/unity/src" -I"/home/wang/test/temp_sensor/vendor/ceedling/vendor/cmock/src" -I"build/test/mocks" -I"/home/wang/test/temp_sensor/vendor/ceedling/plugins/fake_function_framework/vendor/fff" -I"/home/wang/test/temp_sensor/vendor/ceedling/plugins/fake_function_framework/src" -DTEST -DGNU_COMPILER -g -c "build/test/mocks/mock_bar.c" -o "build/test/out/mock_bar.o"'
> And exited with status: [1].
rake aborted!
I did some research on the code and found that
making some changes as follows will clear the problem.
I met a problem when using fff in ceedling. If a function with a const pointer retruned is used in my test, its stub function is generated as a non-const return one and the build stops.
I did some research on the code and found that making some changes as follows will clear the problem.
I know it's only a temporary solution and have not done any other test.