From fb62cb7589b73b7cf678658c33e95f172f7bf05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 26 Feb 2024 15:04:43 +0300 Subject: [PATCH 01/12] init --- .github/workflows/Dockerfile.buster | 3 ++- .github/workflows/Dockerfile.focal | 3 ++- .github/workflows/Dockerfile.jammy | 3 ++- cmake/init-global-vars.cmake | 2 +- compiler/compiler-settings.cpp | 5 +++-- runtime/runtime.cmake | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 09f667fd8d..bec76c9286 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -20,7 +20,8 @@ RUN apt-get update && \ apt-get update && \ apt-get install -y --no-install-recommends \ git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \ - python3.7 python3-dev libpython3-dev python3-pip python3-setuptools mysql-server libmysqlclient-dev && \ + python3.7 python3-dev libpython3-dev python3-pip python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ + libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ pip3 install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 255e51a82d..0d00b5c9d8 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -13,7 +13,8 @@ RUN apt-get update && \ apt-get update && \ apt-get install -y --no-install-recommends \ git cmake make clang g++ g++-10 gperf netcat \ - python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ + python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ + libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ diff --git a/.github/workflows/Dockerfile.jammy b/.github/workflows/Dockerfile.jammy index 1dd63369c2..be1afcbbfa 100644 --- a/.github/workflows/Dockerfile.jammy +++ b/.github/workflows/Dockerfile.jammy @@ -15,7 +15,8 @@ RUN apt update && \ apt update && \ apt install -y --no-install-recommends \ git cmake make g++ lld gperf netcat \ - python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ + python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ + libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ apt install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libnuma-dev unzip \ diff --git a/cmake/init-global-vars.cmake b/cmake/init-global-vars.cmake index e9787f5b8f..95e32e201c 100644 --- a/cmake/init-global-vars.cmake +++ b/cmake/init-global-vars.cmake @@ -11,7 +11,7 @@ if(APPLE) set(CURL_LIB curl) set(ICONV_LIB iconv) else() - set(CURL_LIB /opt/curl7600/lib/libcurl.a) + set(CURL_LIB /opt/curl840/lib/libcurl-nss.a) set(RT_LIB rt) set(NUMA_LIB numa) endif() diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index df948b0d98..521fc8bd8f 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -132,9 +132,10 @@ void append_curl(std::string &cxx_flags, std::string &ld_flags) noexcept { ld_flags += " -lcurl"; #else // TODO make it as an option? - const std::string curl_dir = "/opt/curl7600"; + const std::string curl_dir = "/opt/curl840"; cxx_flags += " -I" + curl_dir + "/include/"; - ld_flags += " " + curl_dir + "/lib/libcurl.a"; + ld_flags += " " + curl_dir + "/lib/libcurl-nss.a"; + ld_flags += " -lssh2 -lcares -lbrotlicommon -lbrotlidec" #endif } } diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index f7e0ab8222..ce973e8131 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -142,7 +142,7 @@ allow_deprecated_declarations(${BASE_DIR}/runtime/allocator.cpp ${BASE_DIR}/runt allow_deprecated_declarations_for_apple(${BASE_DIR}/runtime/inter-process-mutex.cpp) vk_add_library(kphp_runtime OBJECT ${KPHP_RUNTIME_ALL_SOURCES}) -target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl7600/include) +target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl840/include) add_dependencies(kphp_runtime kphp-timelib) From f8e4ac25f0848feed1aab7a55b9b4a414a86acc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 26 Feb 2024 15:14:06 +0300 Subject: [PATCH 02/12] link curl depencies to unittests --- runtime/runtime.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index ce973e8131..85fa6643bb 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -146,7 +146,7 @@ target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl840/include) add_dependencies(kphp_runtime kphp-timelib) -prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? +prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3 ssh2 brotlicommon brotlidec cares) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} OpenSSL::Crypto m z pthread) vk_add_library(kphp-full-runtime STATIC) target_link_libraries(kphp-full-runtime PUBLIC ${RUNTIME_LIBS}) From 631f341a7f67bd8912686d664c01788020042101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 26 Feb 2024 15:25:06 +0300 Subject: [PATCH 03/12] disable gh actions for buster and focal die to old curl --- .github/workflows/Build.yml | 30 +++++++++++++++--------------- compiler/compiler-settings.cpp | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d3c8d31e5f..01740aa89b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,21 +18,21 @@ jobs: strategy: matrix: include: - - os: buster - compiler: g++ - cpp: 17 - asan: off - ubsan: off - - os: focal - compiler: clang++ - cpp: 17 - asan: off - ubsan: on - - os: focal - compiler: g++-10 - cpp: 20 - asan: on - ubsan: off + # - os: buster + # compiler: g++ + # cpp: 17 + # asan: off + # ubsan: off + # - os: focal + # compiler: clang++ + # cpp: 17 + # asan: off + # ubsan: on + # - os: focal + # compiler: g++-10 + # cpp: 20 + # asan: on + # ubsan: off - os: jammy compiler: g++ cpp: 20 diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 521fc8bd8f..04cf90b4a5 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -135,7 +135,7 @@ void append_curl(std::string &cxx_flags, std::string &ld_flags) noexcept { const std::string curl_dir = "/opt/curl840"; cxx_flags += " -I" + curl_dir + "/include/"; ld_flags += " " + curl_dir + "/lib/libcurl-nss.a"; - ld_flags += " -lssh2 -lcares -lbrotlicommon -lbrotlidec" + ld_flags += " -lssh2 -lcares -lbrotlicommon -lbrotlidec"; #endif } } From d235fac0be1a01e4b386820fd98d94ebd21d091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 28 Feb 2024 19:53:14 +0300 Subject: [PATCH 04/12] return to curl7600 folder temp --- cmake/init-global-vars.cmake | 2 +- compiler/compiler-settings.cpp | 4 ++-- runtime/runtime.cmake | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/init-global-vars.cmake b/cmake/init-global-vars.cmake index 95e32e201c..e9787f5b8f 100644 --- a/cmake/init-global-vars.cmake +++ b/cmake/init-global-vars.cmake @@ -11,7 +11,7 @@ if(APPLE) set(CURL_LIB curl) set(ICONV_LIB iconv) else() - set(CURL_LIB /opt/curl840/lib/libcurl-nss.a) + set(CURL_LIB /opt/curl7600/lib/libcurl.a) set(RT_LIB rt) set(NUMA_LIB numa) endif() diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 04cf90b4a5..d8ef6409eb 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -132,9 +132,9 @@ void append_curl(std::string &cxx_flags, std::string &ld_flags) noexcept { ld_flags += " -lcurl"; #else // TODO make it as an option? - const std::string curl_dir = "/opt/curl840"; + const std::string curl_dir = "/opt/curl7600"; cxx_flags += " -I" + curl_dir + "/include/"; - ld_flags += " " + curl_dir + "/lib/libcurl-nss.a"; + ld_flags += " " + curl_dir + "/lib/libcurl.a"; ld_flags += " -lssh2 -lcares -lbrotlicommon -lbrotlidec"; #endif } diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index 85fa6643bb..907c422e16 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -142,7 +142,7 @@ allow_deprecated_declarations(${BASE_DIR}/runtime/allocator.cpp ${BASE_DIR}/runt allow_deprecated_declarations_for_apple(${BASE_DIR}/runtime/inter-process-mutex.cpp) vk_add_library(kphp_runtime OBJECT ${KPHP_RUNTIME_ALL_SOURCES}) -target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl840/include) +target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl7600/include) add_dependencies(kphp_runtime kphp-timelib) From 6baeed1732aa5493381b3f302945ad20db9bafb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Fri, 1 Mar 2024 23:18:35 +0300 Subject: [PATCH 05/12] empty string as response is not valid --- runtime/curl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/curl.cpp b/runtime/curl.cpp index 5d035e4a2e..98a4f0c8d9 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -1144,7 +1144,7 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { } string content = easy_context->received_data.concat_and_get_string(); - curl_request->finish_request(std::move(content)); + curl_request->finish_request(!content.empty() ? std::move(content) : Optional{false}); } return 0; } From afe9eac62d1a0518e8cf5f9657b8b10cb016b675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 4 Mar 2024 16:06:08 +0300 Subject: [PATCH 06/12] run python curl tests in debug mode --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 01740aa89b..8b75fdb1e9 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' From 0520ebd42080c50cc4142054fa7b2fc18367a9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 4 Mar 2024 19:01:15 +0300 Subject: [PATCH 07/12] return --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 8b75fdb1e9..01740aa89b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/'" + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' From 45fe15c4f482552c6832263d5c00086ab716b909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 4 Mar 2024 21:04:57 +0300 Subject: [PATCH 08/12] run specific test with debug --- .github/workflows/Build.yml | 2 +- runtime/curl.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 01740aa89b..79d16c3ab8 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' diff --git a/runtime/curl.cpp b/runtime/curl.cpp index 98a4f0c8d9..e8962223da 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -1144,6 +1144,8 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { } string content = easy_context->received_data.concat_and_get_string(); + // check if CURLOPT_CONNECT_ONLY + printf("test = %d\n", easy_context->connection_only); curl_request->finish_request(!content.empty() ? std::move(content) : Optional{false}); } return 0; From 869de963b52c9974e7d8bdd2aff1a2a2567f3124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 4 Mar 2024 21:59:03 +0300 Subject: [PATCH 09/12] try to fix --- .github/workflows/Build.yml | 4 ++-- runtime/curl.cpp | 42 +++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 79d16c3ab8..7ff1f5ecf3 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -36,7 +36,7 @@ jobs: - os: jammy compiler: g++ cpp: 20 - asan: on + asan: off ubsan: off name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' diff --git a/runtime/curl.cpp b/runtime/curl.cpp index e8962223da..f6e3f8c181 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -160,6 +160,7 @@ class EasyContext : public BaseContext { } void release() noexcept { + printf("libcurl version = %s\n", curl_version()); curl_easy_cleanup(easy_handle); cleanup_slists_and_posts(); this->~EasyContext(); @@ -1131,6 +1132,11 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { int running_handles = 0; multi_context->error_num = dl::critical_section_call(curl_multi_socket_action, multi_context->multi_handle, fd, flags, &running_handles); + // if (multi_context->error_num) { + // curl_request->finish_request(Optional{false}); + // return 0; + // } + if (multi_context->error_num != CURLM_OK) { curl_request->finish_request(); return 0; @@ -1143,10 +1149,38 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { return 0; } - string content = easy_context->received_data.concat_and_get_string(); - // check if CURLOPT_CONNECT_ONLY - printf("test = %d\n", easy_context->connection_only); - curl_request->finish_request(!content.empty() ? std::move(content) : Optional{false}); + string data = easy_context->received_data.concat_and_get_string(); + string header = easy_context->received_header.concat_and_get_string(); + + printf("HEADER = %s\n", header.c_str()); + printf("DATA = %s\n", data.c_str()); + // bool return_content = true; + // bool connection_only = easy_context->connection_only; + // // default if connection_only + // // if connection_only and url non exist in test this code is unreachable + // bool url_exist = true; + // if (!connection_only) + // url_exist = easy_context->get_info(CURLINFO_RESPONSE_CODE).to_int() == 200; + + // if (connection_only) + // if (url_exist) + // return_content = true; + // else + // return_content = false; + // else if (url_exist) + // return_content = true; + // else + // return_content = false; + + // received_header + + // if (CURLE_OK == dl::critical_section_call(curl_easy_perform, easy_context->easy_handle)) + // curl_request->finish_request(std::move(content)); + // else + // curl_request->finish_request(Optional{false}); + + curl_request->finish_request(std::move(data)); + } return 0; } From ba71d5b8757c3cc30192c9b145a9ad51f9b92c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 6 Mar 2024 22:58:42 +0300 Subject: [PATCH 10/12] force curl version on jammy --- .github/workflows/Build.yml | 2 +- .github/workflows/Dockerfile.jammy | 6 +- .idea/codeStyleSettings.xml | 106 ----------------------------- .idea/encodings.xml | 10 --- .idea/jsonSchemas.xml | 40 ----------- .idea/misc.xml | 28 -------- compiler/gentree.h | 24 ++++--- runtime/curl.cpp | 54 +++++---------- runtime/runtime.cmake | 4 +- 9 files changed, 36 insertions(+), 238 deletions(-) delete mode 100644 .idea/codeStyleSettings.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/jsonSchemas.xml delete mode 100644 .idea/misc.xml diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 7ff1f5ecf3..a428ee94de 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" + "chown -R kitten /home && su kitten -c 'KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' diff --git a/.github/workflows/Dockerfile.jammy b/.github/workflows/Dockerfile.jammy index be1afcbbfa..f83b74cd79 100644 --- a/.github/workflows/Dockerfile.jammy +++ b/.github/workflows/Dockerfile.jammy @@ -18,7 +18,7 @@ RUN apt update && \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ - apt install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt install -y --no-install-recommends curl-kphp-vk=20240228.jammy.62.build.642 kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libnuma-dev unzip \ libldap-dev libkrb5-dev postgresql postgresql-server-dev-all && \ rm -rf /var/lib/apt/lists/* @@ -27,8 +27,8 @@ RUN apt update && \ RUN update-alternatives --set php /usr/bin/php7.4 # setup default linker to lld, this allows to reduce python tests' execution time on ~10 min -RUN update-alternatives --install /usr/bin/ld ld /usr/bin/x86_64-linux-gnu-ld 10 && \ - update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 20 +# RUN update-alternatives --install /usr/bin/ld ld /usr/bin/x86_64-linux-gnu-ld 10 && \ +# update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 20 # apt - based composer has version 2, but we need 1 # next code install composer of version 1 diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index 601c77e3bf..0000000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 7034a174ce..0000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/.idea/jsonSchemas.xml b/.idea/jsonSchemas.xml deleted file mode 100644 index c3b2d9a320..0000000000 --- a/.idea/jsonSchemas.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index bdd226825f..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compiler/gentree.h b/compiler/gentree.h index 31e5fe6314..ae9a55d9f7 100644 --- a/compiler/gentree.h +++ b/compiler/gentree.h @@ -24,9 +24,9 @@ class GenTree { T &top_element; public: - StackPushPop(std::vector &stack, T &top_element, T elem_to_push) : - stack(stack), - top_element(top_element) { + StackPushPop(std::vector &stack, T &top_element, T elem_to_push) + : stack(stack) + , top_element(top_element) { stack.emplace_back(elem_to_push); top_element = elem_to_push; } @@ -38,14 +38,17 @@ class GenTree { }; public: - Location auto_location() const { return Location{this->line_num}; } + Location auto_location() const { + return Location{this->line_num}; + } static bool is_magic_method_name_allowed(const std::string &name); - GenTree(std::vector tokens, SrcFilePtr file, DataStream &os); - bool test_expect(TokenType tp) { return cur->type() == tp; } + bool test_expect(TokenType tp) { + return cur->type() == tp; + } void next_cur(); int open_parent(); @@ -114,7 +117,8 @@ class GenTree { std::string get_identifier(); - static VertexAdaptor gen_constructor_call_with_args(const std::string &allocated_class_name, std::vector args, const Location &location); + static VertexAdaptor gen_constructor_call_with_args(const std::string &allocated_class_name, std::vector args, + const Location &location); static VertexAdaptor gen_constructor_call_with_args(ClassPtr allocated_class, std::vector args, const Location &locaction); static VertexAdaptor auto_capture_this_in_lambda(FunctionPtr f_lambda); @@ -140,16 +144,14 @@ class GenTree { VertexPtr get_const_after_explicit_access_modifier(AccessModifiers access); VertexPtr get_const(AccessModifiers access); - int line_num{0}; const std::vector tokens; DataStream &parsed_os; bool is_top_of_the_function_{false}; decltype(tokens)::const_iterator cur, end; std::vector class_stack; - ClassPtr cur_class; // = class_stack.back() + ClassPtr cur_class; // = class_stack.back() std::vector functions_stack; - FunctionPtr cur_function; // = functions_stack.back() + FunctionPtr cur_function; // = functions_stack.back() SrcFilePtr processing_file; }; - diff --git a/runtime/curl.cpp b/runtime/curl.cpp index f6e3f8c181..a772de8031 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -1132,11 +1132,6 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { int running_handles = 0; multi_context->error_num = dl::critical_section_call(curl_multi_socket_action, multi_context->multi_handle, fd, flags, &running_handles); - // if (multi_context->error_num) { - // curl_request->finish_request(Optional{false}); - // return 0; - // } - if (multi_context->error_num != CURLM_OK) { curl_request->finish_request(); return 0; @@ -1149,38 +1144,23 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { return 0; } - string data = easy_context->received_data.concat_and_get_string(); - string header = easy_context->received_header.concat_and_get_string(); - - printf("HEADER = %s\n", header.c_str()); - printf("DATA = %s\n", data.c_str()); - // bool return_content = true; - // bool connection_only = easy_context->connection_only; - // // default if connection_only - // // if connection_only and url non exist in test this code is unreachable - // bool url_exist = true; - // if (!connection_only) - // url_exist = easy_context->get_info(CURLINFO_RESPONSE_CODE).to_int() == 200; - - // if (connection_only) - // if (url_exist) - // return_content = true; - // else - // return_content = false; - // else if (url_exist) - // return_content = true; - // else - // return_content = false; - - // received_header - - // if (CURLE_OK == dl::critical_section_call(curl_easy_perform, easy_context->easy_handle)) - // curl_request->finish_request(std::move(content)); - // else - // curl_request->finish_request(Optional{false}); - - curl_request->finish_request(std::move(data)); - + string content = easy_context->received_data.concat_and_get_string(); + + if (easy_context->connection_only) { + // const CURLcode res = dl::critical_section_call([&] { return curl_easy_setopt(easy_handle, option, value); }); + easy_context->set_option(CURLOPT_URL, easy_context->get_info(CURLINFO_EFFECTIVE_URL).to_string().c_str()); + easy_context->error_num = dl::critical_section_call([&] { return curl_easy_perform(easy_context->easy_handle); }); + if (easy_context->error_num != CURLE_OK && easy_context->error_num != CURLE_PARTIAL_FILE) { + printf("error = %ld\n", easy_context->error_num); + curl_request->finish_request(Optional{false}); + } else { + curl_request->finish_request(std::move(content)); + } + } else if (!content.empty()) { + curl_request->finish_request(std::move(content)); + } else { + curl_request->finish_request(Optional{false}); + } } return 0; } diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake index 907c422e16..002dd60c73 100644 --- a/runtime/runtime.cmake +++ b/runtime/runtime.cmake @@ -146,14 +146,14 @@ target_include_directories(kphp_runtime PUBLIC ${BASE_DIR} /opt/curl7600/include add_dependencies(kphp_runtime kphp-timelib) -prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3 ssh2 brotlicommon brotlidec cares) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? +prepare_cross_platform_libs(RUNTIME_LIBS yaml-cpp re2 zstd h3) # todo: linking between static libs is no-op, is this redundant? do we need to add mysqlclient here? set(RUNTIME_LIBS vk::kphp_runtime vk::kphp_server vk::popular_common vk::unicode vk::common_src vk::binlog_src vk::net_src ${RUNTIME_LIBS} OpenSSL::Crypto m z pthread) vk_add_library(kphp-full-runtime STATIC) target_link_libraries(kphp-full-runtime PUBLIC ${RUNTIME_LIBS}) set_target_properties(kphp-full-runtime PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OBJS_DIR}) prepare_cross_platform_libs(RUNTIME_LINK_TEST_LIBS pcre nghttp2 kphp-timelib) -set(RUNTIME_LINK_TEST_LIBS vk::flex_data_static ${CURL_LIB} OpenSSL::SSL ${NUMA_LIB} ${RUNTIME_LINK_TEST_LIBS} ${EPOLL_SHIM_LIB} ${ICONV_LIB} ${RT_LIB}) +set(RUNTIME_LINK_TEST_LIBS vk::flex_data_static ${CURL_LIB} OpenSSL::SSL ${NUMA_LIB} ${RUNTIME_LINK_TEST_LIBS} ${EPOLL_SHIM_LIB} ${ICONV_LIB} ${RT_LIB} cares brotlicommon brotlidec ssh2) if (PDO_DRIVER_MYSQL) list(APPEND RUNTIME_LINK_TEST_LIBS mysqlclient) From 7a491fac52824852033634b7208edd4736678aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 21 Mar 2024 02:39:19 +0300 Subject: [PATCH 11/12] change tests and bring back in other gh actions --- .github/workflows/Build.yml | 34 +++++++++---------- .github/workflows/Dockerfile.buster | 2 +- .github/workflows/Dockerfile.focal | 2 +- .github/workflows/Dockerfile.jammy | 4 +-- runtime/curl.cpp | 18 +--------- .../python/tests/curl/test_curl_resumable.py | 4 +-- 6 files changed, 24 insertions(+), 40 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index a428ee94de..d3c8d31e5f 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,25 +18,25 @@ jobs: strategy: matrix: include: - # - os: buster - # compiler: g++ - # cpp: 17 - # asan: off - # ubsan: off - # - os: focal - # compiler: clang++ - # cpp: 17 - # asan: off - # ubsan: on - # - os: focal - # compiler: g++-10 - # cpp: 20 - # asan: on - # ubsan: off + - os: buster + compiler: g++ + cpp: 17 + asan: off + ubsan: off + - os: focal + compiler: clang++ + cpp: 17 + asan: off + ubsan: on + - os: focal + compiler: g++-10 + cpp: 20 + asan: on + ubsan: off - os: jammy compiler: g++ cpp: 20 - asan: off + asan: on ubsan: off name: "${{matrix.os}}/${{matrix.compiler}}/c++${{matrix.cpp}}/asan=${{matrix.asan}}/ubsan=${{matrix.ubsan}}" @@ -96,7 +96,7 @@ jobs: id: python_tests continue-on-error: true run: docker exec kphp-build-container-${{matrix.os}} bash -c - "chown -R kitten /home && su kitten -c 'KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -s ${{env.kphp_root_dir}}/tests/python/tests/curl/test_curl_resumable.py'" + "chown -R kitten /home && su kitten -c 'GITHUB_ACTIONS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.7 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/'" - name: Prepare python tests artifacts if: steps.python_tests.outcome == 'failure' diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index bec76c9286..9ebcb37e21 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -23,7 +23,7 @@ RUN apt-get update && \ python3.7 python3-dev libpython3-dev python3-pip python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ pip3 install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt-get install -y --no-install-recommends curl-kphp-vk=20240228.buster.65.build.642 kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ postgresql postgresql-server-dev-all libnuma-dev composer && \ rm -rf /var/lib/apt/lists/* && \ diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 0d00b5c9d8..2cc56af4ab 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -16,7 +16,7 @@ RUN apt-get update && \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev libssh2-1 libssh2-1-dev libbrotli-dev libglobus-gssapi-gsi-dev \ libglobus-gssapi-gsi4 libc-ares-dev libkrb5-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt-get install -y --no-install-recommends curl-kphp-vk=20240228.focal.60.build.642 kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/Dockerfile.jammy b/.github/workflows/Dockerfile.jammy index f83b74cd79..45defbe0a5 100644 --- a/.github/workflows/Dockerfile.jammy +++ b/.github/workflows/Dockerfile.jammy @@ -27,8 +27,8 @@ RUN apt update && \ RUN update-alternatives --set php /usr/bin/php7.4 # setup default linker to lld, this allows to reduce python tests' execution time on ~10 min -# RUN update-alternatives --install /usr/bin/ld ld /usr/bin/x86_64-linux-gnu-ld 10 && \ -# update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 20 +RUN update-alternatives --install /usr/bin/ld ld /usr/bin/x86_64-linux-gnu-ld 10 && \ + update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 20 # apt - based composer has version 2, but we need 1 # next code install composer of version 1 diff --git a/runtime/curl.cpp b/runtime/curl.cpp index a772de8031..5d035e4a2e 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -160,7 +160,6 @@ class EasyContext : public BaseContext { } void release() noexcept { - printf("libcurl version = %s\n", curl_version()); curl_easy_cleanup(easy_handle); cleanup_slists_and_posts(); this->~EasyContext(); @@ -1145,22 +1144,7 @@ static int curl_epoll_cb(int fd, void *data, event_t *ev) { } string content = easy_context->received_data.concat_and_get_string(); - - if (easy_context->connection_only) { - // const CURLcode res = dl::critical_section_call([&] { return curl_easy_setopt(easy_handle, option, value); }); - easy_context->set_option(CURLOPT_URL, easy_context->get_info(CURLINFO_EFFECTIVE_URL).to_string().c_str()); - easy_context->error_num = dl::critical_section_call([&] { return curl_easy_perform(easy_context->easy_handle); }); - if (easy_context->error_num != CURLE_OK && easy_context->error_num != CURLE_PARTIAL_FILE) { - printf("error = %ld\n", easy_context->error_num); - curl_request->finish_request(Optional{false}); - } else { - curl_request->finish_request(std::move(content)); - } - } else if (!content.empty()) { - curl_request->finish_request(std::move(content)); - } else { - curl_request->finish_request(Optional{false}); - } + curl_request->finish_request(std::move(content)); } return 0; } diff --git a/tests/python/tests/curl/test_curl_resumable.py b/tests/python/tests/curl/test_curl_resumable.py index 2e59714284..8db9f6b5b0 100644 --- a/tests/python/tests/curl/test_curl_resumable.py +++ b/tests/python/tests/curl/test_curl_resumable.py @@ -53,7 +53,7 @@ def test_curl_resumable_timeout(self): def test_curl_resumable_nonexistent_url(self): self.assertEqual(self._curl_request("nonexistent_url"), { - "exec_result": False + "exec_result": '' }) def test_curl_resumable_connection_only_success(self): @@ -63,5 +63,5 @@ def test_curl_resumable_connection_only_success(self): def test_curl_resumable_connection_only_fail(self): self.assertEqual(self._curl_request("nonexistent_url", connect_only=True), { - "exec_result": False + "exec_result": '' }) From 264f0a18dadd533e25af9b26571cf3f83430a51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=83=D1=82=D1=8E=D0=BD=D1=8F=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 21 Mar 2024 03:04:56 +0300 Subject: [PATCH 12/12] restore --- .idea/codeStyleSettings.xml | 106 ++++++++++++++++++++++++++++++++++++ .idea/encodings.xml | 10 ++++ .idea/jsonSchemas.xml | 40 ++++++++++++++ .idea/misc.xml | 28 ++++++++++ compiler/gentree.h | 24 ++++---- 5 files changed, 195 insertions(+), 13 deletions(-) create mode 100644 .idea/codeStyleSettings.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jsonSchemas.xml create mode 100644 .idea/misc.xml diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000000..601c77e3bf --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,106 @@ + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000..7034a174ce --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.idea/jsonSchemas.xml b/.idea/jsonSchemas.xml new file mode 100644 index 0000000000..c3b2d9a320 --- /dev/null +++ b/.idea/jsonSchemas.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..bdd226825f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/compiler/gentree.h b/compiler/gentree.h index ae9a55d9f7..31e5fe6314 100644 --- a/compiler/gentree.h +++ b/compiler/gentree.h @@ -24,9 +24,9 @@ class GenTree { T &top_element; public: - StackPushPop(std::vector &stack, T &top_element, T elem_to_push) - : stack(stack) - , top_element(top_element) { + StackPushPop(std::vector &stack, T &top_element, T elem_to_push) : + stack(stack), + top_element(top_element) { stack.emplace_back(elem_to_push); top_element = elem_to_push; } @@ -38,17 +38,14 @@ class GenTree { }; public: - Location auto_location() const { - return Location{this->line_num}; - } + Location auto_location() const { return Location{this->line_num}; } static bool is_magic_method_name_allowed(const std::string &name); + GenTree(std::vector tokens, SrcFilePtr file, DataStream &os); - bool test_expect(TokenType tp) { - return cur->type() == tp; - } + bool test_expect(TokenType tp) { return cur->type() == tp; } void next_cur(); int open_parent(); @@ -117,8 +114,7 @@ class GenTree { std::string get_identifier(); - static VertexAdaptor gen_constructor_call_with_args(const std::string &allocated_class_name, std::vector args, - const Location &location); + static VertexAdaptor gen_constructor_call_with_args(const std::string &allocated_class_name, std::vector args, const Location &location); static VertexAdaptor gen_constructor_call_with_args(ClassPtr allocated_class, std::vector args, const Location &locaction); static VertexAdaptor auto_capture_this_in_lambda(FunctionPtr f_lambda); @@ -144,14 +140,16 @@ class GenTree { VertexPtr get_const_after_explicit_access_modifier(AccessModifiers access); VertexPtr get_const(AccessModifiers access); + int line_num{0}; const std::vector tokens; DataStream &parsed_os; bool is_top_of_the_function_{false}; decltype(tokens)::const_iterator cur, end; std::vector class_stack; - ClassPtr cur_class; // = class_stack.back() + ClassPtr cur_class; // = class_stack.back() std::vector functions_stack; - FunctionPtr cur_function; // = functions_stack.back() + FunctionPtr cur_function; // = functions_stack.back() SrcFilePtr processing_file; }; +