Add support for mocking functions declared with attributes without causing gcc warnings

This commit is contained in:
Andrea Shepard 2016-06-30 05:35:46 +00:00
parent 421cf21b3c
commit 2154160a24

View File

@ -62,6 +62,12 @@
#define MOCK_IMPL(rv, funcname, arglist) \
rv(*funcname) arglist = funcname ##__real; \
rv funcname ##__real arglist
#define MOCK_DECL_ATTR(rv, funcname, arglist, attr) \
rv funcname ##__real arglist attr; \
extern rv(*funcname) arglist
#define MOCK_IMPL(rv, funcname, arglist) \
rv(*funcname) arglist = funcname ##__real; \
rv funcname ##__real arglist
#define MOCK(func, replacement) \
do { \
(func) = (replacement); \
@ -73,6 +79,8 @@
#else
#define MOCK_DECL(rv, funcname, arglist) \
rv funcname arglist
#define MOCK_DECL_ATTR(rv, funcname, arglist, attr) \
rv funcname arglist attr
#define MOCK_IMPL(rv, funcname, arglist) \
rv funcname arglist
#endif