[PATCH 1/2 v2] version: Fix WESTON_VERSION_AT_LEAST macro

Kristian Høgsberg krh at bitplanet.net
Mon Jan 27 11:35:41 PST 2014


I think it's clear that the current macro name is confusing and that
one might expect it to do something other than what it does.  I also
think the current usage and named makes sense.  But the main point is
that it's confusing, and we need to fix that.  However, thinking about
weston API promises, one of the few things that we can't really change
is the versioning mechanism.  With everything else being subject to
change, API users really need a realiable way to detect what version
they're dealing with.

I would like to just delete the macro and let module authors use the
WESTON_VERSION_MAJOR/MINOR/MICRO * fields directly to test for the
exact version condition they need. However, I think we'll have to
settle for a comment describing the behavior of the macro and
suggesting using the version fields directly instead:

/* This macro may not do what you expect.  Weston doesn't guarantee
 * any stable API between 1.X and 1.Y, and thus this macro will return
 * FALSE on any WESTON_VERSION_AT_LEAST(1,X,0) if the actualy version
 * is 1.Y.0 and X !=Y).  In particular, it fail if X < Y, that is,
 * 1.3.0 is considered to not be "at least" 1.4.0.
 *
 * If you want to test for the version number being 1.3.0 or above or
 * maybe in a range (eg 1.2.0 to 1.4.0), just use the WESTON_VERSION_*
 * defines above directly.
 */

Kristian

On Sat, Jan 25, 2014 at 8:39 AM, Pier Luigi <pierluigi.fiorini at gmail.com> wrote:
> What about defining a Weston API number increased each time the API changes?
>
> 2014-01-24 Eoff, Ullysses A <ullysses.a.eoff at intel.com>:
>> Furthermore, say I'm using Weston 1.3.91... a usage of
>> WESTON_VERSION_COMPATIBLE_WITH(1,3,0) would return
>> True (1), which is wrong since the API/ABI actually changed
>> somewhere between 1.3.90 and 1.3.91.
>>
>> Granted, most API/ABI consumers won't be using x.y.9z
>> development version series.   But, as it's written now, they
>> would be forced to add an extra check for every major/minor
>> release if they are supporting more than one API/ABI.
>>
>> Our usage model, however, is for the wayland-fits test suite
>> where it needs to support unstable (development versions)
>> and stable API/ABI in a continuous integration environment.
>>
>> Regardless, the macro logic needs to change so that it
>> appropriately reflects the macro name.
>>
>>> -----Original Message-----
>>> From: wayland-devel-bounces at lists.freedesktop.org [mailto:wayland-devel-bounces at lists.freedesktop.org] On Behalf Of Eoff,
>>> Ullysses A
>>> Sent: Friday, January 24, 2014 1:05 PM
>>> To: Daniel Stone
>>> Cc: wayland-devel at lists.freedesktop.org
>>> Subject: RE: [PATCH 1/2 v2] version: Fix WESTON_VERSION_AT_LEAST macro
>>>
>>> Even with just a rename, if the API/ABI doesn't change from 1.4.x to 1.5.x
>>> the macro wouldn't work if you used WESTON_VERSION_COMPATIBLE_WITH(1,4,0)
>>> when version == 1.5.0 as it's written now.
>>>
>>> That is, with a rename, the logic indicates that "No major or minor
>>> release is compatible with another major or minor release", regardless of
>>> API/ABI changes.
>>>
>>> > -----Original Message-----
>>> > From: Daniel Stone [mailto:daniel at fooishbar.org]
>>> > Sent: Friday, January 24, 2014 12:37 PM
>>> > To: Eoff, Ullysses A
>>> > Cc: wayland-devel at lists.freedesktop.org
>>> > Subject: Re: [PATCH 1/2 v2] version: Fix WESTON_VERSION_AT_LEAST macro
>>> >
>>> > Hi,
>>> > The macro should really be called WESTON_VERSION_COMPATIBLE_WITH() -
>>> > it's done that way specifically to allow breaking API/ABI at least
>>> > every minor release.
>>> >
>>> > Cheers,
>>> > Daniel
>>> >
>>> > On 24 January 2014 19:11, U. Artie Eoff <ullysses.a.eoff at intel.com> wrote:
>>> > > From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>
>>> > >
>>> > > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74023
>>> > >
>>> > > Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
>>> > > ---
>>> > >  src/version.h.in | 9 +++++----
>>> > >  1 file changed, 5 insertions(+), 4 deletions(-)
>>> > >
>>> > > diff --git a/src/version.h.in b/src/version.h.in
>>> > > index 79dba45..e72fea8 100644
>>> > > --- a/src/version.h.in
>>> > > +++ b/src/version.h.in
>>> > > @@ -30,8 +30,9 @@
>>> > >
>>> > >  /* Can be used like #if WESTON_VERSION_AT_LEAST(1, 2, 0) */
>>> > >  #define WESTON_VERSION_AT_LEAST(major, minor, micro) \
>>> > > -        (WESTON_VERSION_MAJOR == (major) && \
>>> > > -         WESTON_VERSION_MINOR == (minor) && \
>>> > > -         WESTON_VERSION_MICRO >= (micro))
>>> > > -
>>> > > +       ((WESTON_VERSION_MAJOR != major) ?            \
>>> > > +        (WESTON_VERSION_MAJOR > major) :            \
>>> > > +        ((WESTON_VERSION_MINOR != minor) ?          \
>>> > > +          (WESTON_VERSION_MINOR > minor) :          \
>>> > > +          (WESTON_VERSION_MICRO >= micro)))
>>> > >  #endif
>>> > > --
>>> > > 1.8.3.1
>>> > >
>>> > > _______________________________________________
>>> > > wayland-devel mailing list
>>> > > wayland-devel at lists.freedesktop.org
>>> > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>> _______________________________________________
>>> wayland-devel mailing list
>>> wayland-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
>
> --
> Out of the box experience
> http://www.maui-project.org/
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list