diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-07 03:59:59 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-07 04:50:08 +0200 |
commit | bf12f270b3c74f694c789a57cc69f414753ca080 (patch) | |
tree | a80e6ee9863a46966fe43496f1ccbbfa07cc98aa | |
parent | Clean-up includes (diff) | |
download | yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar.gz yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar.bz2 yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar.lz yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar.xz yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.tar.zst yuzu-bf12f270b3c74f694c789a57cc69f414753ca080.zip |
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/citra/citra.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 2 | ||||
-rw-r--r-- | src/common/common.h | 43 | ||||
-rw-r--r-- | src/common/common_funcs.h | 10 | ||||
-rw-r--r-- | src/common/file_util.cpp | 4 | ||||
-rw-r--r-- | src/common/platform.h | 40 | ||||
-rw-r--r-- | src/common/profiler.cpp | 1 |
8 files changed, 17 insertions, 92 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 516aba554..b0fe285db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,11 @@ if (NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") else() - # Silence deprecation warnings - add_definitions(/D_CRT_SECURE_NO_WARNINGS) + # Silence "deprecation" warnings + add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE) + # Avoid windows.h junk + add_definitions(/DNOMINMAX) + # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 2c6ced920..634faf76b 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -19,7 +19,7 @@ #include "citra/emu_window/emu_window_glfw.h" /// Application entry point -int __cdecl main(int argc, char **argv) { +int main(int argc, char **argv) { std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); Log::Filter log_filter(Log::Level::Debug); Log::SetFilter(&log_filter); diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index dd0e4de8f..b78594fb6 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -349,7 +349,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) #undef main #endif -int __cdecl main(int argc, char* argv[]) +int main(int argc, char* argv[]) { std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger(); Log::Filter log_filter(Log::Level::Info); diff --git a/src/common/common.h b/src/common/common.h index a4a403fb9..00d1d14f9 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -11,8 +11,6 @@ #include <cstdio> #include <cstring> -#define STACKALIGN - #include "common/assert.h" #include "common/logging/log.h" #include "common/common_types.h" @@ -20,56 +18,25 @@ #include "common/common_paths.h" #include "common/platform.h" -#ifdef __APPLE__ -// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. -// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes. - #if defined __i386__ && defined __GNUC__ - #undef STACKALIGN - #define STACKALIGN __attribute__((__force_align_arg_pointer__)) - #endif -#elif defined _WIN32 -// Check MSC ver - #if defined _MSC_VER && _MSC_VER <= 1000 - #error needs at least version 1000 of MSC - #endif - - #ifndef NOMINMAX - #define NOMINMAX - #endif - -// Alignment +#ifdef _WIN32 + // Alignment #define MEMORY_ALIGNED16(x) __declspec(align(16)) x #define MEMORY_ALIGNED32(x) __declspec(align(32)) x #define MEMORY_ALIGNED64(x) __declspec(align(64)) x #define MEMORY_ALIGNED128(x) __declspec(align(128)) x - #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x - #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x -#endif - -// Windows compatibility -#ifndef _WIN32 +#else + // Windows compatibility #ifdef _LP64 #define _M_X64 1 #else #define _M_IX86 1 #endif + #define __forceinline inline __attribute__((always_inline)) #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x - #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x - #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x -#endif - -#ifdef _MSC_VER - #define __strdup _strdup - #define __getcwd _getcwd - #define __chdir _chdir -#else - #define __strdup strdup - #define __getcwd getcwd - #define __chdir chdir #endif #if defined _M_GENERIC diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index e76cb7d68..9e666d77e 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -73,16 +73,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){ } #else // _MSC_VER -#include <locale.h> + #include <locale.h> -// Function Cross-Compatibility - #define strcasecmp _stricmp - #define strncasecmp _strnicmp - #define unlink _unlink + // Function Cross-Compatibility #define snprintf _snprintf - #define vscprintf _vscprintf -// Locale Cross-Compatibility + // Locale Cross-Compatibility #define locale_t _locale_t #define freelocale _free_locale #define newlocale(mask, locale, base) _create_locale(mask, locale) diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 4ef4918d7..25d7d4b9f 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -589,7 +589,7 @@ std::string GetCurrentDir() { char *dir; // Get the current working directory (getcwd uses malloc) - if (!(dir = __getcwd(nullptr, 0))) { + if (!(dir = getcwd(nullptr, 0))) { LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", GetLastErrorMsg()); @@ -603,7 +603,7 @@ std::string GetCurrentDir() // Sets the current directory to the given directory bool SetCurrentDir(const std::string &directory) { - return __chdir(directory.c_str()) == 0; + return chdir(directory.c_str()) == 0; } #if defined(__APPLE__) diff --git a/src/common/platform.h b/src/common/platform.h index e27d6e31f..fc680d549 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -66,45 +66,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// // Compiler-Specific Definitions -#if EMU_PLATFORM == PLATFORM_WINDOWS - -#include <time.h> - -#ifndef NOMINMAX -#define NOMINMAX -#endif -#define EMU_FASTCALL __fastcall - -#ifdef _MSC_VER -inline struct tm* localtime_r(const time_t *clock, struct tm *result) { - if (localtime_s(result, clock) == 0) - return result; - return nullptr; -} -#endif - -#else // EMU_PLATFORM != PLATFORM_WINDOWS - -#define EMU_FASTCALL __attribute__((fastcall)) -#define __stdcall -#define __cdecl - -#define BOOL bool -#define DWORD u32 - -// TODO: Hacks.. -#include <limits.h> - -#include <strings.h> -#define stricmp(str1, str2) strcasecmp(str1, str2) -#define _stricmp(str1, str2) strcasecmp(str1, str2) -#define _snprintf snprintf -#define _getcwd getcwd -#define _tzset tzset - -typedef void EXCEPTION_POINTERS; - -#endif - #define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index 65c3df167..b8cde1785 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -7,7 +7,6 @@ #include "common/assert.h" #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. -#define NOMINMAX #define WIN32_LEAN_AND_MEAN #include <Windows.h> // For QueryPerformanceCounter/Frequency #endif |