enable LTO

This commit is contained in:
blueloveTH 2023-10-11 13:20:48 +08:00
parent df4e0e329a
commit 7c3ac48202
3 changed files with 18 additions and 3 deletions

View File

@ -80,3 +80,11 @@ endif()
if(PK_EXPORT_CXX_SYMBOLS AND MSVC) if(PK_EXPORT_CXX_SYMBOLS AND MSVC)
set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif() endif()
# enable link time optimization
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result)
message(STATUS "LTO enabled")
set_target_properties(${PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

View File

@ -283,7 +283,7 @@ static bool is_unicode_Lo_char(uint32_t c) {
int base = 10; int base = 10;
if (m[1].matched) { if (m[1].matched) {
char tag = m[1].first.base()[1]; char tag = m[1].first[1];
switch (tag) { switch (tag) {
case 'x': base = 16; break; case 'x': base = 16; break;
case 'o': base = 8; break; case 'o': base = 8; break;
@ -303,7 +303,7 @@ static bool is_unicode_Lo_char(uint32_t c) {
} }
add_token(TK("@num"), out); add_token(TK("@num"), out);
} else { } else {
std::string_view text(m[0].first.base(), m[0].length()); std::string_view text(&m[0].first[0], m[0].length());
i64 out; i64 out;
bool ok = parse_int(text, &out, base); bool ok = parse_int(text, &out, base);
if(!ok){ if(!ok){

View File

@ -2,16 +2,23 @@
assert 0xffff == 65535 assert 0xffff == 65535
assert 0xAAFFFF == 11206655 assert 0xAAFFFF == 11206655
assert 0x7fffffff == 2147483647 assert 0x7fffffff == 2147483647
assert -0xffff == -65535
assert -0xAAFFFF == -11206655
assert -0x7fffffff == -2147483647
# test 64-bit # test 64-bit
assert 2**60-1 + 546 - 0xfffffffffffff == 1148417904979477026 assert 2**60-1 + 546 - 0xfffffffffffff == 1148417904979477026
# test oct literals # test oct literals
assert 0o1234 == 668 assert 0o1234 == 668
assert 0o17777777777 == 2147483647 assert 0o17777777777 == 2147483647
assert -0o1234 == -668
assert -0o17777777777 == -2147483647
# test binary literals # test binary literals
assert 0b10010 == 18 assert 0b10010 == 18
assert -0b10010 == -18
assert 0b11111111111111111111111111111111 == 4294967295 assert 0b11111111111111111111111111111111 == 4294967295
assert -0b11111 == -31
# test == != >= <= < > # test == != >= <= < >
assert -1 == -1 assert -1 == -1