All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
@ 2014-01-12 18:34 Keith Packard
  2014-01-13  9:13 ` Thierry Reding
  2014-01-13 18:03 ` Ian Romanick
  0 siblings, 2 replies; 5+ messages in thread
From: Keith Packard @ 2014-01-12 18:34 UTC (permalink / raw)
  To: mesa-dev; +Cc: dri-devel

the drmServerInfo member, debug_print, takes a printf format string
and varargs list. Tell the compiler about it.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 xf86drm.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xf86drm.h b/xf86drm.h
index 1e763a3..5e170f8 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -92,8 +92,14 @@ extern "C" {
 typedef unsigned int  drmSize,     *drmSizePtr;	    /**< For mapped regions */
 typedef void          *drmAddress, **drmAddressPtr; /**< For mapped regions */
 
+#if (__GNUC__ >= 3)
+#define DRM_PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define DRM_PRINTFLIKE(f, a)
+#endif
+
 typedef struct _drmServerInfo {
-  int (*debug_print)(const char *format, va_list ap);
+  int (*debug_print)(const char *format, va_list ap) DRM_PRINTFLIKE(1,0);
   int (*load_module)(const char *name);
   void (*get_perms)(gid_t *, mode_t *);
 } drmServerInfo, *drmServerInfoPtr;
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
  2014-01-12 18:34 [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0))) Keith Packard
@ 2014-01-13  9:13 ` Thierry Reding
  2014-01-13 14:19   ` Keith Packard
  2014-01-13 18:03 ` Ian Romanick
  1 sibling, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2014-01-13  9:13 UTC (permalink / raw)
  To: Keith Packard; +Cc: mesa-dev, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1222 bytes --]

On Sun, Jan 12, 2014 at 10:34:19AM -0800, Keith Packard wrote:
> the drmServerInfo member, debug_print, takes a printf format string
> and varargs list. Tell the compiler about it.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  xf86drm.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/xf86drm.h b/xf86drm.h
> index 1e763a3..5e170f8 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -92,8 +92,14 @@ extern "C" {
>  typedef unsigned int  drmSize,     *drmSizePtr;	    /**< For mapped regions */
>  typedef void          *drmAddress, **drmAddressPtr; /**< For mapped regions */
>  
> +#if (__GNUC__ >= 3)
> +#define DRM_PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
> +#else
> +#define DRM_PRINTFLIKE(f, a)
> +#endif
> +
>  typedef struct _drmServerInfo {
> -  int (*debug_print)(const char *format, va_list ap);
> +  int (*debug_print)(const char *format, va_list ap) DRM_PRINTFLIKE(1,0);
>    int (*load_module)(const char *name);
>    void (*get_perms)(gid_t *, mode_t *);
>  } drmServerInfo, *drmServerInfoPtr;

While at it, perhaps the drmMsg() and drmDebugPrint() functions should
be similarily annotated as well?

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
  2014-01-13  9:13 ` Thierry Reding
@ 2014-01-13 14:19   ` Keith Packard
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Packard @ 2014-01-13 14:19 UTC (permalink / raw)
  To: Thierry Reding; +Cc: mesa-dev, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 354 bytes --]

Thierry Reding <thierry.reding@gmail.com> writes:

> While at it, perhaps the drmMsg() and drmDebugPrint() functions should
> be similarily annotated as well?

I don't know; I'm just fixing X server warnings this week and this was
the source of one of them. Additional warning fixes for drm would be
a great idea!

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
  2014-01-12 18:34 [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0))) Keith Packard
  2014-01-13  9:13 ` Thierry Reding
@ 2014-01-13 18:03 ` Ian Romanick
  2014-01-13 18:14   ` [Mesa-dev] " Keith Packard
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Romanick @ 2014-01-13 18:03 UTC (permalink / raw)
  To: Keith Packard, mesa-dev; +Cc: dri-devel

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

On 01/12/2014 10:34 AM, Keith Packard wrote:
> the drmServerInfo member, debug_print, takes a printf format string
> and varargs list. Tell the compiler about it.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  xf86drm.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/xf86drm.h b/xf86drm.h
> index 1e763a3..5e170f8 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -92,8 +92,14 @@ extern "C" {
>  typedef unsigned int  drmSize,     *drmSizePtr;	    /**< For mapped regions */
>  typedef void          *drmAddress, **drmAddressPtr; /**< For mapped regions */
>  
> +#if (__GNUC__ >= 3)
> +#define DRM_PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
> +#else
> +#define DRM_PRINTFLIKE(f, a)
> +#endif
> +
>  typedef struct _drmServerInfo {
> -  int (*debug_print)(const char *format, va_list ap);
> +  int (*debug_print)(const char *format, va_list ap) DRM_PRINTFLIKE(1,0);
>    int (*load_module)(const char *name);
>    void (*get_perms)(gid_t *, mode_t *);
>  } drmServerInfo, *drmServerInfoPtr;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Mesa-dev] [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
  2014-01-13 18:03 ` Ian Romanick
@ 2014-01-13 18:14   ` Keith Packard
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Packard @ 2014-01-13 18:14 UTC (permalink / raw)
  To: Ian Romanick, mesa-dev; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 192 bytes --]

Ian Romanick <idr@freedesktop.org> writes:

> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

Thanks. Pushed.
   8279c8f..cb4bc8e  master -> master

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-13 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 18:34 [PATCH] Mark debug_print with __attribute__ ((format(__printf__, 1, 0))) Keith Packard
2014-01-13  9:13 ` Thierry Reding
2014-01-13 14:19   ` Keith Packard
2014-01-13 18:03 ` Ian Romanick
2014-01-13 18:14   ` [Mesa-dev] " Keith Packard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.