From 86cfb3821150d24cd60e5501720779696379643a Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 9 Feb 2021 13:01:13 +0000 Subject: MSVC warnings --- CMakeLists.txt | 2 ++ SetFlags.cmake | 11 ++++++++++- src/Globals.h | 26 -------------------------- src/Map.h | 11 ----------- src/Scoreboard.h | 11 ----------- 5 files changed, 12 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70f25184a..f1204b8bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # File failed to follow NHS guidelines on handwashing and has not maintained good hygiene set_source_files_properties("${PROJECT_SOURCE_DIR}/src/IniFile.cpp" PROPERTIES COMPILE_OPTIONS -Wno-header-hygiene) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set_source_files_properties("${PROJECT_SOURCE_DIR}/src/Bindings/Bindings.cpp" PROPERTIES COMPILE_OPTIONS -w) endif() if(${BUILD_TOOLS}) diff --git a/SetFlags.cmake b/SetFlags.cmake index 2900418ea..4ef8ecd2a 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -104,7 +104,16 @@ endfunction() function(set_exe_flags TARGET) if (MSVC) - # TODO: MSVC level 4, warnings as errors + # TODO: Warnings as errors + target_compile_options( + ${TARGET} PRIVATE + + # Warnings level 4: + /W4 + + # Excessive amount of logspam (Unreferenced formal parameter), disable for now: + /wd4100 + ) return () endif() diff --git a/src/Globals.h b/src/Globals.h index bb512d89d..c081c5998 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -16,32 +16,6 @@ // Compiler-dependent stuff: #if defined(_MSC_VER) - // Disable some warnings that we don't care about: - #pragma warning(disable:4100) // Unreferenced formal parameter - - // Useful warnings from warning level 4: - #pragma warning(3 : 4189) // Local variable is initialized but not referenced - #pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch - #pragma warning(3 : 4310) // Cast truncates constant value - #pragma warning(3 : 4389) // Signed / unsigned mismatch - #pragma warning(3 : 4505) // Unreferenced local function has been removed - #pragma warning(3 : 4701) // Potentially unitialized local variable used - #pragma warning(3 : 4702) // Unreachable code - #pragma warning(3 : 4706) // Assignment within conditional expression - - // 2014-10-23 xoft: Disabled this because the new C++11 headers in MSVC produce tons of these warnings uselessly - // #pragma warning(3 : 4127) // Conditional expression is constant - - // Disabling this warning, because we know what we're doing when we're doing this: - #pragma warning(disable: 4355) // 'this' used in initializer list - - // Disabled because it's useless: - #pragma warning(disable: 4512) // 'class': assignment operator could not be generated - reported for each class that has a reference-type member - #pragma warning(disable: 4351) // new behavior: elements of array 'member' will be default initialized - - // 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places - // #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data - // Use non-standard defines in #define _USE_MATH_DEFINES diff --git a/src/Map.h b/src/Map.h index 7ae120c30..493b0883e 100644 --- a/src/Map.h +++ b/src/Map.h @@ -169,17 +169,6 @@ public: const cColorList & GetData(void) const { return m_Data; } - static const char * GetClassStatic(void) // Needed for ManualBindings's DoWith templates - { - return "cMap"; - } - - const char * GetClass(void) // Needed for ManualBindings' DoWith templates - { - return "cMap"; - } - - private: /** Update the specified pixel. */ diff --git a/src/Scoreboard.h b/src/Scoreboard.h index c22ddfb28..523598578 100644 --- a/src/Scoreboard.h +++ b/src/Scoreboard.h @@ -96,12 +96,6 @@ public: /** Send this objective to the specified client */ void SendTo(cClientHandle & a_Client); - static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates - { - return "cObjective"; - } - - private: typedef std::pair cTrackedPlayer; @@ -176,11 +170,6 @@ public: // tolua_end - static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates - { - return "cTeam"; - } - private: typedef std::set cPlayerNameSet; -- cgit v1.2.3