From 479f90fae3f1fd0057572c51fac4324fc3a4882d Mon Sep 17 00:00:00 2001 From: Neil Henning Date: Fri, 2 Feb 2024 12:49:22 +0000 Subject: [PATCH] Try Apple Silicon. --- .github/workflows/cmake.yml | 23 +++++++++++++++++------ utf8.h | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index dc5d696..e9c6fdd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -10,15 +10,20 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + os: [ubuntu-latest, windows-latest, macos-11, macos-14] type: [Debug, RelWithDebInfo, MinSizeRel, Release] - compiler: [default, clang, gcc] + compiler: [default, clang, gcc, tcc] exclude: - - {os: "macOS-latest", compiler: "clang"} - - {os: "windows-latest", compiler: "gcc"} - - {os: "macOS-latest", compiler: "gcc"} + - {os: "macos-11", compiler: "clang"} + - {os: "macos-11", compiler: "gcc"} + - {os: "macos-11", compiler: "tcc"} + - {os: "macos-14", compiler: "clang"} + - {os: "macos-14", compiler: "gcc"} + - {os: "macos-14", compiler: "tcc"} - {os: "ubuntu-latest", compiler: "default"} - {os: "ubuntu-latest", compiler: "default"} + - {os: "windows-latest", compiler: "gcc"} + - {os: "windows-latest", compiler: "tcc"} runs-on: ${{ matrix.os }} steps: @@ -29,7 +34,7 @@ jobs: - name: Setup dependencies if: startsWith(matrix.os, 'ubuntu') - run: sudo apt-get install -y gcc-10 g++-10 clang + run: sudo apt-get install -y gcc-10 g++-10 clang tcc - name: Configure CMake shell: bash @@ -43,6 +48,12 @@ jobs: working-directory: ${{github.workspace}}/build run: cmake $GITHUB_WORKSPACE/test -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + - name: Configure CMake with TCC (Ubuntu) + shell: bash + if: matrix.compiler == 'tcc' && startsWith(matrix.os, 'ubuntu') + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE/test -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_C_COMPILER=tcc -DCMAKE_CXX_COMPILER=g++-10 + - name: Configure CMake with Clang (Ubuntu) shell: bash if: (matrix.compiler == 'clang') && startsWith(matrix.os, 'ubuntu') diff --git a/utf8.h b/utf8.h index 5652fe2..5f02b55 100644 --- a/utf8.h +++ b/utf8.h @@ -71,18 +71,29 @@ typedef int32_t utf8_int32_t; extern "C" { #endif +#if defined(__TINYC__) +#define UTF8_ATTRIBUTE(a) __attribute((a)) +#else +#define UTF8_ATTRIBUTE(a) __attribute__((a)) +#endif + #if defined(_MSC_VER) #define utf8_nonnull #define utf8_pure #define utf8_restrict __restrict #define utf8_weak __inline #elif defined(__clang__) || defined(__GNUC__) -#define utf8_nonnull __attribute__((nonnull)) -#define utf8_pure __attribute__((pure)) +#define utf8_nonnull UTF8_ATTRIBUTE(nonnull) +#define utf8_pure UTF8_ATTRIBUTE(pure) #define utf8_restrict __restrict__ -#define utf8_weak __attribute__((weak)) +#define utf8_weak UTF8_ATTRIBUTE(weak) +#elif defined(__TINYC__) +#define utf8_nonnull UTF8_ATTRIBUTE(nonnull) +#define utf8_pure UTF8_ATTRIBUTE(pure) +#define utf8_restrict +#define utf8_weak UTF8_ATTRIBUTE(weak) #else -#error Non clang, non gcc, non MSVC compiler found! +#error Non clang, non gcc, non MSVC, non tcc compiler found! #endif #ifdef __cplusplus