Maintaining backwards compatibility with swap macros

Matt Turner mattst88 at gmail.com
Sun Sep 25 10:50:01 PDT 2011


Dave pointed out that there are a couple drivers (sis, sisusb, vmware)
that use the swapl/swaps macros. My recent patch series dropped the n
argument from the macros, causing these drivers to not build.

Ideally, we'd like a deprecation warning when the second argument is
given, but by removing the second argument, we'd lose compatibility with
old servers.

We could modify the swap macros in the server with the following patch,
or we could update the drivers to use a single argument
#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1, 11, 99, 0).

Thoughts?

Matt

diff --git a/include/misc.h b/include/misc.h
index 1fea73e..8328555 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -285,7 +285,7 @@ static inline void swap_uint32(uint32_t *x)
 	((char *) x)[2] = n;
 }
 
-#define swapl(x) do { \
+#define swapl(x, ...) do { \
 		if (sizeof(*(x)) != 4) \
 			wrong_size(); \
 		if (__builtin_constant_p((uintptr_t)(x) & 3) && ((uintptr_t)(x) & 3) == 0) \
@@ -302,7 +302,7 @@ static inline void swap_uint16(uint16_t *x)
 	((char *) x)[1] = n;
 }
 
-#define swaps(x) do { \
+#define swaps(x, ...) do { \
 		if (sizeof(*(x)) != 2) \
 			wrong_size(); \
 		if (__builtin_constant_p((uintptr_t)(x) & 1) && ((uintptr_t)(x) & 1) == 0) \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110925/2873f5f5/attachment.pgp>


More information about the xorg-devel mailing list