From 252c4dce618926311bcb4715eae6955f1bc71f13 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 15 Jan 2020 10:05:25 -0500 Subject: [PATCH] [gn build] find mistakes like the one fixed in 72b5989e0d1 at build time --- llvm/utils/gn/build/write_cmake_config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/utils/gn/build/write_cmake_config.py b/llvm/utils/gn/build/write_cmake_config.py index d76d14b..ef70648 100755 --- a/llvm/utils/gn/build/write_cmake_config.py +++ b/llvm/utils/gn/build/write_cmake_config.py @@ -73,6 +73,11 @@ def main(): in_line = var_re.sub(repl, in_line) if in_line.startswith('#cmakedefine01 '): _, var = in_line.split() + if values[var] == '0': + print('error: "%s=0" used with #cmakedefine01 %s' % (var, var)) + print(" '0' evaluates as truthy with #cmakedefine01") + print(' use "%s=" instead' % var) + return 1 in_line = '#define %s %d\n' % (var, 1 if values[var] else 0) unused_values.discard(var) elif in_line.startswith('#cmakedefine '): -- 2.7.4