From fc8993768313a418caa30bf1ac9b1b6e848b0ee0 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Sun, 23 Jul 2023 10:22:38 +0100 Subject: [PATCH 01/10] Update snitch --- tests/CMakeLists.txt | 3 +-- tests/testing.hpp | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a9f4125..6c8afcd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -30,10 +30,9 @@ function(add_platform_definitions TARGET) endfunction() include(FetchContent) - FetchContent_Declare(snitch GIT_REPOSITORY https://github.com/cschreib/snitch.git - GIT_TAG v1.1.0) + GIT_TAG v1.3.2) FetchContent_MakeAvailable(snitch) set(RUNTIME_TEST_FILES diff --git a/tests/testing.hpp b/tests/testing.hpp index 2259201..5557be0 100644 --- a/tests/testing.hpp +++ b/tests/testing.hpp @@ -1,4 +1,6 @@ -#include "snitch/snitch.hpp" +#include "snitch/snitch_macros_check.hpp" +#include "snitch/snitch_macros_exceptions.hpp" +#include "snitch/snitch_macros_test_case.hpp" #include "tests_common.hpp" // clang-format off From ab2ad1d54a014fb5040cf1fb4a14ca88e51b4f64 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 20:51:30 +0100 Subject: [PATCH 02/10] Add maximum tested CMake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f4d68d..5df4c90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8..3.31) # Setup main project project(oup LANGUAGES CXX VERSION 1.0) From a493883f92364eece68f63d7e850303cbb28cb6d Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 20:54:19 +0100 Subject: [PATCH 03/10] Update CI versions --- .github/workflows/cmake.yml | 7 ++++--- .github/workflows/doc.yml | 13 ++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 93411fc..b7a98e6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -33,8 +33,9 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: + fetch-depth: 2 # necessary for codecov bash uploader submodules: 'recursive' - name: Setup Clang @@ -44,14 +45,14 @@ jobs: - name: Setup Emscripten cache if: matrix.platform.compiler == 'em++' id: cache-system-libraries - uses: actions/cache@v3.3.1 + uses: actions/cache@v4 with: path: ${{env.EM_CACHE_FOLDER}} key: ${{env.EM_VERSION}}-${{matrix.platform.name}}-${{matrix.build-type}} - name: Setup Emscripten if: matrix.platform.compiler == 'em++' - uses: mymindstorm/setup-emsdk@v12 + uses: mymindstorm/setup-emsdk@v14 with: version: ${{env.EM_VERSION}} actions-cache-folder: ${{env.EM_CACHE_FOLDER}} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 43773ba..dd86554 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get dependencies run: sudo apt-get install doxygen @@ -22,13 +22,8 @@ jobs: shell: bash run: doxygen dox.conf - - name: Compress - working-directory: ${{github.workspace}}/doc - shell: bash - run: zip docs.zip html/* - - name: Upload as an Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: docs.zip - path: ${{github.workspace}}/doc/docs.zip + name: docs + path: ${{github.workspace}}/doc/html From 4721327345b32ec3f550bb66bc3ed2da2026e2b9 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 20:56:45 +0100 Subject: [PATCH 04/10] Update copyright year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 740af10..9587cdc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Corentin Schreiber +Copyright (c) 2025 Corentin Schreiber Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From d4b05d842594bce52d3d1f1cc6f00cf889350ffc Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 20:56:50 +0100 Subject: [PATCH 05/10] Fix version in CMake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df4c90..043379a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.8..3.31) # Setup main project -project(oup LANGUAGES CXX VERSION 1.0) +project(oup LANGUAGES CXX VERSION 0.7.2) # Create library (header-only) add_library(oup INTERFACE) From 0ed27caa41ce32e313417b1e5ee581a4c2549151 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 20:59:54 +0100 Subject: [PATCH 06/10] Bump version number --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 043379a..8f7c07c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.8..3.31) # Setup main project -project(oup LANGUAGES CXX VERSION 0.7.2) +project(oup LANGUAGES CXX VERSION 0.7.3) # Create library (header-only) add_library(oup INTERFACE) From 3648af72d7d1b3de5acaeae4cdb22719e8c4d499 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 21:26:31 +0100 Subject: [PATCH 07/10] Fix up in readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a15965..2a80114 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ int main() { auto owner_ptr = oup::make_observable_sealed("hello"); // A sealed pointer cannot be copied but it can be moved - // auto tmp_copied = owner_ptr; // error! - // auto tmp_moved = std::move(owner_ptr); // OK + // oup::observable_sealed_ptr owner_copied = owner_ptr; // error! + // oup::observable_sealed_ptr owner_moved = std::move(owner_ptr); // OK // Make the observer pointer point to the object obs_ptr = owner_ptr; @@ -73,8 +73,8 @@ int main() { std::cout << *obs_ptr << std::endl; // An observer pointer can be copied and moved - // auto tmp_copied = obs_ptr; // OK - // auto tmp_moved = std::move(obs_ptr); // OK + // oup::observer_ptr obs_copied = obs_ptr; // OK + // oup::observer_ptr obs_moved = std::move(obs_ptr); // OK } // The sealed pointer has gone out of scope, the object is deleted, From e4ea673ce3eb3e7cba888e345bd0dd09a799d4bb Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 21:26:44 +0100 Subject: [PATCH 08/10] Increase stack size in Emscripten build --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b7a98e6..533e4cd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,7 +23,7 @@ jobs: - { name: Windows 32, os: windows-latest, compiler: vs2019, arch: "32", cmakepp: "", flags: "-A Win32"} - { name: Windows 64, os: windows-latest, compiler: vs2019, arch: "64", cmakepp: "", flags: "-A x64"} - { name: MacOS, os: macos-latest, compiler: clang++, arch: "64", cmakepp: "", flags: ""} - - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", flags: "-DCMAKE_CXX_FLAGS='-s DISABLE_EXCEPTION_CATCHING=0' -DCMAKE_CROSSCOMPILING_EMULATOR=node"} + - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", flags: "-DCMAKE_CXX_FLAGS='-s DISABLE_EXCEPTION_CATCHING=0 -s STACK_SIZE=5MB' -DCMAKE_CROSSCOMPILING_EMULATOR=node"} build-type: - Release - Debug From ea122a03f5ecc630996b3e0ea86a31f831df4fa6 Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 21:35:18 +0100 Subject: [PATCH 09/10] Fix failing tests with newer LLVM --- tests/CMakeLists.txt | 2 ++ tests/runtime_tests_owner_construction.cpp | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6c8afcd..862cc8c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,6 +3,7 @@ function(add_platform_definitions TARGET) if(CMAKE_SYSTEM_NAME MATCHES "Emscripten") target_compile_definitions(${TARGET} PRIVATE OUP_PLATFORM_WASM) target_compile_definitions(${TARGET} PRIVATE OUP_COMPILER_EMSCRIPTEN) + target_compile_definitions(${TARGET} PRIVATE OUP_COMPILER_LLVM) elseif (APPLE) target_compile_definitions(${TARGET} PRIVATE OUP_PLATFORM_OSX) elseif (UNIX) @@ -22,6 +23,7 @@ function(add_platform_definitions TARGET) target_compile_options(${TARGET} PRIVATE -Wall) target_compile_options(${TARGET} PRIVATE -Wextra) target_compile_options(${TARGET} PRIVATE -Werror) + target_compile_definitions(${TARGET} PRIVATE OUP_COMPILER_LLVM) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options(${TARGET} PRIVATE /W4) target_compile_options(${TARGET} PRIVATE /WX) diff --git a/tests/runtime_tests_owner_construction.cpp b/tests/runtime_tests_owner_construction.cpp index 180d4d4..b58fdfc 100644 --- a/tests/runtime_tests_owner_construction.cpp +++ b/tests/runtime_tests_owner_construction.cpp @@ -101,7 +101,17 @@ TEMPLATE_LIST_TEST_CASE( if constexpr (eoft_allocates) { fail_next_allocation{}, TestType{raw_ptr}; } else { +#if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG) REQUIRE_THROWS_AS((fail_next_allocation{}, TestType{raw_ptr}), std::bad_alloc); +#else + // LLVM in Release mode is able to inline the allocation, bypassing our + // custom allocator that fails... + try { + fail_next_allocation{}, TestType{raw_ptr}; + } catch (const std::bad_alloc&) { + // If it does throw, good. Else, ignore it. + } +#endif } } @@ -120,8 +130,18 @@ TEMPLATE_LIST_TEST_CASE( if constexpr (eoft_allocates) { fail_next_allocation{}, TestType{raw_ptr, deleter}; } else { +#if !defined(OUP_COMPILER_LLVM) || !defined(NDEBUG) REQUIRE_THROWS_AS( (fail_next_allocation{}, TestType{raw_ptr, deleter}), std::bad_alloc); +#else + // LLVM in Release mode is able to inline the allocation, bypassing our + // custom allocator that fails... + try { + fail_next_allocation{}, TestType{raw_ptr, deleter}; + } catch (const std::bad_alloc&) { + // If it does throw, good. Else, ignore it. + } +#endif } } From b9c2338a2a9c4e2f7d3e4de1292533cacf1cc4ee Mon Sep 17 00:00:00 2001 From: Corentin Schreiber Date: Thu, 24 Apr 2025 21:40:26 +0100 Subject: [PATCH 10/10] Correct way to set STACK_SIZE --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 533e4cd..d06476c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -23,7 +23,7 @@ jobs: - { name: Windows 32, os: windows-latest, compiler: vs2019, arch: "32", cmakepp: "", flags: "-A Win32"} - { name: Windows 64, os: windows-latest, compiler: vs2019, arch: "64", cmakepp: "", flags: "-A x64"} - { name: MacOS, os: macos-latest, compiler: clang++, arch: "64", cmakepp: "", flags: ""} - - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", flags: "-DCMAKE_CXX_FLAGS='-s DISABLE_EXCEPTION_CATCHING=0 -s STACK_SIZE=5MB' -DCMAKE_CROSSCOMPILING_EMULATOR=node"} + - { name: WebAssembly, os: ubuntu-latest, compiler: em++, arch: "32", cmakepp: "emcmake", flags: "-DCMAKE_CXX_FLAGS='-s DISABLE_EXCEPTION_CATCHING=0' -DCMAKE_CXX_LINK_FLAGS='-s STACK_SIZE=5MB' -DCMAKE_CROSSCOMPILING_EMULATOR=node"} build-type: - Release - Debug