mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Add support for mocking functions declared with attributes without causing gcc warnings
This commit is contained in:
parent
421cf21b3c
commit
2154160a24
@ -62,6 +62,12 @@
|
|||||||
#define MOCK_IMPL(rv, funcname, arglist) \
|
#define MOCK_IMPL(rv, funcname, arglist) \
|
||||||
rv(*funcname) arglist = funcname ##__real; \
|
rv(*funcname) arglist = funcname ##__real; \
|
||||||
rv funcname ##__real arglist
|
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) \
|
#define MOCK(func, replacement) \
|
||||||
do { \
|
do { \
|
||||||
(func) = (replacement); \
|
(func) = (replacement); \
|
||||||
@ -73,6 +79,8 @@
|
|||||||
#else
|
#else
|
||||||
#define MOCK_DECL(rv, funcname, arglist) \
|
#define MOCK_DECL(rv, funcname, arglist) \
|
||||||
rv funcname arglist
|
rv funcname arglist
|
||||||
|
#define MOCK_DECL_ATTR(rv, funcname, arglist, attr) \
|
||||||
|
rv funcname arglist attr
|
||||||
#define MOCK_IMPL(rv, funcname, arglist) \
|
#define MOCK_IMPL(rv, funcname, arglist) \
|
||||||
rv funcname arglist
|
rv funcname arglist
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user