diff options
author | Kargatum <dowlandtop@yandex.com> | 2019-11-15 23:27:31 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-15 23:27:31 +0700 |
commit | a3206c56dc7b2e7421d2dfaee56bad0a195d6c58 (patch) | |
tree | 82d54f7979f060f15d3984b250f30a14952af9b7 /src | |
parent | f9a8de9be7678acb6b55d8fc573ba960d11c569c (diff) |
feat(Core/Misc): replace all prefix preprocessor defines from CompilerDefs with AC_ (#2419)
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Common.h | 6 | ||||
-rw-r--r-- | src/common/CompilerDefs.h | 36 | ||||
-rw-r--r-- | src/common/Debugging/Errors.cpp | 2 | ||||
-rw-r--r-- | src/common/Debugging/Errors.h | 4 | ||||
-rw-r--r-- | src/common/Debugging/WheatyExceptionReport.cpp | 2 | ||||
-rw-r--r-- | src/common/Debugging/WheatyExceptionReport.h | 2 | ||||
-rw-r--r-- | src/common/Define.h | 15 | ||||
-rw-r--r-- | src/common/GitRevision.cpp | 4 | ||||
-rw-r--r-- | src/common/Logging/Log.cpp | 4 | ||||
-rw-r--r-- | src/common/Utilities/Util.cpp | 6 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 4 | ||||
-rw-r--r-- | src/server/worldserver/CommandLine/CliRunnable.cpp | 14 |
12 files changed, 48 insertions, 51 deletions
diff --git a/src/common/Common.h b/src/common/Common.h index ad353ac235..3e1f698ef5 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -60,7 +60,7 @@ #include <signal.h> #include <assert.h> -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS #define STRCASECMP stricmp #else #define STRCASECMP strcasecmp @@ -86,7 +86,7 @@ #include <ace/OS_NS_time.h> #include <ace/Stack_Trace.h> -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS # include <ace/config-all.h> // XP winver - needed to compile with standard leak check in MemoryLeaks.h // uncomment later if needed @@ -102,7 +102,7 @@ # include <netdb.h> #endif -#if COMPILER == COMPILER_MICROSOFT +#if AC_COMPILER == AC_COMPILER_MICROSOFT #include <float.h> diff --git a/src/common/CompilerDefs.h b/src/common/CompilerDefs.h index e79f65dde9..772a39e4eb 100644 --- a/src/common/CompilerDefs.h +++ b/src/common/CompilerDefs.h @@ -7,38 +7,38 @@ #ifndef TRINITY_COMPILERDEFS_H #define TRINITY_COMPILERDEFS_H -#define PLATFORM_WINDOWS 0 -#define PLATFORM_UNIX 1 -#define PLATFORM_APPLE 2 -#define PLATFORM_INTEL 3 +#define AC_PLATFORM_WINDOWS 0 +#define AC_PLATFORM_UNIX 1 +#define AC_PLATFORM_APPLE 2 +#define AC_PLATFORM_INTEL 3 // must be first (win 64 also define _WIN32) #if defined( _WIN64 ) -# define PLATFORM PLATFORM_WINDOWS +#define AC_PLATFORM AC_PLATFORM_WINDOWS #elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 ) -# define PLATFORM PLATFORM_WINDOWS +#define AC_PLATFORM AC_PLATFORM_WINDOWS #elif defined( __APPLE_CC__ ) -# define PLATFORM PLATFORM_APPLE +#define AC_PLATFORM AC_PLATFORM_APPLE #elif defined( __INTEL_COMPILER ) -# define PLATFORM PLATFORM_INTEL +#define AC_PLATFORM AC_PLATFORM_INTEL #else -# define PLATFORM PLATFORM_UNIX +#define AC_PLATFORM AC_PLATFORM_UNIX #endif -#define COMPILER_MICROSOFT 0 -#define COMPILER_GNU 1 -#define COMPILER_BORLAND 2 -#define COMPILER_INTEL 3 +#define AC_COMPILER_MICROSOFT 0 +#define AC_COMPILER_GNU 1 +#define AC_COMPILER_BORLAND 2 +#define AC_COMPILER_INTEL 3 #ifdef _MSC_VER -# define COMPILER COMPILER_MICROSOFT +#define AC_COMPILER AC_COMPILER_MICROSOFT #elif defined( __BORLANDC__ ) -# define COMPILER COMPILER_BORLAND +#define AC_COMPILER AC_COMPILER_BORLAND #elif defined( __INTEL_COMPILER ) -# define COMPILER COMPILER_INTEL +#define AC_COMPILER AC_COMPILER_INTEL #elif defined( __GNUC__ ) -# define COMPILER COMPILER_GNU -# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#define AC_COMPILER AC_COMPILER_GNU +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #else # error "FATAL ERROR: Unknown compiler." #endif diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 4c97ceb675..c7e78b8385 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -22,7 +22,7 @@ terminates the application. */ -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS #include <Windows.h> #define Crash(message) \ ULONG_PTR execeptionArgs[] = { reinterpret_cast<ULONG_PTR>(strdup(message)), reinterpret_cast<ULONG_PTR>(_ReturnAddress()) }; \ diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index 00ca02c1ee..1edfdcb759 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -29,7 +29,7 @@ namespace Trinity std::string GetDebugInfo(); -#if COMPILER == COMPILER_MICROSOFT +#if AC_COMPILER == AC_COMPILER_MICROSOFT #define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127)) #define ASSERT_END __pragma(warning(pop)) #else @@ -37,7 +37,7 @@ std::string GetDebugInfo(); #define ASSERT_END #endif -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS #define EXCEPTION_ASSERTION_FAILURE 0xC0000420L #endif diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp index db4bae02f2..0f49eb87c9 100644 --- a/src/common/Debugging/WheatyExceptionReport.cpp +++ b/src/common/Debugging/WheatyExceptionReport.cpp @@ -5,7 +5,7 @@ //========================================== #include "CompilerDefs.h" -#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__) +#if AC_PLATFORM == AC_PLATFORM_WINDOWS && !defined(__MINGW32__) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif diff --git a/src/common/Debugging/WheatyExceptionReport.h b/src/common/Debugging/WheatyExceptionReport.h index a8fc2970d7..18f1e43b4d 100644 --- a/src/common/Debugging/WheatyExceptionReport.h +++ b/src/common/Debugging/WheatyExceptionReport.h @@ -1,7 +1,7 @@ #ifndef _WHEATYEXCEPTIONREPORT_ #define _WHEATYEXCEPTIONREPORT_ -#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__) +#if AC_PLATFORM == AC_PLATFORM_WINDOWS && !defined(__MINGW32__) #include <winnt.h> #include <winternl.h> diff --git a/src/common/Define.h b/src/common/Define.h index d7a0574750..d7d1fcfff0 100644 --- a/src/common/Define.h +++ b/src/common/Define.h @@ -13,11 +13,8 @@ #include <ace/Basic_Types.h> #include <ace/ACE_export.h> #include <ace/Default_Constants.h> - #include "CompilerDefs.h" - - #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) #define OS_WIN #endif @@ -33,7 +30,7 @@ # endif //ACE_BYTE_ORDER #endif //TRINITY_ENDIAN -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS # define TRINITY_PATH_MAX MAX_PATH # ifndef DECLSPEC_NORETURN # define DECLSPEC_NORETURN __declspec(noreturn) @@ -41,11 +38,11 @@ # ifndef DECLSPEC_DEPRECATED # define DECLSPEC_DEPRECATED __declspec(deprecated) # endif //DECLSPEC_DEPRECATED -#else //PLATFORM != PLATFORM_WINDOWS +#else //AC_PLATFORM != AC_PLATFORM_WINDOWS # define TRINITY_PATH_MAX PATH_MAX # define DECLSPEC_NORETURN # define DECLSPEC_DEPRECATED -#endif //PLATFORM +#endif //AC_PLATFORM #if !defined(COREDEBUG) # define TRINITY_INLINE inline @@ -56,15 +53,15 @@ # define TRINITY_INLINE #endif //!COREDEBUG -#if COMPILER == COMPILER_GNU +#if AC_COMPILER == AC_COMPILER_GNU # define ATTR_NORETURN __attribute__((noreturn)) # define ATTR_PRINTF(F, V) __attribute__ ((format (printf, F, V))) # define ATTR_DEPRECATED __attribute__((deprecated)) -#else //COMPILER != COMPILER_GNU +#else //AC_COMPILER != AC_COMPILER_GNU # define ATTR_NORETURN # define ATTR_PRINTF(F, V) # define ATTR_DEPRECATED -#endif //COMPILER == COMPILER_GNU +#endif //AC_COMPILER == AC_COMPILER_GNU #define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER #define UI64LIT(N) ACE_UINT64_LITERAL(N) diff --git a/src/common/GitRevision.cpp b/src/common/GitRevision.cpp index 3bec363409..1a8df7cd85 100644 --- a/src/common/GitRevision.cpp +++ b/src/common/GitRevision.cpp @@ -21,13 +21,13 @@ char const* GitRevision::GetBranch() return _BRANCH; } -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS # ifdef _WIN64 # define AZEROTH_PLATFORM_STR "Win64" # else # define AZEROTH_PLATFORM_STR "Win32" # endif -#else // PLATFORM +#else // AC_PLATFORM # define AZEROTH_PLATFORM_STR "Unix" #endif diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 148e818991..7f58477106 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -248,7 +248,7 @@ void Log::InitColors(const std::string& str) void Log::SetColor(bool stdout_stream, ColorTypes color) { - #if PLATFORM == PLATFORM_WINDOWS + #if AC_PLATFORM == AC_PLATFORM_WINDOWS static WORD WinColorFG[Colors] = { 0, // BLACK @@ -322,7 +322,7 @@ void Log::SetColor(bool stdout_stream, ColorTypes color) void Log::ResetColor(bool stdout_stream) { - #if PLATFORM == PLATFORM_WINDOWS + #if AC_PLATFORM == AC_PLATFORM_WINDOWS HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED ); #else diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 8fed7c8cf9..c960384fd1 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -447,7 +447,7 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) bool utf8ToConsole(const std::string& utf8str, std::string& conStr) { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS std::wstring wstr; if (!Utf8toWStr(utf8str, wstr)) return false; @@ -464,7 +464,7 @@ bool utf8ToConsole(const std::string& utf8str, std::string& conStr) bool consoleToUtf8(const std::string& conStr, std::string& utf8str) { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS std::wstring wstr; wstr.resize(conStr.size()); OemToCharBuffW(&conStr[0], &wstr[0], conStr.size()); @@ -503,7 +503,7 @@ void utf8printf(FILE* out, const char *str, ...) void vutf8printf(FILE* out, const char *str, va_list* ap) { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS char temp_buf[32*1024]; wchar_t wtemp_buf[32*1024]; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 55d1a3e64d..d6ccdd7af3 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -417,7 +417,7 @@ void World::LoadModuleConfigSettings() std::string conf_path = _CONF_DIR; std::string cfg_file = conf_path + "/" + configFile; -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS cfg_file = configFile; #endif std::string cfg_def_file = cfg_file + ".dist"; @@ -1197,7 +1197,7 @@ void World::LoadConfigSettings(bool reload) if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\')) dataPath.push_back('/'); -#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE +#if AC_PLATFORM == AC_PLATFORM_UNIX || AC_PLATFORM == AC_PLATFORM_APPLE if (dataPath[0] == '~') { const char* home = getenv("HOME"); diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index fa18491b72..c7d51959ed 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -23,7 +23,7 @@ #include "Player.h" #include "Util.h" -#if PLATFORM != PLATFORM_WINDOWS +#if AC_PLATFORM != AC_PLATFORM_WINDOWS #include <readline/readline.h> #include <readline/history.h> @@ -79,7 +79,7 @@ int cli_hook_func() void utf8print(void* /*arg*/, const char* str) { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS wchar_t wtemp_buf[6000]; size_t wtemp_len = 6000-1; if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len)) @@ -122,7 +122,7 @@ void CliRunnable::run() { ///- Display the list of available CLI functions then beep //TC_LOG_INFO("server.worldserver", ""); -#if PLATFORM != PLATFORM_WINDOWS +#if AC_PLATFORM != AC_PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; #endif @@ -141,7 +141,7 @@ void CliRunnable::run() char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin); -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS char commandbuf[256]; command_str = fgets(commandbuf, sizeof(commandbuf), stdin); #else @@ -160,7 +160,7 @@ void CliRunnable::run() if (!*command_str) { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS printf("AC>"); #else free(command_str); @@ -171,7 +171,7 @@ void CliRunnable::run() std::string command; if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8 { -#if PLATFORM == PLATFORM_WINDOWS +#if AC_PLATFORM == AC_PLATFORM_WINDOWS printf("AC>"); #else free(command_str); @@ -181,7 +181,7 @@ void CliRunnable::run() fflush(stdout); sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); -#if PLATFORM != PLATFORM_WINDOWS +#if AC_PLATFORM != AC_PLATFORM_WINDOWS add_history(command.c_str()); free(command_str); #endif |