diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6dd0b85..41ea410 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,109 +13,125 @@ jobs: fail-fast: false matrix: include: - - { title: "linux-lib" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", problem_matcher: "cpp" } - - { title: "windows-lib" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , problem_matcher: "cpp" } - - - { title: "diag-valgrind" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON", diagnostics: "valgrind" } - - { title: "diag-scan-build", os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON", diagnostics: "scan-build" } - - - { title: "linux" , os: "ubuntu-latest" , cc: "gcc" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "gcc" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "gcc" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "gcc" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-4.8" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-4.8" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-4.8" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-4.8" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-5" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-5" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-6" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-18.04" , cc: "gcc-6" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-7" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-8" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-9" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-9" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-10" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-10" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "clang" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "clang" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-9" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-9" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-9" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-9" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "linux" , os: "ubuntu-20.04" , cc: "clang-10", arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - - { title: "macos-10.15" , os: "macos-10.15" , cc: "gcc-9" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "macos-10.15" , os: "macos-10.15" , cc: "gcc-9" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "macos-10.15" , os: "macos-10.15" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "macos-10.15" , os: "macos-10.15" , cc: "clang" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - # Disabled due to GitHub Actions infrastructure issues. - #- { title: "macos-11.0" , os: "macos-11.0" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - #- { title: "macos-11.0" , os: "macos-11.0" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - #- { title: "macos-11.0" , os: "macos-11.0" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - #- { title: "macos-11.0" , os: "macos-11.0" , cc: "clang" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=ON" } - - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } - - name: "${{matrix.title}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" - runs-on: "${{matrix.os}}" + - { title: "linux-lib" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } + - { title: "macos-lib" , os: "macos-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } + - { title: "windows-lib" , os: "windows-latest", cc: "vs2022" , arch: "x64", build_type: "Debug" , problem_matcher: "cpp" } + + - { title: "diag-asan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "address" , defs: "MATHPRESSO_TEST=1" } + - { title: "diag-ubsan" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "undefined", defs: "MATHPRESSO_TEST=1" } + - { title: "diag-valgrind" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Release", diagnostics: "valgrind" , defs: "MATHPRESSO_TEST=1" } + - { title: "diag-scan-build" , os: "ubuntu-latest" , cc: "clang" , arch: "x64", build_type: "Debug" , diagnostics: "scan-build" } + + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-9" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-10" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-11" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "gcc-12" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-11", arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-12", arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-13", arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "linux" , os: "ubuntu-22.04" , cc: "clang-14", arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "gcc-11" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "gcc-11" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "clang" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "macos" , os: "macos-12" , cc: "clang" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2019" , cc: "vs2019" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x86", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Debug" , defs: "MATHPRESSO_TEST=1" } + - { title: "windows" , os: "windows-2022" , cc: "vs2022" , arch: "x64", build_type: "Release", defs: "MATHPRESSO_TEST=1" } + + - { host: "ubuntu-latest" , os: "freebsd", osver: "13.1", cc: "clang", arch: "x86-64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } + - { host: "ubuntu-latest" , os: "netbsd" , osver: "9.3" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } + - { host: "ubuntu-latest" , os: "openbsd", osver: "7.3" , cc: "clang", arch: "x86-64", build_type: "Release", defs: "MATHPRESSO_TEST=ON" } + - { host: "ubuntu-latest" , os: "openbsd", osver: "7.3" , cc: "clang", arch: "arm64" , build_type: "Release", defs: "MATHPRESSO_TEST=ON" } + + name: "${{matrix.title || format('{0}-{1}', matrix.os, matrix.osver)}} (${{matrix.cc}}, ${{matrix.arch}}, ${{matrix.build_type}})" + runs-on: "${{matrix.host || matrix.os}}" steps: - - name: "Checkout" + - name: "Checkout MathPresso" uses: actions/checkout@v3 with: - path: "source" + path: "mathpresso" - - name: "Checkout asmjit" - run: git clone https://github.com/asmjit/asmjit.git asmjit --depth=1 + - name: "Checkout AsmJit" + uses: actions/checkout@v3 + with: + repository: asmjit/asmjit + path: "asmjit" - - name: "Checkout build-actions" - run: git clone https://github.com/build-actions/build-actions.git build-actions --depth=1 + - name: "Checkout Build Actions" + uses: actions/checkout@v3 + with: + repository: build-actions/build-actions + path: "build-actions" - - name: "Python" + - name: "Setup Python" uses: actions/setup-python@v4 with: python-version: "3.x" - - name: "Prepare" - run: python build-actions/action.py - --step=prepare - --compiler=${{matrix.cc}} - --diagnostics=${{matrix.diagnostics}} - --architecture=${{matrix.arch}} - - - name: "Configure" + - name: "Build & Test" + if: ${{!matrix.host}} run: python build-actions/action.py - --step=configure - --config=source/.github/workflows/build-config.json - --source-dir=source - --compiler=${{matrix.cc}} - --diagnostics=${{matrix.diagnostics}} - --architecture=${{matrix.arch}} - --build-type=${{matrix.build_type}} - --build-defs=${{matrix.defs}} - --problem-matcher=${{matrix.problem_matcher}} - - - name: "Build" - run: python build-actions/action.py --step=build - - - name: "Test" - run: python build-actions/action.py --step=test + --step=all + --compiler=${{matrix.cc}} + --architecture=${{matrix.arch}} + --source-dir=mathpresso + --config=mathpresso/.github/workflows/build-config.json + --build-type=${{matrix.build_type}} + --build-defs=${{matrix.defs}} + + - name: "Build & Test in VM" + if: ${{matrix.host}} + uses: cross-platform-actions/action@master + with: + operating_system: ${{matrix.os}} + architecture: ${{matrix.arch}} + version: ${{matrix.osver}} + shell: bash + run: | + set -e + + PATH="/usr/sbin:/usr/pkg/sbin:/usr/pkg/bin:$PATH:$(pwd)/build-actions" + CI_NETBSD_USE_PKGIN=1 + + export PATH + export CI_NETBSD_USE_PKGIN + + sh ./build-actions/prepare-environment.sh + python3 build-actions/action.py \ + --step=all \ + --compiler=${{matrix.cc}} \ + --architecture=${{matrix.arch}} \ + --source-dir=mathpresso \ + --config=mathpresso/.github/workflows/build-config.json \ + --build-type=${{matrix.build_type}} \ + --build-defs=${{matrix.defs}} diff --git a/src/mathpresso/mpstrtod_p.h b/src/mathpresso/mpstrtod_p.h index 07fbeb6..358e733 100644 --- a/src/mathpresso/mpstrtod_p.h +++ b/src/mathpresso/mpstrtod_p.h @@ -15,17 +15,12 @@ #define MATHPRESSO_STRTOD_MSLOCALE #include #include -#else +#elif !defined(__OpenBSD__) #define MATHPRESSO_STRTOD_XLOCALE #include #include // xlocale.h is not available on Linux anymore, it uses . - #if defined(__APPLE__ ) || \ - defined(__bsdi__ ) || \ - defined(__DragonFly__) || \ - defined(__FreeBSD__ ) || \ - defined(__NetBSD__ ) || \ - defined(__OpenBSD__ ) + #if defined(__APPLE__) || defined(__FreeBSD__) #include #endif #endif