[PATCH] D28294: [cmake] Canonicalize CMake booleans to 0/1 for Python interop
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 07:47:00 PST 2017
mgorny created this revision.
mgorny added reviewers: beanz, enderby, chandlerc, zturner, whitequark.
mgorny added a subscriber: llvm-commits.
Herald added a subscriber: axw.
Canonicalize all CMake booleans to 0/1 before passing them to lit, to
ensure that the Python side handles all of them consistently
and correctly. 0/1 is a safe choice of values that trigger the same
boolean interpretation in CMake, Python and C++.
Furthermore, using them without quotes improves the chance Python will
explicitly fail when an incorrect value (such as ON/OFF, TRUE/FALSE,
YES/NO) is accidentally passed, rather than silently misinterpreting
the value.
This replaces a lot of different logics spread around lit site files,
attempting to partially reproduce the boolean logic used in CMake
and usually silently failing when an uncommon value was used instead.
In fact, some of them were never working correctly since different
values were assigned in CMake and checked in Python.
The alternative solution could be to create a common parser for CMake
booleans in lit and use it consistently throughout the site files.
However, it does not seem like the best idea to create redundant
implementation of the same logic and have to follow upstream if it ever
is extended to handle more values.
https://reviews.llvm.org/D28294
Files:
cmake/config-ix.cmake
cmake/modules/AddLLVM.cmake
test/Bindings/Go/lit.local.cfg
test/Bindings/OCaml/lit.local.cfg
test/CMakeLists.txt
test/ExecutionEngine/Interpreter/lit.local.cfg
test/JitListener/lit.local.cfg
test/lit.cfg
test/lit.site.cfg.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28294.83055.patch
Type: text/x-patch
Size: 6282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170104/e0ad4974/attachment.bin>
More information about the llvm-commits
mailing list