From ed577df40adf4d7dc9f38f2effada02ff08f5c3f Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Wed, 27 Dec 2023 11:11:23 +0800 Subject: [PATCH 1/4] fix: strerror_r error handling toml/exception.hpp in macos --- toml/exception.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/toml/exception.hpp b/toml/exception.hpp index 927d791..1367948 100644 --- a/toml/exception.hpp +++ b/toml/exception.hpp @@ -37,13 +37,7 @@ inline std::string str_error(int errnum) { return std::string(buf.data()); } -#elif defined(_GNU_SOURCE) - constexpr std::size_t bufsize = 256; - std::array buf; - buf.fill('\0'); - const char* result = strerror_r(errnum, buf.data(), bufsize); - return std::string(result); -#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) +#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || ( defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) // macos or POSIX constexpr std::size_t bufsize = 256; std::array buf; buf.fill('\0'); @@ -56,6 +50,12 @@ inline std::string str_error(int errnum) { return std::string(buf.data()); } +#elif defined(_GNU_SOURCE) + constexpr std::size_t bufsize = 256; + std::array buf; + buf.fill('\0'); + const char* result = strerror_r(errnum, buf.data(), bufsize); + return std::string(result); #else // fallback return std::strerror(errnum); #endif From 0db935b602264743f5fef14da64760f52de7bb24 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Wed, 27 Dec 2023 11:19:59 +0800 Subject: [PATCH 2/4] fix: let __DARWIN_C as an exception --- toml/exception.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/toml/exception.hpp b/toml/exception.hpp index 1367948..81c6401 100644 --- a/toml/exception.hpp +++ b/toml/exception.hpp @@ -37,7 +37,13 @@ inline std::string str_error(int errnum) { return std::string(buf.data()); } -#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || ( defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) // macos or POSIX +#elif defined(_GNU_SOURCE) && !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) + constexpr std::size_t bufsize = 256; + std::array buf; + buf.fill('\0'); + const char* result = strerror_r(errnum, buf.data(), bufsize); + return std::string(result); +#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || ( defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200112L ) // macOS constexpr std::size_t bufsize = 256; std::array buf; buf.fill('\0'); @@ -50,12 +56,6 @@ inline std::string str_error(int errnum) { return std::string(buf.data()); } -#elif defined(_GNU_SOURCE) - constexpr std::size_t bufsize = 256; - std::array buf; - buf.fill('\0'); - const char* result = strerror_r(errnum, buf.data(), bufsize); - return std::string(result); #else // fallback return std::strerror(errnum); #endif From 655d76b828c80ab9a958ea473814ffe8ddede49d Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Wed, 27 Dec 2023 11:27:21 +0800 Subject: [PATCH 3/4] update: test on github action with macos 13 and macos 13 arm64 image --- .github/workflows/main.yml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 566a63e..e488e2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -138,6 +138,56 @@ jobs: run: | cd build && ctest --output-on-failure + build-osx-13-arm64: + runs-on: macos-13-arm64 + strategy: + matrix: + standard: ['11', '14', '17', '20'] + unreleased: ['ON', 'OFF'] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Install + run: | + brew install boost + - name: Configure + run: | + mkdir build && cd build + cmake .. -Dtoml11_BUILD_TEST=ON -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_USE_UNRELEASED_TOML_FEATURES=${{ matrix.unreleased }} + - name: Build + run: | + cd build && cmake --build . + - name: Test + run: | + cd build && ctest --output-on-failure + + build-osx-13: + runs-on: macos-13 + strategy: + matrix: + standard: ['11', '14', '17', '20'] + unreleased: ['ON', 'OFF'] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Install + run: | + brew install boost + - name: Configure + run: | + mkdir build && cd build + cmake .. -Dtoml11_BUILD_TEST=ON -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_USE_UNRELEASED_TOML_FEATURES=${{ matrix.unreleased }} + - name: Build + run: | + cd build && cmake --build . + - name: Test + run: | + cd build && ctest --output-on-failure + build-osx-12: runs-on: macos-12 strategy: From 7bd09245faf12278cb9740fddb5cd9e9a6196e52 Mon Sep 17 00:00:00 2001 From: Toru Niina Date: Fri, 5 Jan 2024 00:00:25 +0900 Subject: [PATCH 4/4] ci: disable macos-13-arm64 --- .github/workflows/main.yml | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e488e2d..4126385 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -138,30 +138,30 @@ jobs: run: | cd build && ctest --output-on-failure - build-osx-13-arm64: - runs-on: macos-13-arm64 - strategy: - matrix: - standard: ['11', '14', '17', '20'] - unreleased: ['ON', 'OFF'] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - - name: Install - run: | - brew install boost - - name: Configure - run: | - mkdir build && cd build - cmake .. -Dtoml11_BUILD_TEST=ON -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_USE_UNRELEASED_TOML_FEATURES=${{ matrix.unreleased }} - - name: Build - run: | - cd build && cmake --build . - - name: Test - run: | - cd build && ctest --output-on-failure +# build-osx-13-arm64: +# runs-on: macos-13-arm64 +# strategy: +# matrix: +# standard: ['11', '14', '17', '20'] +# unreleased: ['ON', 'OFF'] +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# submodules: true +# - name: Install +# run: | +# brew install boost +# - name: Configure +# run: | +# mkdir build && cd build +# cmake .. -Dtoml11_BUILD_TEST=ON -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_USE_UNRELEASED_TOML_FEATURES=${{ matrix.unreleased }} +# - name: Build +# run: | +# cd build && cmake --build . +# - name: Test +# run: | +# cd build && ctest --output-on-failure build-osx-13: runs-on: macos-13