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:
parent
46e0be8c26
commit
ffba2b7646
@ -2,7 +2,7 @@ BasedOnStyle: LLVM
|
|||||||
IndentWidth: 8
|
IndentWidth: 8
|
||||||
UseTab: Always
|
UseTab: Always
|
||||||
BreakBeforeBraces: Custom
|
BreakBeforeBraces: Custom
|
||||||
Standard: Cpp03
|
Standard: Cpp11
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
AfterClass: true
|
AfterClass: true
|
||||||
AfterControlStatement: false
|
AfterControlStatement: false
|
||||||
|
@ -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!")
|
message(WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
|
||||||
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 ()
|
||||||
|
|
||||||
# This can be read from ${PROJECT_NAME} after project() is called
|
# This can be read from ${PROJECT_NAME} after project() is called
|
||||||
project(minetest)
|
project(minetest)
|
||||||
set(PROJECT_NAME_CAPITALIZED "Minetest4")
|
set(PROJECT_NAME_CAPITALIZED "Minetest4")
|
||||||
|
@ -23,7 +23,6 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
|
|||||||
FORCE
|
FORCE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Set some random things default to not being visible in the GUI
|
# Set some random things default to not being visible in the GUI
|
||||||
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
|
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
|
||||||
|
|
||||||
@ -722,9 +721,9 @@ include(CheckCSourceCompiles)
|
|||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Visual Studio
|
# Visual Studio
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
|
||||||
# EHa enables SEH exceptions (used for catching segfaults)
|
# 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 /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF")
|
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")
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000")
|
||||||
endif()
|
endif()
|
||||||
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()
|
endif()
|
||||||
if(WIN32 AND NOT ZLIBWAPI_DLL AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if(WIN32 AND NOT ZLIBWAPI_DLL AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
set(OTHER_FLAGS "${OTHER_FLAGS} -DWIN32_NO_ZLIB_WINAPI")
|
set(OTHER_FLAGS "${OTHER_FLAGS} -DWIN32_NO_ZLIB_WINAPI")
|
||||||
|
@ -203,7 +203,7 @@ public:
|
|||||||
deleted until this is 0 to keep the id preserved for the right
|
deleted until this is 0 to keep the id preserved for the right
|
||||||
object.
|
object.
|
||||||
*/
|
*/
|
||||||
u16 m_known_by_count;
|
u16 m_known_by_count = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- Whether this object is to be removed when nobody knows about
|
- 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
|
- 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.
|
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.
|
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
|
If this is set alongside with m_pending_removal, removal takes
|
||||||
priority.
|
priority.
|
||||||
*/
|
*/
|
||||||
bool m_pending_deactivation;
|
bool m_pending_deactivation = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A getter that unifies the above to answer the question:
|
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
|
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
|
The block from which the object was loaded from, and in which
|
||||||
a copy of the static data resides.
|
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
|
Queue of messages to be sent to the client
|
||||||
|
@ -90,9 +90,9 @@ struct SettingsEntry {
|
|||||||
is_group(true)
|
is_group(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string value;
|
std::string value = "";
|
||||||
Settings *group;
|
Settings *group;
|
||||||
bool is_group;
|
bool is_group = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;
|
typedef UNORDERED_MAP<std::string, SettingsEntry> SettingEntries;
|
||||||
|
10
src/shader.h
10
src/shader.h
@ -45,11 +45,11 @@ std::string getShaderPath(const std::string &name_of_shader,
|
|||||||
const std::string &filename);
|
const std::string &filename);
|
||||||
|
|
||||||
struct ShaderInfo {
|
struct ShaderInfo {
|
||||||
std::string name;
|
std::string name = "";
|
||||||
video::E_MATERIAL_TYPE base_material;
|
video::E_MATERIAL_TYPE base_material = video::EMT_SOLID;
|
||||||
video::E_MATERIAL_TYPE material;
|
video::E_MATERIAL_TYPE material = video::EMT_SOLID;
|
||||||
u8 drawtype;
|
u8 drawtype = 0;
|
||||||
u8 material_type;
|
u8 material_type = 0;
|
||||||
s32 user_data;
|
s32 user_data;
|
||||||
|
|
||||||
ShaderInfo(): name(""), base_material(video::EMT_SOLID),
|
ShaderInfo(): name(""), base_material(video::EMT_SOLID),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user