Update the generator to include a check for CUSTOM_FFF_FUNCTION_TEMPLATE.
If not present it will default to the C style function pointer.
Alternatively, developers may define their own version of the template to
leverage std::function or pw:Function (from the embedded Pigweed library).
Signed-off-by: Yuval Peress <peress@google.com>
Replace makefiles with CMakeLists.txt. This will allow for IDE and
platform agnostic builds of FFF.
Update the CI for FFF to use github workflows which don't depend on MS VC.
The workflow added will verify the pull requests sent to master buy
running 'buildandtest' which mirrors the developer workflow.
Signed-off-by: Yuval Peress <peress@google.com>
commit e5a5749971eb9274679699020a54c91d4053ed79
Author: James Fraser <wulfgar.pro@gmail.com>
Date: Sun Feb 3 19:57:31 2019 +1100
PR #47: Minor review fixes to tests files.
commit e9f11b9ec8de8f8d1f0de7b6959c575e15894526
Author: James Fraser <wulfgar.pro@gmail.com>
Date: Sun Feb 3 19:57:04 2019 +1100
PR #47: Minor review fixes.
commit 0a7fbeceec
Author: Pauli Salmenrinne <pauli.salmenrinne@pexraytech.com>
Date: Tue Jan 22 15:11:10 2019 +0200
Add example for the weak linking
commit 647737304d
Author: susundberg <susundberg@gmail.com>
Date: Wed Mar 21 13:14:05 2018 +0200
Add "FFF_FUNCTION_ATTRIBUTES" definition that can be used to declare attributes for functions. More specifically, allow __weak__ attribute.
* Custom return value delegate sequences for variadic functions
* Added unit tests for variadic functions custom return value delegate sequences
* Fixes in code style
* Variadic functions custom delegates also tested in C++
* Fixed some compilation warnings
* Added test for variadic function custom delegates sequence reset
* Updated documentation with variadic functions custom delegate sequences
* Update README.md
* Minor style changes.
Thank you very much @oliviera9!
Assuming your C interfaces are appropriately wrapped for C++, it is
unnecessary to force the fakes to be declared extern "C", and doing so
causes any functions declared with C++ linkage to be impossible to fake
due to the conflicting linkage declarations.
On some contexts, we need to call one function to free some resource
allocated by another function based on the return value of the second
function. For example, every time pthread_mutex_trylock suceeds, you
need to unlock it, and only in those cases. While this could be done
with the return value sequence, it does not really work for a sequence
of custom fakes. Now we save the return values in the member
return_val_history, which works pretty much like arg_history, only
for the return values.
This makes it possible to set a sequence of custom fakes for a function
using the macro SET_CUSTOM_FAKE_SEQ. Very useful for functions with out
parameters. Now we don't have to count the number of calls to implement
different behaviours on custom fakes.
Custom fake support for variadic functions was limited. The variable
parameters were not passed to the custom fake.
Now a va_list is passed to the custom fake, so it is possible to access
all the arguments. For instance, a custom fake for fprintf() could call
the real fprintf() like this:
int fprintf_custom(FILE *stream, const char *format, va_list ap) {
if (fprintf0_fake.return_val < 0) // should we fail?
return fprintf0_fake.return_val;
return vfprintf(stream, format, ap);
}