Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
PATCH 1/1 Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
the drmServerInfo member, debug_print, takes a printf format string and varargs list. Tell the compiler about it.
--- xf86drm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
xf86drm.h +7 -1
@@ -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 ;
Signature · 1 line
1.8.5.2
Quoted 18 lines · Keith Packard
the drmServerInfo member,
debug_print, takes a printf format string and varargs list. Tell the compiler about it.Signed-off-by Keith Packard <[email protected]>--- xf86drm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)xf86drm.h +2
-0@@ -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)))
xf86drm.h extern "C" { · line 105
Quoted 10 lines
xf86drm.h +5
-1+#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
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Thierry Reding
While at it, perhaps the
drmMsg()anddrmDebugPrint()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!
Signature · 1 line
[email protected]
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Quoted 29 lines · Keith Packard
the drmServerInfo member,
debug_print, takes a printf format string and varargs list. Tell the compiler about it.Signed-off-by Keith Packard <[email protected]>--- xf86drm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)xf86drm.h +7
-1@@ -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 ;
Quoted 1 line · Ian Romanick
Reviewed-by Ian Romanick <[email protected]>
Thanks. Pushed.
8279c8f..cb4bc8e master -> master
Signature · 1 line
[email protected]
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel