Remove consts from defined structs to avoid errors with c++#85
Remove consts from defined structs to avoid errors with c++#85sebirdman wants to merge 2 commits intomeekrosoft:masterfrom
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