* [PATCH] Mark drmServerInfo.debug_print with printf attribute
@ 2013-12-11 21:17 Keith Packard
2013-12-12 4:01 ` Alan Coopersmith
0 siblings, 1 reply; 3+ messages in thread
From: Keith Packard @ 2013-12-11 21:17 UTC (permalink / raw)
To: mesa-dev; +Cc: dri-devel
I stole the conditional for _X_ATTRIBUTE_PRINTF from xproto and
changed the name to _DRM_ATTRIBUTE_PRINTF to avoid future conflicts.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
xf86drm.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xf86drm.h b/xf86drm.h
index 1e763a3..0bf205f 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -92,8 +92,15 @@ extern "C" {
typedef unsigned int drmSize, *drmSizePtr; /**< For mapped regions */
typedef void *drmAddress, **drmAddressPtr; /**< For mapped regions */
+/* Added in X11R6.9, so available in any version of modular xproto */
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+# define _DRM_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else /* not gcc >= 2.3 */
+# define _DRM_ATTRIBUTE_PRINTF(x,y)
+#endif
+
typedef struct _drmServerInfo {
- int (*debug_print)(const char *format, va_list ap);
+ int (*debug_print)(const char *format, va_list ap) _DRM_ATTRIBUTE_PRINTF(1,0);
int (*load_module)(const char *name);
void (*get_perms)(gid_t *, mode_t *);
} drmServerInfo, *drmServerInfoPtr;
--
1.8.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Mark drmServerInfo.debug_print with printf attribute
2013-12-11 21:17 [PATCH] Mark drmServerInfo.debug_print with printf attribute Keith Packard
@ 2013-12-12 4:01 ` Alan Coopersmith
2013-12-12 6:42 ` Keith Packard
0 siblings, 1 reply; 3+ messages in thread
From: Alan Coopersmith @ 2013-12-12 4:01 UTC (permalink / raw)
To: Keith Packard; +Cc: mesa-dev, dri-devel
On 12/11/13 01:17 PM, Keith Packard wrote:
> I stole the conditional for _X_ATTRIBUTE_PRINTF from xproto and
> changed the name to _DRM_ATTRIBUTE_PRINTF to avoid future conflicts.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
> xf86drm.h | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/xf86drm.h b/xf86drm.h
> index 1e763a3..0bf205f 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -92,8 +92,15 @@ extern "C" {
> typedef unsigned int drmSize, *drmSizePtr; /**< For mapped regions */
> typedef void *drmAddress, **drmAddressPtr; /**< For mapped regions */
>
> +/* Added in X11R6.9, so available in any version of modular xproto */
You should drop that line - those comments are used for us to figure out which
xproto version to list in the pkg-config requirements when using newer _X_*
macros out of Xfuncproto.h, so doesn't make sense here.
Also be warned that using a macro name starting with an _ will cause you to get
complaints about violating the "reserved for the implementation" rule in the
ANSI/ISO C standards from people who consider the implementation to solely be
the compiler, not the OS. https://bugs.freedesktop.org/show_bug.cgi?id=70686
for example.
--
-Alan Coopersmith- alan.coopersmith@oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Mark drmServerInfo.debug_print with printf attribute
2013-12-12 4:01 ` Alan Coopersmith
@ 2013-12-12 6:42 ` Keith Packard
0 siblings, 0 replies; 3+ messages in thread
From: Keith Packard @ 2013-12-12 6:42 UTC (permalink / raw)
To: Alan Coopersmith; +Cc: mesa-dev, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 706 bytes --]
Alan Coopersmith <alan.coopersmith@oracle.com> writes:
> You should drop that line - those comments are used for us to figure out which
> xproto version to list in the pkg-config requirements when using newer _X_*
> macros out of Xfuncproto.h, so doesn't make sense here.
>
> Also be warned that using a macro name starting with an _ will cause you to get
> complaints about violating the "reserved for the implementation" rule in the
> ANSI/ISO C standards from people who consider the implementation to solely be
> the compiler, not the OS. https://bugs.freedesktop.org/show_bug.cgi?id=70686
> for example.
Thanks for the suggestions; both easy to adopt.
--
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] 3+ messages in thread
end of thread, other threads:[~2013-12-12 6:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 21:17 [PATCH] Mark drmServerInfo.debug_print with printf attribute Keith Packard
2013-12-12 4:01 ` Alan Coopersmith
2013-12-12 6:42 ` 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.