Merge pull request #10518 from akallabeth/clang-tidy-cleanup

Clang tidy cleanup
This commit is contained in:
akallabeth 2024-08-28 16:36:16 +02:00 committed by GitHub
commit 380c5808a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 114 additions and 4 deletions

View File

@ -22,30 +22,40 @@ Checks: >
-altera-struct-pack-align,
-altera-unroll-loops,
-bugprone-easily-swappable-parameters,
-bugprone-assignment-in-if-condition,
-cert-dcl16-c,
-cert-env33-c,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-type-vararg,
-google-readability-braces-around-statements,
-hicpp-braces-around-statements,
-hicpp-no-array-decay,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
-hicpp-uppercase-literal-suffix,
-hicpp-vararg,
-llvm-header-guard,
-llvm-include-order,
-llvm-qualified-auto,
-llvm-else-after-return,
-readability-else-after-return,
-modernize-use-trailing-return-type,
-modernize-macro-to-enum,
-readability-braces-around-statements,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-qualified-auto,
-readability-uppercase-literal-suffix,
-performance-no-int-to-ptr
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file
User: nin
CheckOptions:

View File

@ -14,7 +14,7 @@ jobs:
id: review
with:
split_workflow: true
clang_tidy_checks: ''
config_file: '.clang-tidy'
# List of packages to install
apt_packages: libkrb5-dev,libxkbcommon-dev,libxkbfile-dev,libx11-dev,libwayland-dev,libxrandr-dev,libxi-dev,libxrender-dev,libxext-dev,libxinerama-dev,libxfixes-dev,libxcursor-dev,libxv-dev,libxdamage-dev,libxtst-dev,libcups2-dev,libcairo2-dev,libpcsclite-dev,libasound2-dev,libswscale-dev,libpulse-dev,libavcodec-dev,libavutil-dev,libfuse3-dev,libswresample-dev,libusb-1.0-0-dev,libudev-dev,libdbus-glib-1-dev,libpam0g-dev,uuid-dev,libxml2-dev,libcjson-dev,libsdl2-2.0-0,libsdl2-dev,libsdl2-ttf-dev,libsdl2-image-dev,libsystemd-dev,liburiparser-dev,libopus-dev,libwebp-dev,libjpeg-dev,libpng-dev,xsltproc,docbook-xsl,libgsm1-dev,libfaac-dev,libfaad-dev,libsoxr-dev,opencl-c-headers,opencl-headers,ocl-icd-opencl-dev,libssl-dev,libv4l-dev

View File

@ -3,6 +3,8 @@ set(MODULE_PREFIX "TEST_SDL")
set(DRIVER ${MODULE_NAME}.cpp)
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(TEST_SRCS
TestSDLDialogs.cpp
)

View File

@ -3,6 +3,9 @@ set(MODULE_PREFIX "TEST_SDL")
set(DRIVER ${MODULE_NAME}.cpp)
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(TEST_SRCS
TestSDLDialogs.cpp
)

View File

@ -5,6 +5,9 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.cpp)
set(${MODULE_PREFIX}_TESTS TestSDLPrefs.cpp)
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
${${MODULE_PREFIX}_TESTS})

View File

@ -4,6 +4,8 @@ set(MODULE_PREFIX "TEST_CLIENT")
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_TESTS
TestClientRdpFile.c
TestClientChannels.c

View File

@ -35,3 +35,4 @@ include(MSVCRuntime)
include(ConfigureRPATH)
include(ClangTidy)
include(AddTargetWithResourceFile)
include(DisableCompilerWarnings)

View File

