From 3182c392808f18d5a65467a55022b9e04f70a740 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 3 Jul 2020 21:18:17 +0200 Subject: [PATCH] Add clang-cl in the continuous Integration --- .github/workflows/ccpp.yml | 18 +++++++++++++----- tests/Make-check-cl.bat | 23 +++++++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 7ef2bef5..04654571 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -11,8 +11,6 @@ jobs: steps: - uses: actions/checkout@v1 - - name: make - run: make - name: make check C99 run: make check - name: make check C11 @@ -30,8 +28,6 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Install MINGW - run: choco install mingw --no-progress - name: make check shell: bash run: mingw32-make CC="gcc -std=c99 -D__USE_MINGW_ANSI_STDIO=1" check @@ -47,5 +43,17 @@ jobs: - name: make check shell: cmd working-directory: ./tests - run: Make-check-cl.bat + run: Make-check-cl.bat cl + build_windows_clang_cl: + strategy: + matrix: + platform: [windows-latest] + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v1 + - name: make check + shell: cmd + working-directory: ./tests + run: Make-check-cl.bat clang-cl diff --git a/tests/Make-check-cl.bat b/tests/Make-check-cl.bat index ff3e6259..2a630b6e 100644 --- a/tests/Make-check-cl.bat +++ b/tests/Make-check-cl.bat @@ -30,6 +30,10 @@ IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxi call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 ) +REM Add clang-cl in the PATH. It is the default install of clang for MSVC +REM See https://docs.microsoft.com/de-de/cpp/build/clang-support-msbuild?view=vs-2019 +SET PATH=%PATH%;%VCINSTALLDIR%\Tools\Llvm\bin;%VCINSTALLDIR%\Tools\Llvm\x64\bin + REM Remove previous results DEL *.log *.dat @@ -37,13 +41,12 @@ REM List the expected failure (compiler internal error) set "expectedFailure1=test-msnapshot.c" set "expectedFailure2=test-none.c" -echo "Compiler full version:" -cl /Bv +REM Select compiler to use (either cl or clang-cl) +set "compiler=%1" -SET PATH=%PATH%;%VCINSTALLDIR%\Tools\Llvm\bin;%VCINSTALLDIR%\Tools\Llvm\x64\bin -clang-cl /Bv - -echo " " +echo "Compiler full version (%compiler%):" +%compiler% /Bv +%compiler% -v REM Perform for each test for %%f in (test-*.c) do ( @@ -56,9 +59,9 @@ for %%f in (test-*.c) do ( REM /Zc:preprocessor is mandatory to have a compliant preprocessor REM /Zc:__cplusplus is needed to report the real value of __cplusplus, so that M*LIB uses the C++ atomic, and not its emulation. REM Enable warnings and basic optimization - REM Inform M*LIB to use Annex K - echo Compiling %%f - cl.exe /I.. /O2 /W3 /std:c++14 /Zc:__cplusplus /Zc:preprocessor /D__STDC_WANT_LIB_EXT1__ test.cpp > %%f.log 2>&1 + REM Inform M*LIB to use Annex K by defining __STDC_WANT_LIB_EXT1__ + echo Compiling %%f with %compiler% + %compiler% /I.. /O2 /W3 /std:c++14 /Zc:__cplusplus /Zc:preprocessor /D__STDC_WANT_LIB_EXT1__ test.cpp > %%f.log 2>&1 if ERRORLEVEL 1 ( echo *** BUILD ERROR for %%f *** >> %%f.log type %%f.log @@ -76,5 +79,5 @@ for %%f in (test-*.c) do ( ) type %%f.log ) -echo "All tests passed (except %expectedFailure%)" +echo "All tests passed (except %expectedFailure1%)" exit /B 0