Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #12021 - CI-windows.yml: fail build on compiler warnings / some cleanups #6982

Merged
merged 8 commits into from
Oct 31, 2024
13 changes: 7 additions & 6 deletions .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ jobs:
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!

- name: Build GUI release (Qt 6)
if: startsWith(matrix.qt_ver, '6')
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!

- name: Deploy GUI
Expand Down Expand Up @@ -135,16 +135,15 @@ jobs:
python -m pip install pytest-timeout || exit /b !errorlevel!
python -m pip install psutil || exit /b !errorlevel!

- name: Run CMake
if: false # TODO: enable
run: |
cmake -S . -B build -DBUILD_TESTS=On || exit /b !errorlevel!
# TODO: build with CMake

- name: Build CLI debug configuration using MSBuild
if: matrix.config == 'debug'
run: |
:: cmake --build build --target check --config Debug || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
env:
_CL_: /WX

- name: Run Debug test
if: matrix.config == 'debug'
Expand All @@ -155,6 +154,8 @@ jobs:
run: |
:: cmake --build build --target check --config Release || exit /b !errorlevel!
msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel!
env:
_CL_: /WX

- name: Run Release test
if: matrix.config == 'release'
Expand Down
8 changes: 4 additions & 4 deletions cli/cli.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805</DisableSpecificWarnings>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
Expand Down Expand Up @@ -121,7 +121,7 @@
<PreprocessorDefinitions>CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805</DisableSpecificWarnings>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
Expand Down Expand Up @@ -155,7 +155,7 @@
<OmitFramePointers>true</OmitFramePointers>
<FunctionLevelLinking>true</FunctionLevelLinking>
<StringPooling>true</StringPooling>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805</DisableSpecificWarnings>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -193,7 +193,7 @@
<OmitFramePointers>true</OmitFramePointers>
<FunctionLevelLinking>true</FunctionLevelLinking>
<StringPooling>true</StringPooling>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805</DisableSpecificWarnings>
<DisableSpecificWarnings>4018;4127;4146;4244;4251;4267;4389;4701;4706;4800;4805</DisableSpecificWarnings>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down
4 changes: 1 addition & 3 deletions cmake/compileroptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,10 @@ if(MSVC)
add_compile_options(/wd4127) # warning C4127: conditional expression is constant
add_compile_options(/wd4146) # warning C4146: unary minus operator applied to unsigned type, result still unsigned
add_compile_options(/wd4244) # warning C4244: 'initializing': conversion from 'int' to 'char', possible loss of data
add_compile_options(/wd4251)
add_compile_options(/wd4251) # warning C4251: 'x': class 'y' needs to have dll-interface to be used by clients of struct 'u'
# Clang: -Wshorten-64-to-32 -Wimplicit-int-conversion
add_compile_options(/wd4267) # warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
add_compile_options(/wd4389) # warning C4389: '==': signed/unsigned mismatch
add_compile_options(/wd4482)
add_compile_options(/wd4512)
add_compile_options(/wd4701) # warning C4701: potentially uninitialized local variable 'err' used
add_compile_options(/wd4706) # warning C4706: assignment within conditional expression
add_compile_options(/wd4800) # warning C4800: 'const SymbolDatabase *' : forcing value to bool 'true' or 'false' (performance warning)
Expand Down
4 changes: 4 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ CheckOptions:
if(MSVC)
# compilation will fail as e.g. QList::realloc would be replaced by MSVC's macro definition
target_compile_definitions(cppcheck-gui PRIVATE $<$<CONFIG:Debug>:DISABLE_CRTDBG_MAP_ALLOC>)
if(NOT USE_QT6)
target_compile_options(cppcheck-gui PRIVATE /wd4996) # warning C4996: 'QProcess::startDetached': Use QProcess::startDetached(const QString &program, const QStringList &arguments) instead
target_compile_options(cppcheck-gui PRIVATE /wd4505) # warning C4505: 'x': unreferenced function with internal linkage has been removed
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Q_UNUSED() in generated code
Expand Down
Loading
Loading