Skip to content
Open
57 changes: 57 additions & 0 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: MinGW Clang64 Full Pipeline

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
strategy:
fail-fast: false
matrix:
profile: [RelWithDebInfo, Debug]

name: MinGW Clang64 Build (${{ matrix.profile }})
runs-on: windows-2025
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job is missing a timeout-minutes configuration. Other workflows in this repository consistently set timeout-minutes (e.g., 30 minutes for similar build jobs in reusable-cmake-build.yml). This is important to prevent jobs from hanging indefinitely and consuming runner resources.

Suggested change
runs-on: windows-2025
runs-on: windows-2025
timeout-minutes: 30

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. Removing it would improve consistency.

Copilot uses AI. Check for mistakes.
steps:
- name: Checkout code
uses: actions/checkout@v4


- name: Setup MSYS2
id: msys2
uses: msys2/setup-msys2@v2
Comment on lines +23 to +26
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra blank line here. For consistency with other workflow files in the repository, there should be a single blank line between steps.

Suggested change
- name: Setup MSYS2
id: msys2
uses: msys2/setup-msys2@v2
- name: Setup MSYS2
id: msys2
uses: msys2/setup-msys2@v2
uses: msys2/setup-msys2@v2

Copilot uses AI. Check for mistakes.
with:
msystem: clang64
update: true
install: >-
git
mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-ninja

- name: Configure
shell: msys2 {0}
run: >
cmake -GNinja
-B"$(cygpath -u "$GITHUB_WORKSPACE")/build"
-DCMAKE_BUILD_TYPE=${{ matrix.profile }}
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configure step is missing the -DSNMALLOC_CI_BUILD=ON flag that is consistently used in other CI workflows. This flag enables additional debug information and backtrace support in CI builds, which would be beneficial for debugging failures in this workflow as well.

Suggested change
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_COMPILER=clang
-DSNMALLOC_CI_BUILD=ON

Copilot uses AI. Check for mistakes.

- name: Build
shell: msys2 {0}
run: >
cmake
--build "$(cygpath -u "$GITHUB_WORKSPACE")/build"
--parallel

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. Removing it would improve consistency.

Suggested change

Copilot uses AI. Check for mistakes.
- name: Test
shell: msys2 {0}
run: |
cd "$(cygpath -u "$GITHUB_WORKSPACE")/build"
ctest
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ctest invocation is missing common flags used in other workflows. It should include --output-on-failure to provide better debugging information when tests fail, -j 4 for parallel execution, and --timeout 400 to prevent hanging tests. For consistency with other workflows (see .github/workflows/reusable-cmake-build.yml:115), consider using: ctest --output-on-failure -j 4 -C ${{ matrix.profile }} --timeout 400

Suggested change
ctest
ctest --output-on-failure -j 4 -C ${{ matrix.profile }} --timeout 400

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. Removing it would improve consistency.

Suggested change

Copilot uses AI. Check for mistakes.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ if(MSVC)
target_compile_options(snmalloc INTERFACE "/Zc:__cplusplus")
endif()

if(MINGW)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(snmalloc INTERFACE "-fms-extensions")
endif()
endif()

if (CMAKE_SYSTEM_NAME STREQUAL NetBSD)
target_include_directories(snmalloc INTERFACE /usr/pkg/include)
target_link_directories(snmalloc INTERFACE /usr/pkg/lib)
Expand Down Expand Up @@ -381,9 +387,10 @@ function(add_warning_flags name)
$<$<CXX_COMPILER_ID:MSVC>:/Zi /W4 /WX /wd4127 /wd4324 /wd4201>
$<$<NOT:$<OR:$<CXX_COMPILER_ID:MSVC>,$<STREQUAL:${CMAKE_CXX_SIMULATE_ID},MSVC>>>:-fno-rtti -Wall -Wextra -Werror -Wundef>
$<$<CXX_COMPILER_ID:Clang>:-Wsign-conversion -Wconversion>)

target_link_options(${name} PRIVATE
Comment on lines +390 to 391
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace at the end of this line. While this doesn't affect functionality, removing it would improve code consistency.

Suggested change
target_link_options(${name} PRIVATE
target_link_options(${name} PRIVATE

Copilot uses AI. Check for mistakes.
$<$<BOOL:${SNMALLOC_LINKER_SUPPORT_NO_ALLOW_SHLIB_UNDEF}>:-Wl,--no-undefined>
$<$<PLATFORM_ID:Windows>:$<${ci_or_debug}:/DEBUG>>)
$<$<PLATFORM_ID:Windows>:$<${ci_or_debug}:LINKER:/DEBUG>>)
endfunction()

# To build with just the header library target define SNMALLOC_HEADER_ONLY_LIBRARY
Expand Down
6 changes: 4 additions & 2 deletions src/snmalloc/pal/pal_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
* be destroyed when the program exits or the DLL is
* unloaded.
*/
# pragma warning(disable : 4075)
# pragma init_seg(".CRT$XCB")
# ifndef __MINGW32__
# pragma warning(disable : 4075)
# pragma init_seg(".CRT$XCB")
# endif

namespace snmalloc
{
Expand Down
4 changes: 2 additions & 2 deletions src/test/func/protect_fork/protect_fork.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include <snmalloc/snmalloc.h>

#ifndef SNMALLOC_PTHREAD_ATFORK_WORKS
#if !defined(SNMALLOC_PTHREAD_ATFORK_WORKS) || defined(__MINGW32__)
int main()
{
std::cout << "Test did not run" << std::endl;
Expand Down Expand Up @@ -78,4 +78,4 @@ int main()
return 0;
}

#endif
#endif
Loading