@ -0,0 +1,21 @@
if (MSVC)
set(COMPILE_WARN_OPTS "/W0")
else()
set(COMPILE_WARN_OPTS "-w")
endif()
set(COMPILE_WARN_OPTS "${COMPILE_WARN_OPTS}" CACHE STRING "cached value")
function (disable_warnings_for_directory dir)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
set_property(
DIRECTORY "${dir}"
PROPERTY COMPILE_OPTIONS ${COMPILE_WARN_OPTS}
)
endif()
file(MAKE_DIRECTORY "${dir}")
set(ctidy "${dir}/.clang-tidy")
file(WRITE ${ctidy} "Checks: '-*,misc-definitions-in-headers'\n")
file(APPEND ${ctidy} "CheckOptions:\n")
file(APPEND ${ctidy} "\t- { key: HeaderFileExtensions, value: \"x\" }\n")
endfunction()

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestFreeRDPCodec")
set(MODULE_PREFIX "TEST_FREERDP_CODEC")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestCommon")
set(MODULE_PREFIX "TEST_COMMON")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestCore")
set(MODULE_PREFIX "TEST_CORE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestFreeRDPCrypto")
set(MODULE_PREFIX "TEST_FREERDP_CRYPTO")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestGdi")
set(MODULE_PREFIX "TEST_GDI")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
@ -23,7 +25,7 @@ include_directories(..)
add_library(helpers STATIC
helpers.c)
target_link_libraries(helpers freerdp)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestPrimitives")
set(MODULE_PREFIX "TEST_FREERDP_PRIMITIVES")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestFreeRDPUtils")
set(MODULE_PREFIX "TEST_FREERDP_UTILS")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestRdTk")
set(MODULE_PREFIX "TEST_RDTK")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestClipboard")
set(MODULE_PREFIX "TEST_CLIPBOARD")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestComm")
set(MODULE_PREFIX "TEST_COMM")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestCrt")
set(MODULE_PREFIX "TEST_CRT")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestCrypto")
set(MODULE_PREFIX "TEST_CRYPTO")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestDsParse")
set(MODULE_PREFIX "TEST_DSPARSE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestEnvironment")
set(MODULE_PREFIX "TEST_ENVIRONMENT")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestError")
set(MODULE_PREFIX "TEST_ERROR")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -3,6 +3,8 @@ if (NOT WIN32)
set(MODULE_NAME "TestFile")
set(MODULE_PREFIX "TEST_FILE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestInterlocked")
set(MODULE_PREFIX "TEST_INTERLOCKED")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestIo")
set(MODULE_PREFIX "TEST_IO")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestLibrary")
set(MODULE_PREFIX "TEST_LIBRARY")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestMemory")
set(MODULE_PREFIX "TEST_MEMORY")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -1,6 +1,8 @@
set(MODULE_NAME "TestNCrypt")
set(MODULE_PREFIX "TEST_NCRYPT")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
@ -22,7 +24,7 @@ foreach(test ${${MODULE_PREFIX}_TESTS})
endforeach()
target_link_libraries(${MODULE_NAME} winpr ${OPENSSL_LIBRARIES})
if(WIN32)
if(WIN32)
target_link_libraries(${MODULE_NAME} ncrypt)
endif()

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestNt")
set(MODULE_PREFIX "TEST_NT")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestPath")
set(MODULE_PREFIX "TEST_PATH")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestPipe")
set(MODULE_PREFIX "TEST_PIPE")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestPool")
set(MODULE_PREFIX "TEST_POOL")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestSecurity")
set(MODULE_PREFIX "TEST_SECURITY")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestSmartCard")
set(MODULE_PREFIX "TEST_SMARTCARD")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestSspi")
set(MODULE_PREFIX "TEST_SSPI")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestSynch")
set(MODULE_PREFIX "TEST_SYNCH")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestSysInfo")
set(MODULE_PREFIX "TEST_SYSINFO")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestThread")
set(MODULE_PREFIX "TEST_THREAD")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestWinPRUtils")
set(MODULE_PREFIX "TEST_WINPR_UTILS")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestWtsApi")
set(MODULE_PREFIX "TEST_WTSAPI")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(UNIX_ONLY

View File

@ -2,6 +2,8 @@
set(MODULE_NAME "TestWinPR")
set(MODULE_PREFIX "TEST_WINPR")
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS TestIntrinsics.c TestTypes.c)