Maintaining backwards compatibility with swap macros

Matt Turner mattst88 at gmail.com
Sun Oct 2 07:51:14 PDT 2011


On Sun, Oct 2, 2011 at 2:15 AM, Jeremy Huddleston
<jeremyhu at freedesktop.org> wrote:
> ping.  I didn't see anything as a followup to my comments below.  I'm fine with either approach, but I'd like to get this in soon.
>
> On Sep 25, 2011, at 11:22 AM, Jeremy Huddleston wrote:
>
>>
>> On Sep 25, 2011, at 10:50, Matt Turner wrote:
>>
>>> 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?
>>
>> Changing to a vararg macro seems icky to me.
>>
>> I'd rather fix these in the drivers themselves instead.  Perhaps bring in my ABI bump patch now rather than waiting for all the bus layer cleanup and use that in the drivers to determine what they should do.  At minimum, they can do:
>>
>> find . -type f | xargs sed -i -e 's/swaps/_swaps/g' -e 's/swapl/_swapl/g'
>>
>> Then add to some header:
>>
>> #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
>> #define _swapl(x, n) swapl(x,n)
>> #define _swaps(x, n) swaps(x,n)
>> #else
>> #define _swapl(x, n) swapl(x)
>> #define _swaps(x, n) swaps(x)
>> #endif
>>
>> If this feels "ickier" than the vararg, I'm really ok with either way.

I think this is the best way to go. If we did varargs, I think we'd
never remove it.

I haven't had time to fix the couple of drivers and I've got a midterm
this week, so.

Matt


More information about the xorg-devel mailing list