Merge 5ae4721b7e1b690e42b01227e22b76e33a3b2348 into 758d39eb239e6554d3ac0659b6f592fcd5317c24

This commit is contained in:
hexonal 2026-07-30 08:17:45 +00:00 committed by GitHub
commit c086c8dbca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View File

@ -179,6 +179,13 @@ jobs:
sudo apt install locales-all
cmake -E make_directory ${{runner.workspace}}/build
- name: Select matching C compiler
run: |
cc=${{matrix.cxx}}
cc=${cc/clang++/clang}
cc=${cc/g++/gcc}
echo "CC=$cc" >> "$GITHUB_ENV"
- name: Configure
working-directory: ${{runner.workspace}}/build
env:

View File

@ -242,6 +242,14 @@ if (FMT_CUDA_TEST)
endif ()
enable_language(C)
add_executable(c-test c-test.c)
target_link_libraries(c-test PRIVATE fmt::fmt-c)
add_test(NAME c-test COMMAND c-test)
# Clang < 3.8 doesn't apply array-to-pointer decay to the controlling
# expression of _Generic (https://llvm.org/PR16340), so fmt-c.h's argument
# dispatch doesn't match string literals there.
if (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION
VERSION_LESS 3.8)
message(STATUS "Skipping c-test: _Generic is broken in Clang < 3.8")
else ()
add_executable(c-test c-test.c)
target_link_libraries(c-test PRIVATE fmt::fmt-c)
add_test(NAME c-test COMMAND c-test)
endif ()