mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +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) \
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user