Regularly when disabling features (e.g. traces), some macros that would
make use of some arguments end up not consuming them at all, making the
compiler complain that "variable foo defined but not used".
An elegant way to generically mark arguments as used is to pass them to
a variadic function. However a first argument is needed. So we create a
macro that passes (0, __VA_ARGS__) to an inline function that does nothing
from its arguments, and that's done.
# endif
#endif
+/* Eats all arguments ignoring their types and contents. This is useful
+ * to avoid "foo declared but not used" warnings. A first non-empty arg
+ * is required by the function, but it's inserted by the macro.
+ */
+#define __eat_all_args(...) ___eat_all_args(0, __VA_ARGS__)
+static inline __attribute__((always_inline)) void ___eat_all_args(int ignore, ...)
+{
+ (void)ignore;
+}
+
+
#endif /* _HAPROXY_COMPILER_H */