Merge pull request #44928 from vcunat/p/configure-assert

lib/strings: guard against an easy mistake
This commit is contained in:
Eelco Dolstra 2020-11-11 11:14:12 +01:00 committed by GitHub
commit f9dd8f04a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -561,7 +561,9 @@ rec {
enableFeature false "shared"
=> "--disable-shared"
*/
enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
enableFeature = enable: feat:
assert isString feat; # e.g. passing openssl instead of "openssl"
"--${if enable then "enable" else "disable"}-${feat}";
/* Create an --{enable-<feat>=<value>,disable-<feat>} string that can be passed to
standard GNU Autoconf scripts.
@ -583,7 +585,9 @@ rec {
withFeature false "shared"
=> "--without-shared"
*/
withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}";
withFeature = with_: feat:
assert isString feat; # e.g. passing openssl instead of "openssl"
"--${if with_ then "with" else "without"}-${feat}";
/* Create an --{with-<feat>=<value>,without-<feat>} string that can be passed to
standard GNU Autoconf scripts.