-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:treat_as: not working as expected #485
Comments
|
Hi. So two things:
|
@mvandervoord I appreciate your attention on this. I'll keep an eye out for CMock v3.0.0 or a dev branch that is working on this issue. Out of curiosity and maybe for others who have this issue and want to find a work around, could you point towards what script drives this behavior? Or is this a major overhaul that cannot be described simply? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I created a very simple repo to explain this issue / confusion I have with the treat_as configuration parameter. Please see the link below:
https://github.com/Jakebluhm/cmock-issue/
I have one function in my example.c/.h file:
example.h:
int *const foo(float const *const self);
example.c:
int *const foo(float const *const self) { return self - 1; }
These types are unusual but are needed for a specific reason for embedded C code. The issue is that by default the mock version of this function's return value is changed, which causes Ceedling build errors. I want to use the treat_as to fix cmocks default behavior to leave the stub's return value as is.
The mocked version of the function is:
const int* foo(float const* const self) {...}
int *const gets converted to const int*
Why does this ^ happen? and how can I override this behavior?
The cmock stub's return value is different than the source stub and I want to use treat_as to fix this. Here is my configuration file that I use in a cmock CLI call to generate the mock for example.c/.h
cmock_config:
To run this example I am generating this mock with:
$ ruby {path to cmock}\cmock.rb -ocmock_config example.h
The text was updated successfully, but these errors were encountered: