From b20baa3988f0866e0fd180f2b6afa543437c6db4 Mon Sep 17 00:00:00 2001 From: Sahil Lenka <76817449+Sahil-u07@users.noreply.github.com> Date: Sat, 10 Oct 2026 23:42:39 +0530 Subject: [PATCH] fix(cpp): let concore.hpp build on Windows and macOS ExtractNumeric returned key_t, which comes from . That header is only included under #ifdef __linux__, so concore.hpp and concoredocker.hpp failed to compile anywhere else, including the windows build that mkconcore generates. The value is already stored in an int and the shared memory code that needs key_t is Linux only, so just return int. Added CI jobs that build and run the C++ tests on Windows (MSYS2 UCRT64 gcc) and macOS, since the existing C++ job only covers Linux. --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ concore.hpp | 2 +- concoredocker.hpp | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c297b79..05c8f36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -201,3 +201,35 @@ jobs: run: | g++ -std=c++11 -Wall -Wextra -I. -o TestConcoreHpp TestConcoreHpp.cpp ./TestConcoreHpp + + cpp-test-windows: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v4 + + - uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + install: mingw-w64-ucrt-x86_64-gcc + + - name: Build and run C++ tests + run: | + g++ -std=c++11 -I. -o TestLiteralEvalCpp TestLiteralEvalCpp.cpp + ./TestLiteralEvalCpp + g++ -std=c++11 -I. -o TestConcoreHpp TestConcoreHpp.cpp + ./TestConcoreHpp + + cpp-test-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Build and run C++ tests + run: | + g++ -std=c++11 -I. -o TestLiteralEvalCpp TestLiteralEvalCpp.cpp + ./TestLiteralEvalCpp + g++ -std=c++11 -I. -o TestConcoreHpp TestConcoreHpp.cpp + ./TestConcoreHpp diff --git a/concore.hpp b/concore.hpp index ba676c0..a2f0261 100644 --- a/concore.hpp +++ b/concore.hpp @@ -246,7 +246,7 @@ class Concore{ * @return The numeric part of the string. * Returns -1 if the string does not contain a numeric part. */ - key_t ExtractNumeric(const std::string& str) { + int ExtractNumeric(const std::string& str) { std::string numberString; // Find the number of leading digits in the input string diff --git a/concoredocker.hpp b/concoredocker.hpp index 108ba5f..f761dc9 100644 --- a/concoredocker.hpp +++ b/concoredocker.hpp @@ -242,7 +242,7 @@ class Concore { inpath + "/1/concore.maxtime", defaultValue); } - key_t ExtractNumeric(const std::string& str) { + int ExtractNumeric(const std::string& str) { std::string numberString; size_t numDigits = 0; while (numDigits < str.length() && std::isdigit(str[numDigits])) {