On Wed, 22 Apr 2020 14:49:46 +0800
Qu Wenruo <w...@suse.com> wrote:

> +/* A simple wraper to for error() from btrfs-progs */
> +#define error(...) { printf(__VA_ARGS__); printf("\n"); }

Is this from btrfs-progs?
I don't like these macros much, I prefer to use static inline functions.

static inline void error(const char *fmt, ...)
{
        printf(fmt, __builtin_va_arg_pack());
        printf("\n");
}

Attribute for printf can be added to check printf specifiers:
  __attribute__((format (__printf__, 1, 2)))

It is possible that this won't compile when optimizations are disabled.
In that case more attributes are needed
  __always_inline __attribute__((__gnu_inline__))
These could be defined as a macro in include/linux/compiler-gcc.h
  #define __gnu_inline __always_inline __attribute__((__gnu_inline__))

Marek

Reply via email to