blob: d3f3ddfc3a2b9d3c8617af9bf980c4acb52a00b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Mock the common wrapper functionality. For the purpose of this discussion,
// this is just a sink accepting any function argument.
#define MOCK_WRAPPER_IMPL(ret, fn) \
/* do common work */ \
static ret wrap_##fn(...);
// Utility to generate wrapper boilerplate.
#define WRAP(ret, fn, ...) \
MOCK_WRAPPER_IMPL(ret, fn) \
\
extern "C" ret fn(__VA_ARGS__)
WRAP(int, foo, const char* name) {
return wrap_foo(name);
}
WRAP(int, bar, const char* name, const char* value) {
return wrap_bar(name, value);
}
|