[Mesa-dev] [PATCH] meson: fix warnings about comparing unlike types

Dylan Baker dylan at pnwbakers.com
Thu Mar 29 18:23:55 UTC 2018


Quoting Caio Marcelo de Oliveira Filho (2018-03-29 11:13:51)
> On Thu, Mar 29, 2018 at 09:31:13AM -0700, Dylan Baker wrote:
> > In the old days (0.42.x), when mesa's meson system was written the
> > recommendation for handling conditional dependencies was to define them
> > as empty lists. When meson would evaluate the dependencies of a target
> > it would recursively flatten all of the arguments, and empty lists would
> > be removed. There are some problems with this, among them that lists and
> > dependencies have different methods (namely .found()), so the
> > recommendation changed to use `declare_dependency()` for such cases.
> > This has the advantage of providing a .found() method, so there is no
> > need to do things like `dep_foo != [] and dep_foo.found()`.
> 
> What about using dependency('', required: false) instead?
> 
> http://mesonbuild.com/Reference-manual.html#dependency
> 
>     If dependency_name is '', the dependency is always not found. So
>     with required: false, this always returns a dependency object for
>     which the found() method returns false, and which can be passed
>     like any other dependency to the dependencies: keyword argument of
>     a build_target. This can be used to implement a dependency which
>     is sometimes not required e.g. in some branches of a conditional.
> 
> Maybe even having a variable named notfound (or optional, or something
> similar) with such dependency, and assign it to the other variables.
> 
> From reading the docs for declare_dependency() it doesn't really
> guarantee that found() would be false, while the approach above is
> documented as what we want.
> 
> 
> Thanks,
> Caio

I'll look at it again, I seem to remember that being added relatively recently
(I would like to bump the dependency to 0.44 anyway, so maybe that's as good of
a reason). I'll check and see what it says.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180329/3c9d737d/attachment.sig>


More information about the mesa-dev mailing list