Skip to content

Commit 252c4dc

Browse files
committed
[gn build] find mistakes like the one fixed in 72b5989 at build time
1 parent ada01d1 commit 252c4dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/utils/gn/build/write_cmake_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ def repl(m):
7373
in_line = var_re.sub(repl, in_line)
7474
if in_line.startswith('#cmakedefine01 '):
7575
_, var = in_line.split()
76+
if values[var] == '0':
77+
print('error: "%s=0" used with #cmakedefine01 %s' % (var, var))
78+
print(" '0' evaluates as truthy with #cmakedefine01")
79+
print(' use "%s=" instead' % var)
80+
return 1
7681
in_line = '#define %s %d\n' % (var, 1 if values[var] else 0)
7782
unused_values.discard(var)
7883
elif in_line.startswith('#cmakedefine '):

0 commit comments

Comments
 (0)