From a829f705d21267f2252d5aa84fb6213460b1ea33 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Fri, 24 Jan 2020 22:27:54 +0100 Subject: [PATCH] Improved platform detection --- CMakeLists.txt | 1 - src/query/command2.cpp | 4 +++- test/CommandTest.cpp | 40 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d079d1..c863afd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,6 @@ INSTALL ( set(TEST_LIBRARIES threadpool::static #Static - TeaSpeak #Static CXXTerminal::static #Static ${StringVariable_LIBRARIES_STATIC} ${YAML_CPP_LIBRARIES} diff --git a/src/query/command2.cpp b/src/query/command2.cpp index c965c2f..9364216 100644 --- a/src/query/command2.cpp +++ b/src/query/command2.cpp @@ -127,7 +127,9 @@ command command::parse(const std::string_view &data, bool expect_type, bool drop } size_t bulk_index = 0; - while(++current_index > 0 || (current_index == 0 && !expect_type && (expect_type = true))) { + while(++current_index > 0 || (current_index == 0 && !expect_type)) { + expect_type = true; + end_index = data.find_first_of(" |", current_index); if(end_index != current_index) { /* else we've found another space or a pipe */ diff --git a/test/CommandTest.cpp b/test/CommandTest.cpp index fdd689f..d97c93b 100644 --- a/test/CommandTest.cpp +++ b/test/CommandTest.cpp @@ -50,15 +50,23 @@ void handleCommand( const field::optional::bulked& key_c, const trigger& switch_test ) { - if(key_a.value() < 10) - cout << "ERROR" << endl; + if(key_a.value() < 10) { + __asm__("nop"); + } + __asm__("nop"); auto b = key_c.as(); + __asm__("nop"); string key_c_str = key_c; + __asm__("nop"); auto c = key_b.has_value(); - cout << key_c[1].value() << endl; - cout << "Return code: " << return_code.get_or("XXX") << endl; + __asm__("nop"); + (void) key_c[1].value(); + __asm__("nop"); + (void) return_code.get_or("XXX"); + //cout << << endl; + //cout << "Return code: " << return_code.get_or("XXX") << endl; __asm__("nop"); } @@ -85,7 +93,31 @@ void eval_test(command_result x) { } } +struct A { + virtual ~A() { puts("~A\n"); } +}; + +struct B : public A { + virtual ~B() { puts("~B\n"); } +}; + int main() { + make_command_result(error::accounting_slot_limit_reached, ""); + /* +0x559e5259a479 : lea 0xa0(%rsp),%rbx +0x559e5259a481 : lea 0x30(%rsp),%r14 +0x559e5259a486 : callq 0x559e525579d0 +0x559e5259a48b : lea 0x17e6a6(%rip),%rdi # 0x559e52718b38 +0x559e5259a492 : mov %rax,%rbp +0x559e5259a495 : callq 0x559e52558b10 +0x559e5259a49a : mov $0x1,%esi +0x559e5259a49f : mov %rbp,%rdi +0x559e5259a4a2 : callq 0x559e525573d0 + */ + { + A* var = new B{}; + delete var; + } test<"abs">(); //for(const auto& error : avariableErrors) // cout << error.name << " = " << hex << "0x" << error.errorId << "," << endl;