Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade c++ standard from gnu++0x to c++17 #5146

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ endif()

# Set some compiler options
if(UNIX OR MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-function")
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/font/font_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ void FontManager::unitTesting()
// Hide gettext warning
Log::setLogLevel(5);
delete translations;
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
std::string s=std::string("LANGUAGE=") + lang.c_str();
_putenv(s.c_str());
#else
Expand Down
2 changes: 1 addition & 1 deletion src/io/file_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ bool FileManager::checkAndCreateDirectory(const std::string &path)
Log::info("FileManager", "Creating directory '%s'.", path.c_str());

// Otherwise try to create the directory:
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
bool error = _wmkdir(StringUtils::utf8ToWide(path).c_str()) != 0;
#else
bool error = mkdir(path.c_str(), 0777) != 0;
Expand Down
4 changes: 2 additions & 2 deletions src/io/rich_presence.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <atomic>
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
#include <namedpipeapi.h>
#endif
#include <thread>
Expand All @@ -26,7 +26,7 @@ namespace RichPresenceNS
bool m_connected;
std::atomic_bool m_ready;
time_t m_last;
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
HANDLE m_socket;
#else
int m_socket;
Expand Down
2 changes: 1 addition & 1 deletion src/network/socket_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "utils/types.hpp"

#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
# include <winsock2.h>
# include <ws2tcpip.h>
#else
Expand Down
2 changes: 1 addition & 1 deletion src/network/stk_ipv6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include <string.h>
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
#ifdef __GNUC__
# include <ws2tcpip.h> // Mingw / gcc on windows
# undef _WIN32_WINNT
Expand Down
4 changes: 2 additions & 2 deletions src/states_screens/options/options_screen_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam

if (selection == "system")
{
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
_putenv("LANGUAGE=");
#else
unsetenv("LANGUAGE");
#endif
}
else
{
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
std::string s=std::string("LANGUAGE=")+selection.c_str();
_putenv(s.c_str());
#else
Expand Down
8 changes: 4 additions & 4 deletions src/utils/file_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sys/stat.h>

// ----------------------------------------------------------------------------
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
#include <windows.h>
// ----------------------------------------------------------------------------
namespace u8checker
Expand Down Expand Up @@ -117,7 +117,7 @@ std::string FileUtils::Private::getShortPathWriting(const std::string& u8_path)
*/
FILE* FileUtils::fopenU8Path(const std::string& u8_path, const char* mode)
{
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
std::vector<wchar_t> mode_str;
for (unsigned i = 0; i < strlen(mode); i++)
mode_str.push_back((wchar_t)mode[i]);
Expand All @@ -133,7 +133,7 @@ FILE* FileUtils::fopenU8Path(const std::string& u8_path, const char* mode)
*/
int FileUtils::statU8Path(const std::string& u8_path, struct stat *buf)
{
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
struct _stat st;
int ret = _wstat(StringUtils::utf8ToWide(u8_path).c_str(), &st);
buf->st_dev = st.st_dev;
Expand All @@ -159,7 +159,7 @@ int FileUtils::statU8Path(const std::string& u8_path, struct stat *buf)
int FileUtils::renameU8Path(const std::string& u8_path_old,
const std::string& u8_path_new)
{
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
return _wrename(StringUtils::utf8ToWide(u8_path_old).c_str(),
StringUtils::utf8ToWide(u8_path_new).c_str());
#else
Expand Down
4 changes: 2 additions & 2 deletions src/utils/file_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace FileUtils
* u8_path is unicode encoded. */
inline std::string getPortableWritingPath(const std::string& u8_path)
{
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
return Private::getShortPathWriting(u8_path);
#else
return u8_path;
Expand All @@ -54,7 +54,7 @@ namespace FileUtils
* is unicode encoded. */
inline std::string getPortableReadingPath(const std::string& u8_path)
{
#if defined(WIN32)
#if defined(WIN32) || defined(__MINGW32__)
return Private::getShortPath(u8_path);
#else
return u8_path;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ std::string StkTime::getLogTime()
time_t time_now = 0;
time(&time_now);
std::tm timeptr = {};
#ifdef WIN32
#if defined(WIN32) || defined(__MINGW32__)
localtime_s(&timeptr, &time_now);
#else
localtime_r(&time_now, &timeptr);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Translations::Translations() //: m_dictionary_manager("UTF-16")
// LC_ALL does not work, sscanf will then not always be able
// to scan for example: s=-1.1,-2.3,-3.3 correctly, which is
// used in driveline files.
#if defined(WIN32) && !defined(__CYGWIN__)
#if (defined(WIN32) || defined(__MINGW32__)) && !defined(__CYGWIN__)
// Windows does not have LC_MESSAGES
setlocale(LC_CTYPE, "");
#else
Expand Down
Loading