diff --git a/.bazelrc b/.bazelrc index ab9a27f84..97009c8a9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,6 +10,7 @@ build --action_env=PATH build:clang --action_env=BAZEL_COMPILER=clang build:clang --action_env=CC=clang build:clang --action_env=CXX=clang++ +build:clang --copt -Wno-pragma-once-outside-header --cxxopt -Wno-pragma-once-outside-header # Common flags for Clang sanitizers. build:clang-xsan --config=clang @@ -80,10 +81,10 @@ build:zig-cc-linux-aarch64 --test_env=QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/ build --enable_platform_specific_config -# Use C++17. -build:linux --cxxopt=-std=c++17 -build:macos --cxxopt=-std=c++17 -build:windows --cxxopt="/std:c++17" +# Use C++20. +build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 +build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 +build:windows --cxxopt="/std:c++20" --host_cxxopt="/std:c++20" # Enable symlinks and runfiles on Windows (enabled by default on other platforms). startup --windows_enable_symlinks diff --git a/.clang-tidy b/.clang-tidy index ceab9ad4a..df9f5c944 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,17 +1,28 @@ Checks: clang-*, + -clang-analyzer-core.CallAndMessage, -clang-analyzer-optin.portability.UnixAPI, -clang-analyzer-unix.Malloc, -clang-diagnostic-pragma-once-outside-header, + -clang-diagnostic-builtin-macro-redefined, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-pro-type-static-cast-downcast, misc-*, -misc-non-private-member-variables-in-classes, + -misc-use-anonymous-namespace, + -misc-const-correctness, + -misc-include-cleaner, + -misc-unused-parameters, modernize-*, -modernize-avoid-c-arrays, -modernize-use-trailing-return-type, + -modernize-return-braced-init-list, + -modernize-use-default-member-init, + -modernize-type-traits, + -modernize-use-emplace, llvm-include-order, performance-*, -performance-no-int-to-ptr, + -performance-avoid-endl, portability-*, readability-*, -readability-convert-member-functions-to-static, @@ -19,5 +30,9 @@ Checks: clang-*, -readability-magic-numbers, -readability-make-member-function-const, -readability-simplify-boolean-expr, + -readability-identifier-length, + -readability-container-data-pointer, + -readability-redundant-casting, + -readability-avoid-return-with-void-value, WarningsAsErrors: '*' diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 1004f123f..fa4ba153c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -43,7 +43,7 @@ jobs: addlicense: name: verify licenses - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 @@ -63,7 +63,7 @@ jobs: buildifier: name: check format with buildifier - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 @@ -101,29 +101,29 @@ jobs: clang_format: name: check format with clang-format - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - name: Install dependencies (Linux) - run: sudo apt update -y && sudo apt install -y clang-format-12 + run: sudo apt update -y && sudo apt install -y clang-format-18 - name: Format (clang-format) run: | - find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-12 -i + find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-18 -i git diff --exit-code clang_tidy: name: check format with clang-tidy - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - name: Install dependencies (Linux) - run: sudo apt update -y && sudo apt install -y clang-tidy-12 lld-12 && sudo ln -sf /usr/bin/lld-12 /usr/bin/lld + run: sudo apt update -y && sudo apt install -y clang-tidy-18 lld-18 && sudo ln -sf /usr/bin/lld-18 /usr/bin/lld - name: Bazel cache uses: PiotrSikora/cache@v2.1.7-with-skip-cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f33c3316..dbb3eed27 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,7 +43,7 @@ jobs: test_data: name: build test data - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 @@ -111,19 +111,19 @@ jobs: include: - name: 'NullVM on Linux/x86_64' engine: 'null' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=gcc - name: 'NullVM on Linux/x86_64 with ASan' engine: 'null' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test - flags: --config=clang-asan-strict --define=crypto=system + flags: --config=clang-asan --define=crypto=system - name: 'NullVM on Linux/x86_64 with TSan' engine: 'null' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang-tsan @@ -136,7 +136,7 @@ jobs: - name: 'V8 on Linux/x86_64' engine: 'v8' repo: 'v8' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang --define=crypto=system @@ -144,7 +144,7 @@ jobs: - name: 'V8 on Linux/x86_64 with ASan' engine: 'v8' repo: 'v8' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang-asan @@ -152,7 +152,7 @@ jobs: - name: 'V8 on Linux/x86_64 with TSan' engine: 'v8' repo: 'v8' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang-tsan @@ -160,7 +160,7 @@ jobs: - name: 'V8 on Linux/x86_64 with GCC' engine: 'v8' repo: 'v8' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=gcc @@ -168,7 +168,7 @@ jobs: - name: 'V8 on Linux/aarch64' engine: 'v8' repo: 'v8' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: aarch64 action: test targets: -//test/fuzz/... @@ -185,7 +185,7 @@ jobs: - name: 'WAMR interp on Linux/x86_64' engine: 'wamr-interp' repo: 'com_github_bytecodealliance_wasm_micro_runtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang @@ -198,11 +198,11 @@ jobs: - name: 'WAMR jit on Linux/x86_64' engine: 'wamr-jit' repo: 'com_github_bytecodealliance_wasm_micro_runtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang - deps: lld-12 + deps: lld-18 cache: true - name: 'WAMR jit on macOS/x86_64' engine: 'wamr-jit' @@ -214,7 +214,7 @@ jobs: - name: 'WasmEdge on Linux/x86_64' engine: 'wasmedge' repo: 'com_github_wasmedge_wasmedge' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang @@ -227,21 +227,21 @@ jobs: - name: 'Wasmtime on Linux/x86_64' engine: 'wasmtime' repo: 'com_github_bytecodealliance_wasmtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test flags: --config=clang -c opt - name: 'Wasmtime on Linux/x86_64 with ASan' engine: 'wasmtime' repo: 'com_github_bytecodealliance_wasmtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: x86_64 action: test - flags: --config=clang-asan-strict --define=crypto=system + flags: --config=clang-asan --define=crypto=system - name: 'Wasmtime on Linux/aarch64' engine: 'wasmtime' repo: 'com_github_bytecodealliance_wasmtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: aarch64 action: build flags: --config=zig-cc-linux-aarch64 @@ -249,7 +249,7 @@ jobs: - name: 'Wasmtime on Linux/s390x' engine: 'wasmtime' repo: 'com_github_bytecodealliance_wasmtime' - os: ubuntu-22.04 + os: ubuntu-24.04 arch: s390x action: test flags: --config=clang --test_timeout=1800 diff --git a/bazel/external/bazel_clang_tidy.patch b/bazel/external/bazel_clang_tidy.patch index 9c84b3c7f..82711d83e 100644 --- a/bazel/external/bazel_clang_tidy.patch +++ b/bazel/external/bazel_clang_tidy.patch @@ -1,5 +1,4 @@ # 1. Treat .h files as C++ headers. -# 2. Hardcode clang-tidy-12. diff --git a/clang_tidy/clang_tidy.bzl b/clang_tidy/clang_tidy.bzl index 3a5ed07..5db5c6c 100644 @@ -15,13 +14,3 @@ index 3a5ed07..5db5c6c 100644 # start args passed to the compiler args.add("--") -diff --git a/clang_tidy/run_clang_tidy.sh b/clang_tidy/run_clang_tidy.sh -index 582bab1..b9ebb94 100755 ---- a/clang_tidy/run_clang_tidy.sh -+++ b/clang_tidy/run_clang_tidy.sh -@@ -11,4 +11,4 @@ shift - touch $OUTPUT - truncate -s 0 $OUTPUT - --clang-tidy "$@" -+clang-tidy-12 "$@" diff --git a/bazel/external/v8.patch b/bazel/external/v8.patch index 58e7f9ba0..ba1ae19dd 100644 --- a/bazel/external/v8.patch +++ b/bazel/external/v8.patch @@ -20,11 +20,14 @@ diff --git a/bazel/defs.bzl b/bazel/defs.bzl index e957c0fad3..063627b72b 100644 --- a/bazel/defs.bzl +++ b/bazel/defs.bzl -@@ -131,6 +131,7 @@ def _default_args(): +@@ -131,6 +131,10 @@ def _default_args(): "-Wno-redundant-move", "-Wno-return-type", "-Wno-stringop-overflow", + "-Wno-nonnull", ++ "-Wno-error=pessimizing-move", ++ "-Wno-error=dangling-reference", ++ "-Wno-error=dangling-pointer=", # Use GNU dialect, because GCC doesn't allow using # ##__VA_ARGS__ when in standards-conforming mode. "-std=gnu++17", diff --git a/bazel/external/wasmedge.BUILD b/bazel/external/wasmedge.BUILD index 1869bf969..2c6e89204 100644 --- a/bazel/external/wasmedge.BUILD +++ b/bazel/external/wasmedge.BUILD @@ -18,6 +18,9 @@ cmake( "WASMEDGE_BUILD_TOOLS": "Off", "WASMEDGE_FORCE_DISABLE_LTO": "On", }, + env = { + "CXXFLAGS": "-Wno-error=dangling-reference -Wno-error=maybe-uninitialized -Wno-error=array-bounds= -Wno-error=deprecated-declarations -std=c++20", + }, generate_args = ["-GNinja"], lib_source = ":srcs", out_static_libs = ["libwasmedge.a"], diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 38108bd81..94e9fc5f3 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -130,9 +130,9 @@ def proxy_wasm_cpp_host_repositories(): maybe( http_archive, name = "proxy_wasm_cpp_sdk", - sha256 = "89792fc1abca331f29f99870476a04146de5e82ff903bdffca90e6729c1f2470", - strip_prefix = "proxy-wasm-cpp-sdk-95bb82ce45c41d9100fd1ec15d2ffc67f7f3ceee", - urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/95bb82ce45c41d9100fd1ec15d2ffc67f7f3ceee.tar.gz"], + sha256 = "26c4c0f9f645de7e789dc92f113d7352ee54ac43bb93ae3a8a22945f1ce71590", + strip_prefix = "proxy-wasm-cpp-sdk-7465dee8b2953beebff99f6dc3720ad0c79bab99", + urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/7465dee8b2953beebff99f6dc3720ad0c79bab99.tar.gz"], ) # Compile DB dependencies. @@ -149,11 +149,9 @@ def proxy_wasm_cpp_host_repositories(): maybe( http_archive, name = "com_google_googletest", - sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", - strip_prefix = "googletest-release-1.10.0", - urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"], - patches = ["@proxy_wasm_cpp_host//bazel/external:googletest.patch"], - patch_args = ["-p1"], + sha256 = "65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c", + strip_prefix = "googletest-1.17.0", + urls = ["https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz"], ) # NullVM dependencies. diff --git a/src/null/null_plugin.cc b/src/null/null_plugin.cc index 0f74496a2..689225687 100644 --- a/src/null/null_plugin.cc +++ b/src/null/null_plugin.cc @@ -26,7 +26,6 @@ #include #include -#include "include/proxy-wasm/null_plugin.h" #include "include/proxy-wasm/null_vm.h" #include "include/proxy-wasm/wasm.h" diff --git a/src/wasmedge/wasmedge.cc b/src/wasmedge/wasmedge.cc index 38b8a9c9c..596af0c9e 100644 --- a/src/wasmedge/wasmedge.cc +++ b/src/wasmedge/wasmedge.cc @@ -19,6 +19,7 @@ #include "wasmedge/wasmedge.h" +#include #include #include #include diff --git a/test/utility.cc b/test/utility.cc index b4c10053f..7bdf9d2ad 100644 --- a/test/utility.cc +++ b/test/utility.cc @@ -21,19 +21,18 @@ std::string TestContext::global_log_; std::vector getWasmEngines() { std::vector engines = { #if defined(PROXY_WASM_HOST_ENGINE_V8) - "v8", + "v8", #endif #if defined(PROXY_WASM_HOST_ENGINE_WAMR) - "wamr", + "wamr", #endif #if defined(PROXY_WASM_HOST_ENGINE_WASMEDGE) - "wasmedge", + "wasmedge", #endif #if defined(PROXY_WASM_HOST_ENGINE_WASMTIME) - "wasmtime", + "wasmtime", #endif - "" - }; + ""}; engines.pop_back(); return engines; } diff --git a/test/utility.h b/test/utility.h index eaaaa3197..0eb743037 100644 --- a/test/utility.h +++ b/test/utility.h @@ -192,4 +192,7 @@ class TestVm : public testing::TestWithParam { std::string engine_; }; +// TODO: remove when #412 is fixed. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TestVm); + } // namespace proxy_wasm