On 04/26/2017 11:21 AM, Eric Anholt wrote: > Aaron Plattner <aplatt...@nvidia.com> writes: > >> We try to do exactly the opposite in our internal driver build, because >> it's too easy to accidentally do something like >> >> #ifdef GLAMOUR_HAS_GBM >> >> And mistakes like that don't always cause obvious build failures like >> this would. So we build everything with -Wundef -Werror=undef and try to >> use #if whenever possible. It's a shame that Meson makes that hard. > > Meson makes what you want easy with: > > set10(varname, boolean_value) is the same as above but the value is > either true or false and will be written as 1 or 0, respectively > > but autotools usually produces either #define 1 or #undef, unless you go > through contortions. This seemed like the easy, consistent solution > today, given that our codebase is almost all #ifdef. One alternative > would be to just disable -Wundef for now. The other alternative to this > patch would be something like: > > conf_array += ['HAVE_DBM_H', cc.has_header('dbm.h')] > > then finish with something like: > > foreach conf: conf_array > if conf[1] > conf_data.set(conf[0], '1') > endif > endforeach > > but I think I'd rather wait and consistently swap to .set10() and #if > once we've nuked autotools.
Waiting until autotools is nuked sounds fine to me. I just wanted to throw the idea of using -Wundef out there. -- Aaron _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel