diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-01-04 18:38:23 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-01-06 17:46:45 (GMT) |
commit | 9c9f69fb9c0c1ab1f62de646cffe48485bd893af (patch) | |
tree | 483e4b7e1021b4217d415fca3a615bfc95293fb5 | |
parent | 6eb32181052e2262fd2b8ed1d6fa19e279d7ae5e (diff) | |
download | CMake-9c9f69fb9c0c1ab1f62de646cffe48485bd893af.zip CMake-9c9f69fb9c0c1ab1f62de646cffe48485bd893af.tar.gz CMake-9c9f69fb9c0c1ab1f62de646cffe48485bd893af.tar.bz2 |
Genex: Make EQUAL support upper case binary literals
As C++11, python, D and java do.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf
Add test for uppercase hex literals.
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 12 | ||||
-rw-r--r-- | Tests/GeneratorExpression/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/GeneratorExpression/check-part3.cmake | 6 |
3 files changed, 19 insertions, 15 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index fec43b9..259ba94 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -215,18 +215,18 @@ static const struct EqualNode : public cmGeneratorExpressionNode bool flipSign = false; const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b")) + if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) { base = 2; lhs += 2; } - if (cmHasLiteralPrefix(lhs, "-0b")) + if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) { base = 2; lhs += 3; flipSign = true; } - if (cmHasLiteralPrefix(lhs, "+0b")) + if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) { base = 2; lhs += 3; @@ -249,18 +249,18 @@ static const struct EqualNode : public cmGeneratorExpressionNode flipSign = false; const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b")) + if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) { base = 2; rhs += 2; } - if (cmHasLiteralPrefix(rhs, "-0b")) + if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) { base = 2; rhs += 3; flipSign = true; } - if (cmHasLiteralPrefix(rhs, "+0b")) + if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) { base = 2; rhs += 3; diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4fb7ecd..9512efc 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -199,7 +199,7 @@ add_custom_target(check-part3 ALL -Dequal1=$<EQUAL:1,2> -Dequal2=$<EQUAL:1,1> -Dequal3=$<EQUAL:0x1,1> - -Dequal4=$<EQUAL:0x1,2> + -Dequal4=$<EQUAL:0X1,2> -Dequal5=$<EQUAL:0xA,0xa> -Dequal6=$<EQUAL:0xA,10> -Dequal7=$<EQUAL:0xA,012> @@ -208,15 +208,17 @@ add_custom_target(check-part3 ALL -Dequal10=$<EQUAL:10,0b1010> -Dequal11=$<EQUAL:-10,-0xa> -Dequal12=$<EQUAL:10,+0xa> - -Dequal13=$<EQUAL:+10,+0xa> + -Dequal13=$<EQUAL:+10,+0Xa> -Dequal14=$<EQUAL:+10,0xa> - -Dequal15=$<EQUAL:-10,-0xa> + -Dequal15=$<EQUAL:-10,-0Xa> -Dequal16=$<EQUAL:-10,-0b1010> -Dequal17=$<EQUAL:-10,+0b1010> - -Dequal18=$<EQUAL:10,+0b1010> - -Dequal19=$<EQUAL:10,+012> - -Dequal20=$<EQUAL:10,-012> - -Dequal21=$<EQUAL:-10,-012> + -Dequal18=$<EQUAL:10,+0B1010> + -Dequal19=$<EQUAL:10,-0B1010> + -Dequal20=$<EQUAL:10,0B1010> + -Dequal21=$<EQUAL:10,+012> + -Dequal22=$<EQUAL:10,-012> + -Dequal23=$<EQUAL:-10,-012> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" VERBATIM diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 2c6bf49..70ccfe1 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -55,6 +55,8 @@ check(equal15 "1") check(equal16 "1") check(equal17 "0") check(equal18 "1") -check(equal19 "1") -check(equal20 "0") +check(equal19 "0") +check(equal20 "1") check(equal21 "1") +check(equal22 "0") +check(equal23 "1") |