diff options
author | John Levon <john.levon@nutanix.com> | 2021-03-23 15:30:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 15:30:25 +0000 |
commit | 9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79 (patch) | |
tree | 3179a0a18319c3e863bd01c334de8a8fc7c68ab2 /lib/common.h | |
parent | 8ba55dfb9bb54b773513e78d87d9ebe078384573 (diff) | |
download | libvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.zip libvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.tar.gz libvfio-user-9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79.tar.bz2 |
add -Wmissing-declarations (#399)
This is used by SPDK, and it's generally useful. This also uncovered some issues
in the test mocking.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib/common.h')
-rw-r--r-- | lib/common.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/common.h b/lib/common.h index 9a5189d..7ac865e 100644 --- a/lib/common.h +++ b/lib/common.h @@ -58,6 +58,21 @@ #define UNIT_TEST_SYMBOL(x) \ typeof(x) __wrap_##x __attribute__((weak, alias(#x))) +#ifdef UNIT_TEST + +#define MOCKED(r, f, ...) \ + r f(__VA_ARGS__); \ + r __real_ ## f(__VA_ARGS__); \ + r __wrap_ ## f(__VA_ARGS__); + +#else /* UNIT_TEST */ + +#define MOCKED(r, f, ...) \ + r f(__VA_ARGS__); \ + r __wrap_ ## f(__VA_ARGS__) + +#endif /* UNIT_TEST */ + #endif /* LIB_VFIO_USER_COMMON_H */ /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |