Function definition(?) without {}
c, ffmpeg
Solution
`av_printf_format` is a macro, which can optionally add a GCC attribute to the function declaration. It's defined in attributes.h:
#ifdef __GNUC__
# define av_builtin_constant_p __builtin_constant_p
# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
#else
# define av_builtin_constant_p(x) 0
# define av_printf_format(fmtpos, attrpos)
#endif
So this is actually a function declaration, which may have a specific attribute if compiled on GCC.
The `format` attribute tells GCC that the function takes its arguments like `printf`, which helps diagnose some errors.
Problem
I was reading avio.h (part of ffmpeg) and there is definition(?) like this: `int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);`. I don't get it. Could someone explain me what this do? Thanks.