fix: more MSVC warnings (#5137)

This commit is contained in:
nerix
2024-01-30 17:28:36 +01:00
committed by GitHub
parent a5e853573f
commit 954e19817c
17 changed files with 59 additions and 47 deletions
+7 -5
View File
@@ -935,6 +935,7 @@ target_compile_definitions(${LIBRARY_PROJECT} PUBLIC
AB_CUSTOM_SETTINGS
IRC_STATIC
IRC_NAMESPACE=Communi
$<$<BOOL:${WIN32}>:_WIN32_WINNT=0x0A00> # Windows 10
)
if (USE_SYSTEM_QTKEYCHAIN)
@@ -1048,10 +1049,6 @@ if (MSVC)
# Someone adds /W3 before we add /W4.
# This makes sure, only /W4 is specified.
string(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# 4505 - "unreferenced local version has been removed"
# Although this might give hints on dead code,
# there are some cases where it's distracting.
#
# 4100 - "unreferenced formal parameter"
# There are a lot of functions and methods where
# an argument was given a name but never used.
@@ -1062,6 +1059,11 @@ if (MSVC)
# These are implicit conversions from size_t to int/qsizetype.
# We don't use size_t in a lot of cases, since
# Qt doesn't use it - it uses int (or qsizetype in Qt6).
#
# 4458 - "declaration of 'identifier' hides class member"
# We have a rule of exclusively using `this->`
# to access class members, thus it's fine to reclare a variable
# with the same name as a class member.
target_compile_options(${LIBRARY_PROJECT} PUBLIC
/W4
# 5038 - warnings about initialization order
@@ -1069,9 +1071,9 @@ if (MSVC)
# 4855 - implicit capture of 'this' via '[=]' is deprecated
/w14855
# Disable the following warnings (see reasoning above)
/wd4505
/wd4100
/wd4267
/wd4458
# Enable updated '__cplusplus' macro - workaround for CMake#18837
/Zc:__cplusplus
)