[Ffmpeg-devel] [PATCH] Add missing __format__ attributes where missing

Michael Niedermayer michaelni
Sat Mar 17 22:34:50 CET 2007


Hi

On Thu, Jul 06, 2006 at 01:20:10AM +0200, Diego 'Flameeyes' Petten? wrote:
> As per summary, this patch adds a few __format__ attribute where missing, 
> thanks to -Wmissing-format-attributes .
> 
> -- 
> Diego "Flameeyes" Petten? - http://farragut.flameeyes.is-a-geek.org/
> Gentoo/Alt lead, Gentoo/FreeBSD, Video, AMD64, Sound, PAM, KDE

> Add format attributes to functions missing it.
[...]
> -static void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
> +static
> +#ifdef __GNUC__
> +  __attribute__ ((__format__ (__printf__, 3, 0)))
> +#endif
> +void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
>  {
>      static int print_prefix=1;
>      AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
> @@ -1325,7 +1329,11 @@ #define fprintf please_use_av_log
>      vfprintf(stderr, fmt, vl);
>  }
>  
> -static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
> +static
> +#ifdef __GNUC__
> +  __attribute__ ((__format__ (__printf__, 3, 0)))
> +#endif
> +void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
>  
>  void av_log(void* avcl, int level, const char *fmt, ...)
>  {
> diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
> index 9edd20f..af111f5 100644
> --- a/libavformat/rtpproto.c
> +++ b/libavformat/rtpproto.c
> @@ -71,7 +71,11 @@ int rtp_set_remote_url(URLContext *h, co
>  
>  /* add option to url of the form:
>     "http://host:port/path?option1=val1&option2=val2... */
> -static void url_add_option(char *buf, int buf_size, const char *fmt, ...)
> +static
> +#ifdef __GNUC__
> +  __attribute__ ((__format__ (__printf__, 3, 4) ))
> +#endif
> +void url_add_option(char *buf, int buf_size, const char *fmt, ...)
>  {

this mess is unacceptable, either implement it cleanly or leave it

that is
static av_foobar(...) void url_add_option(char *buf, int buf_size, const char *fmt, ...)

#ifdef __GNUC__
#define av_foobar() ...
#else
#define av_foobar()
#endif

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070317/bc9ce8ad/attachment.pgp>



More information about the ffmpeg-devel mailing list