From 21d992cc006159b07b23f120c5235990adfc02c4 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 13 Jul 2022 13:46:03 +0200 Subject: [PATCH] Fix crash on Windows with -j option (#4229) * Fix crash on Windows with -j option * Disable CI-cygwin workflow * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Try to fix Cygwin build * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Update CI-cygwin.yml * Cygwin uses THREADING_MODEL_FORK * Restore workflows * Remove comment * Fix dmake * Fix #11179 FP invalidFunctionArgStr * Revert "Fix #11179 FP invalidFunctionArgStr" This reverts commit dd5d3e67c6cf08cf5b377b991c31dcd06c1bbb79. --- .github/workflows/CI-cygwin.yml | 21 +++++++++++++-------- Makefile | 2 +- cli/processexecutor.cpp | 2 +- lib/config.h | 2 +- lib/programmemory.cpp | 4 ++-- tools/dmake.cpp | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml index abc14bc58..7aaa8cd83 100644 --- a/.github/workflows/CI-cygwin.yml +++ b/.github/workflows/CI-cygwin.yml @@ -16,6 +16,10 @@ jobs: matrix: os: [windows-2019] arch: [x64, x86] + include: + - platform: 'x86_64' + packages: | + gcc-g++ fail-fast: false runs-on: ${{ matrix.os }} @@ -24,26 +28,27 @@ jobs: - uses: actions/checkout@v2 - name: Set up Cygwin - uses: egor-tensin/setup-cygwin@v3 + uses: cygwin/cygwin-install-action@master with: platform: ${{ matrix.arch }} + packages: ${{ matrix.packages }} - name: Build cppcheck run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 - name: Build test run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 testrunner + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 testrunner - name: Run test run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 check + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make -j2 check - name: Extra test for misra run: | - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump - C:\tools\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% - .\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c + cd %GITHUB_WORKSPACE%\addons\test + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 + python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c diff --git a/Makefile b/Makefile index 782a4ff2f..d68b4e997 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ ifndef CXXFLAGS endif ifeq (g++, $(findstring g++,$(CXX))) - override CXXFLAGS += -std=c++0x + override CXXFLAGS += -std=gnu++0x else ifeq (clang++, $(findstring clang++,$(CXX))) override CXXFLAGS += -std=c++0x else ifeq ($(CXX), c++) diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index a248e078d..439fac187 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -18,7 +18,7 @@ #include "processexecutor.h" -#if !defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if !defined(WIN32) && !defined(__MINGW32__) #include "color.h" #include "config.h" diff --git a/lib/config.h b/lib/config.h index 87451e2a9..ecc5d4871 100644 --- a/lib/config.h +++ b/lib/config.h @@ -110,7 +110,7 @@ static const std::string emptyString; #elif defined(USE_THREADS) #define THREADING_MODEL_THREAD #define STDCALL -#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__) && !defined(__CYGWIN__)) || defined(__CPPCHECK__) +#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)) || defined(__CPPCHECK__) #define THREADING_MODEL_FORK #define STDCALL #else diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 902bf3e9f..81d748469 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -1367,8 +1367,8 @@ ValueFlow::Value evaluateLibraryFunction(const std::unordered_map& arg)>> + thread_local static std::unordered_map& arg)>> functions = {}; if (functions.count(returnValue) == 0) { diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 3decc2425..074114509 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -374,7 +374,7 @@ int main(int argc, char **argv) } fout << "ifeq (g++, $(findstring g++,$(CXX)))\n" - << " override CXXFLAGS += -std=c++0x\n" + << " override CXXFLAGS += -std=gnu++0x\n" << "else ifeq (clang++, $(findstring clang++,$(CXX)))\n" << " override CXXFLAGS += -std=c++0x\n" << "else ifeq ($(CXX), c++)\n"