|
42 | 42 |
|
43 | 43 | #define FOLLY_HAVE_SDT 0
|
44 | 44 |
|
45 |
| -// Mark variadic macro args as unused from https://stackoverflow.com/a/31470425 |
46 |
| -#define FOLLY_UNUSED0() |
47 |
| -#define FOLLY_UNUSED1(a) (void)(a) |
48 |
| -#define FOLLY_UNUSED2(a, b) (void)(a), FOLLY_UNUSED1(b) |
49 |
| -#define FOLLY_UNUSED3(a, b, c) (void)(a), FOLLY_UNUSED2(b, c) |
50 |
| -#define FOLLY_UNUSED4(a, b, c, d) (void)(a), FOLLY_UNUSED3(b, c, d) |
51 |
| -#define FOLLY_UNUSED5(a, b, c, d, e) (void)(a), FOLLY_UNUSED4(b, c, d, e) |
52 |
| -#define FOLLY_UNUSED6(a, b, c, d, e, f) (void)(a), FOLLY_UNUSED5(b, c, d, e, f) |
53 |
| -#define FOLLY_UNUSED7(a, b, c, d, e, f, g) \ |
54 |
| - (void)(a), FOLLY_UNUSED6(b, c, d, e, f, g) |
55 |
| -#define FOLLY_UNUSED8(a, b, c, d, e, f, g, h) \ |
56 |
| - (void)(a), FOLLY_UNUSED7(b, c, d, e, f, g, h) |
57 |
| - |
58 |
| -#define FOLLY_VA_NUM_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, N, ...) N |
59 |
| -#define FOLLY_VA_NUM_ARGS(...) \ |
60 |
| - FOLLY_VA_NUM_ARGS_IMPL(100, ##__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) |
61 |
| - |
62 |
| -#define FOLLY_ALL_UNUSED_IMPL_(nargs) FOLLY_UNUSED##nargs |
63 |
| -#define FOLLY_ALL_UNUSED_IMPL(nargs) FOLLY_ALL_UNUSED_IMPL_(nargs) |
64 |
| - |
65 |
| -#if defined(_MSC_VER) |
66 |
| -#define FOLLY_ALL_UNUSED(...) |
67 |
| -#else |
68 |
| -#define FOLLY_ALL_UNUSED(...) \ |
69 |
| - FOLLY_ALL_UNUSED_IMPL(FOLLY_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__) |
70 |
| -#endif |
71 |
| - |
72 |
| -#define FOLLY_SDT(provider, name, ...) \ |
73 |
| - do { \ |
74 |
| - FOLLY_ALL_UNUSED(__VA_ARGS__); \ |
| 45 | +#define FOLLY_SDT(provider, name, ...) \ |
| 46 | + do { \ |
| 47 | + [](auto const&...) {}(__VA_ARGS__); \ |
75 | 48 | } while (0)
|
76 | 49 | #define FOLLY_SDT_WITH_SEMAPHORE(provider, name, ...) \
|
77 | 50 | do { \
|
78 |
| - FOLLY_ALL_UNUSED(__VA_ARGS__); \ |
| 51 | + [](auto const&...) {}(__VA_ARGS__); \ |
79 | 52 | } while (0)
|
80 | 53 | #define FOLLY_SDT_IS_ENABLED(provider, name) (false)
|
81 | 54 | #define FOLLY_SDT_SEMAPHORE(provider, name) \
|
|
0 commit comments