TRy to complain with C++11 on all possible cases

* Minetest for C++11 CMakeLists or C++0X on pre supported
* Clang format fixes on checked files (compat Cpp11 instead of Cpp03)
* Mingw GCC update from 4.8.4 to 5.3 (Ubuntu Xenial)
* Let compatibilty for GCC 4.4+
* Fix initialization standars for C++11 on mayor cases
This commit is contained in:
mckaygerhard 2021-11-22 03:16:05 -04:00
parent 46e0be8c26
commit ffba2b7646
6 changed files with 34 additions and 16 deletions

View File

@ -2,7 +2,7 @@ BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Custom
Standard: Cpp03
Standard: Cpp11
BraceWrapping:
AfterClass: true
AfterControlStatement: false

View File

@ -5,6 +5,16 @@ if(${CMAKE_VERSION} STREQUAL "2.8.2")
message(WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
endif()
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "--std=gnu++0x ${CMAKE_C_FLAGS}")
endif ()
else ()
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
endif ()
# This can be read from ${PROJECT_NAME} after project() is called
project(minetest)
set(PROJECT_NAME_CAPITALIZED "Minetest4")

View File

@ -23,7 +23,6 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
FORCE
)
# Set some random things default to not being visible in the GUI
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
@ -722,9 +721,9 @@ include(CheckCSourceCompiles)
if(MSVC)
# Visual Studio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
# EHa enables SEH exceptions (used for catching segfaults)
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP /std:c++11")
#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF")
@ -772,6 +771,15 @@ else()
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000")
endif()
endif()
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "--std=gnu++0x ${CMAKE_C_FLAGS}")
endif ()
else ()
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
endif ()
endif()
if(WIN32 AND NOT ZLIBWAPI_DLL AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(OTHER_FLAGS "${OTHER_FLAGS} -DWIN32_NO_ZLIB_WINAPI")

View File

@ -203,7 +203,7 @@ public:
deleted until this is 0 to keep the id preserved for the right
object.
*/
u16 m_known_by_count;
u16 m_known_by_count = 0;
/*
- Whether this object is to be removed when nobody knows about
@ -213,7 +213,7 @@ public:
- This is usually set to true by the step() method when the object wants
to be deleted but can be set by anything else too.
*/
bool m_pending_removal;
bool m_pending_removal = true;
/*
Same purpose as m_pending_removal but for deactivation.
@ -222,7 +222,7 @@ public:
If this is set alongside with m_pending_removal, removal takes
priority.
*/
bool m_pending_deactivation;
bool m_pending_deactivation = false;
/*
A getter that unifies the above to answer the question:
@ -234,12 +234,12 @@ public:
/*
Whether the object's static data has been stored to a block
*/
bool m_static_exists;
bool m_static_exists = false;
/*
The block from which the object was loaded from, and in which
a copy of the static data resides.
*/
v3s16 m_static_block;
v3s16 m_static_block = v3s16(1337,1337,1337);
/*
Queue of messages to be sent to the client

View File

@ -90,9 +90,9 @@ struct SettingsEntry {
is_group(true)
{}
std::string value;
std::string value = "";
Settings *group;
bool is_group;
bool is_group = false;
};
typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;

View File

@ -45,11 +45,11 @@ std::string getShaderPath(const std::string &name_of_shader,
const std::string &filename);
struct ShaderInfo {
std::string name;
video::E_MATERIAL_TYPE base_material;
video::E_MATERIAL_TYPE material;
u8 drawtype;
u8 material_type;
std::string name = "";
video::E_MATERIAL_TYPE base_material = video::EMT_SOLID;
video::E_MATERIAL_TYPE material = video::EMT_SOLID;
u8 drawtype = 0;
u8 material_type = 0;
s32 user_data;
ShaderInfo(): name(""), base_material(video::EMT_SOLID),