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.
This commit is contained in:
parent
6eb3218105
commit
9c9f69fb9c
|
@ -215,18 +215,18 @@ static const struct EqualNode : public cmGeneratorExpressionNode
|
||||||
bool flipSign = false;
|
bool flipSign = false;
|
||||||
|
|
||||||
const char *lhs = parameters[0].c_str();
|
const char *lhs = parameters[0].c_str();
|
||||||
if (cmHasLiteralPrefix(lhs, "0b"))
|
if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
lhs += 2;
|
lhs += 2;
|
||||||
}
|
}
|
||||||
if (cmHasLiteralPrefix(lhs, "-0b"))
|
if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
lhs += 3;
|
lhs += 3;
|
||||||
flipSign = true;
|
flipSign = true;
|
||||||
}
|
}
|
||||||
if (cmHasLiteralPrefix(lhs, "+0b"))
|
if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
lhs += 3;
|
lhs += 3;
|
||||||
|
@ -249,18 +249,18 @@ static const struct EqualNode : public cmGeneratorExpressionNode
|
||||||
flipSign = false;
|
flipSign = false;
|
||||||
|
|
||||||
const char *rhs = parameters[1].c_str();
|
const char *rhs = parameters[1].c_str();
|
||||||
if (cmHasLiteralPrefix(rhs, "0b"))
|
if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
rhs += 2;
|
rhs += 2;
|
||||||
}
|
}
|
||||||
if (cmHasLiteralPrefix(rhs, "-0b"))
|
if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
rhs += 3;
|
rhs += 3;
|
||||||
flipSign = true;
|
flipSign = true;
|
||||||
}
|
}
|
||||||
if (cmHasLiteralPrefix(rhs, "+0b"))
|
if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B"))
|
||||||
{
|
{
|
||||||
base = 2;
|
base = 2;
|
||||||
rhs += 3;
|
rhs += 3;
|
||||||
|
|
|
@ -199,7 +199,7 @@ add_custom_target(check-part3 ALL
|
||||||
-Dequal1=$<EQUAL:1,2>
|
-Dequal1=$<EQUAL:1,2>
|
||||||
-Dequal2=$<EQUAL:1,1>
|
-Dequal2=$<EQUAL:1,1>
|
||||||
-Dequal3=$<EQUAL:0x1,1>
|
-Dequal3=$<EQUAL:0x1,1>
|
||||||
-Dequal4=$<EQUAL:0x1,2>
|
-Dequal4=$<EQUAL:0X1,2>
|
||||||
-Dequal5=$<EQUAL:0xA,0xa>
|
-Dequal5=$<EQUAL:0xA,0xa>
|
||||||
-Dequal6=$<EQUAL:0xA,10>
|
-Dequal6=$<EQUAL:0xA,10>
|
||||||
-Dequal7=$<EQUAL:0xA,012>
|
-Dequal7=$<EQUAL:0xA,012>
|
||||||
|
@ -208,15 +208,17 @@ add_custom_target(check-part3 ALL
|
||||||
-Dequal10=$<EQUAL:10,0b1010>
|
-Dequal10=$<EQUAL:10,0b1010>
|
||||||
-Dequal11=$<EQUAL:-10,-0xa>
|
-Dequal11=$<EQUAL:-10,-0xa>
|
||||||
-Dequal12=$<EQUAL:10,+0xa>
|
-Dequal12=$<EQUAL:10,+0xa>
|
||||||
-Dequal13=$<EQUAL:+10,+0xa>
|
-Dequal13=$<EQUAL:+10,+0Xa>
|
||||||
-Dequal14=$<EQUAL:+10,0xa>
|
-Dequal14=$<EQUAL:+10,0xa>
|
||||||
-Dequal15=$<EQUAL:-10,-0xa>
|
-Dequal15=$<EQUAL:-10,-0Xa>
|
||||||
-Dequal16=$<EQUAL:-10,-0b1010>
|
-Dequal16=$<EQUAL:-10,-0b1010>
|
||||||
-Dequal17=$<EQUAL:-10,+0b1010>
|
-Dequal17=$<EQUAL:-10,+0b1010>
|
||||||
-Dequal18=$<EQUAL:10,+0b1010>
|
-Dequal18=$<EQUAL:10,+0B1010>
|
||||||
-Dequal19=$<EQUAL:10,+012>
|
-Dequal19=$<EQUAL:10,-0B1010>
|
||||||
-Dequal20=$<EQUAL:10,-012>
|
-Dequal20=$<EQUAL:10,0B1010>
|
||||||
-Dequal21=$<EQUAL:-10,-012>
|
-Dequal21=$<EQUAL:10,+012>
|
||||||
|
-Dequal22=$<EQUAL:10,-012>
|
||||||
|
-Dequal23=$<EQUAL:-10,-012>
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
|
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
|
|
|
@ -55,6 +55,8 @@ check(equal15 "1")
|
||||||
check(equal16 "1")
|
check(equal16 "1")
|
||||||
check(equal17 "0")
|
check(equal17 "0")
|
||||||
check(equal18 "1")
|
check(equal18 "1")
|
||||||
check(equal19 "1")
|
check(equal19 "0")
|
||||||
check(equal20 "0")
|
check(equal20 "1")
|
||||||
check(equal21 "1")
|
check(equal21 "1")
|
||||||
|
check(equal22 "0")
|
||||||
|
check(equal23 "1")
|
||||||
|
|
Loading…
Reference in New Issue