diff options
author | Andrea Shepard <andrea@torproject.org> | 2016-06-30 05:35:46 +0000 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2016-06-30 07:03:26 +0000 |
commit | 2154160a2484d852e4a0b509a5f046001d52fd11 (patch) | |
tree | 8a3d89e32d11a3548b374a6b74329b51e4b8da80 /src/common/testsupport.h | |
parent | 421cf21b3cc7c0d4a9c64eb992b991019103a7f3 (diff) | |
download | tor-2154160a2484d852e4a0b509a5f046001d52fd11.tar.gz tor-2154160a2484d852e4a0b509a5f046001d52fd11.zip |
Add support for mocking functions declared with attributes without causing gcc warnings
Diffstat (limited to 'src/common/testsupport.h')
-rw-r--r-- | src/common/testsupport.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/testsupport.h b/src/common/testsupport.h index b98d7014c7..9ad2ba77e0 100644 --- a/src/common/testsupport.h +++ b/src/common/testsupport.h @@ -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 |