mesonbuild/meson

`configure_file()` needs an option to verify all `configuration_data()` has been consumed

Open

#2,978 创建于 2018年1月26日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Python (4,978 star) (1,465 fork)batch import
enhancementgeneratorsgood first issuehelp wanted

描述

I'm working on bringing the Korn shell project back to life along with a few others like @siteshwar from Red Hat. We switched the project from the legacy Nmake build system to Meson and are extremely happy with that decision and the behavior of Meson (this has sped up the build by an order of magnitude).

Recently I implemented a change to switch from passing all the platform feature symbols via compiler -Dsomething flags to use the configure_file() mechanism. Because the legacy code has a huge number of platform feature symbols (approximately 600) I wanted to enumerate all of them in the input file for configure_file() to help us understand which symbols were not being defined by the feature detection logic. For example:

#mesondefine _hdr_wchar
#mesondefine _hdr_wctype

#mesondefine _lib_BSDsetpgrp
#mesondefine _lib_MD4Init

I found that I had omitted several symbols from the template that were in the configuration_data() object. But that wasn't immediately obvious because Meson silently ignores any symbols in the configuration_data() object which are not consumed by the template. It would make debugging such problems easier if there were a way to tell configure_file() that it should fail if any of the symbols were not used by the template. Personally I think that should have been the default behavior but obviously we can't make that the default now as it isn't backward compatible.

I'd like to add something like a strict_subset : true optional argument to indicate the template must consume all the config data symbols. A strict : true arg to indicate that the config object and the template must contain the same set of symbols might also be useful. Once there is agreement that a) this feature is useful enough to implement, and b) there is agreement about the API I'm happy to do the work to implement it. This issue is primarily to see if there is agreement on items "a" and "b".

贡献者指南

`configure_file()` needs an option to verify all `configuration_data()` has been consumed · mesonbuild/meson#2978 | Good First Issue