[PATCH] version.h: Add version check macro
Pier Luigi
pierluigi.fiorini at gmail.com
Sun Sep 29 02:57:12 PDT 2013
2013/9/24 Bill Spitzak <spitzak at gmail.com>:
>
>
> Kristian Høgsberg wrote:
>>
>> On Tue, Sep 24, 2013 at 12:54 AM, Marc Chalain <marc.chalain at gmail.com>
>> wrote:
>>
>>>
>>> But the WESTON_VERSION_AT_LEAST macro is wrong. You can check only the
>>> minor
>>> and not the rest of the version.
>>>
>>
>>
>> No, we don't guarantee plugin API stability between x.y releases, only
>> micro releases 1.2.x maintain that interface. Something developed for
>> 1.1.2 isn't guaranteed to work on 1.2.1, but anything written against
>> 1.2.1 will work on 1.2.2 and later 1.2.x releases.
>
> That does not seem right. This will require anybody writing a plugin using a
> feature added in 1.2.3 and never removed to do this:
>
> #if WESTON_VERSION_AT_LEAST(1,2,3) || WESTON_VERSION_AT_LEAST(1,3,0) ||
> WESTON_VERSION_AT_LEAST(1,4,0) || WESTON_VERSION_AT_LEAST(1,5,0) || ....etc
>
> If this macro was written the way I think most people expect, then in the
> case something vanishes in 1.3.0 they can write:
>
> #if WESTON_VERSION_AT_LEAST(1,3,0)
> ... it is missing (but there may be a better replacement) ...
> #elif WESTON_VERSION_AT_LEAST(1,2,3)
> ... use the api ...
> #else
> ... it is missing ...
> #endif
>
I think what Kristian meant is that no interface changes are allowed
in micro releases so big changes involving interfaces goes only on
minor release.
For example, if views are going in for 1.3 (haven't followed the list
much recently, but let's just assume it will), plugins would write a
check like this:
#if WESTON_VERSION_AT_LEAST(1,3,0)
... view stuff
#else
... old way of dealing with this stuff
#endif
And that's fine until Weston 2.x comes out, so the check will look like:
#if WESTON_VERSION_MAJOR >= 1 && WESTON_VERSION_AT_LEAST(1,3,0)
... view stuff
#else
... old way of dealing with this stuff
#endif
Perhaps we should keep the original version check macro the way I did it:
#define WESTON_VERSION_CHECK(major, minor, micro) ((major << 16) |
(minor << 8) | (micro))
So the check will look like much clean:
#if WESTON_VERSION_NUMBER >= WESTON_VERSION_CHECK(1, 3, 0)
... view stuff
#else
... old way
#endif
This gives plugin writers much more freedom and they can actually
check for micro versions too, which is useful if they want to make
sure Weston has certain features (that might not involve interface
changes).
--
Out of the box experience
http://www.maui-project.org/
More information about the wayland-devel
mailing list