-
Notifications
You must be signed in to change notification settings - Fork 170
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
Remove consts from defined structs to avoid errors with c++ #85
base: master
Are you sure you want to change the base?
Conversation
❌ Build fff 85-appveyor failed (commit b27f8d19ad by @sebirdman) |
❌ Build fff 86-appveyor failed (commit 6fb172869f by @sebirdman) |
I'm not sure what the tests are doing exactly, i'm not able to reproduce these failures on my machine |
The changes introduced by the original pull request require the fff.h to be not included within an extern "C" block when compiling with a cpp compiler. I fixed the issue by wrapping an additional Alternatively it's also possible to just fix the test and tell the users that fff.h cannot be included within an |
Hi, |
b0792e6
to
bdb7397
Compare
This feature would be great, but unfortunately the seems abandoned. There's a very ugly workaround that works for C++ compilers. Say that you want to test
bool foo(int a, const int b)
{
...
}
bool foo(int a, const int b);
#include <gtest/gtest.h>
#include <fff.h>
#include "foo.hpp"
DEFINE_FFF_GLOBALS;
extern "C" {
/**
* Fakes
*/
FAKE_VALUE_FUNC(bool, __foo, int, int);
} // extern "C"
// Re-implementation of foo using linker-seam
// Must keep const-ness
bool foo(int a, const int b)
{
// Call "actual fake"
return __foo(a, (int) b); // Need to use C-style casts to remove constness
} Use |
This should properly resolve #51