Downgrade to C++17

This commit is contained in:
Martin Natano
2023-03-17 20:07:15 +01:00
parent d107e2b8c1
commit 2d9cc038cd
3 changed files with 15 additions and 15 deletions
+5 -8
View File
@@ -87,7 +87,7 @@ else()
${SMDATA_ALL_FILES_HPP}) ${SMDATA_ALL_FILES_HPP})
endif() endif()
set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_STANDARD 20) set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_STANDARD 17)
set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_EXTENSIONS ON) set_property(TARGET "${SM_EXE_NAME}" PROPERTY CXX_EXTENSIONS ON)
@@ -123,18 +123,15 @@ if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) cmake_policy(SET CMP0025 NEW)
endif() endif()
# COMPILE_WARNING_AS_ERROR is only supported starting with cmake 3.24.
# Continue using -Werror and /WX to treat warnings as errors until cmake >= 3.24 is required.
set_property(TARGET "${SM_EXE_NAME}" PROPERTY COMPILE_WARNING_AS_ERROR ON)
target_compile_options("${SM_EXE_NAME}" PRIVATE target_compile_options("${SM_EXE_NAME}" PRIVATE
$<$<CXX_COMPILER_ID:GNU>: $<$<CXX_COMPILER_ID:GNU>:
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas> -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas>
$<$<CXX_COMPILER_ID:Clang>: $<$<CXX_COMPILER_ID:Clang>:
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template> -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<CXX_COMPILER_ID:AppleClang>:
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template -Wno-deprecated-declarations -Wno-unused-command-line-argument> -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template -Wno-deprecated-declarations -Wno-unused-command-line-argument>
$<$<CXX_COMPILER_ID:MSVC>: $<$<CXX_COMPILER_ID:MSVC>:
/WX /W4 /wd4100 /wd4189 /wd4244 /wd4267 /wd4702> /W4 /wd4100 /wd4189 /wd4244 /wd4267 /wd4702>
) )
set(SM_COMPILE_FLAGS "") set(SM_COMPILE_FLAGS "")
+4 -6
View File
@@ -4,7 +4,6 @@
#define RAGE_UTIL_H #define RAGE_UTIL_H
#include <algorithm> #include <algorithm>
#include <bit>
#include <map> #include <map>
#include <random> #include <random>
#include <vector> #include <vector>
@@ -189,15 +188,14 @@ namespace Endian
{ {
// When std::endian is supported by all desired compilers, we can eliminate the #ifdefs // When std::endian is supported by all desired compilers, we can eliminate the #ifdefs
// (At least) the current compiler used for the Ubuntu 20.04 build does not support this. // (At least) the current compiler used for the Ubuntu 20.04 build does not support this.
#if defined(__cpp_lib_endian) #if defined(__BYTE_ORDER__)
inline constexpr bool little = std::endian::native == std::endian::little; inline constexpr bool little = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
inline constexpr bool big = std::endian::native == std::endian::big; inline constexpr bool big = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
#elif defined(_WIN32) #elif defined(_WIN32)
inline constexpr bool little = false; inline constexpr bool little = false;
inline constexpr bool big = true; inline constexpr bool big = true;
#else #else
inline constexpr bool little = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__; #error "unknown byte order"
inline constexpr bool big = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
#endif #endif
} }
+6 -1
View File
@@ -576,7 +576,12 @@ void SongManager::UnlistSong(Song *song)
std::vector<Song*>* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs }; std::vector<Song*>* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs };
for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) { for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) {
std::vector<Song*>& v = *songVectors[songVecIdx]; std::vector<Song*>& v = *songVectors[songVecIdx];
std::erase_if( v, [song](Song* vSong){return vSong == song;} ); for (size_t i=0; i<v.size(); ++i) {
if (v[i] == song) {
v.erase(v.begin()+i);
--i;
}
}
} }
} }