diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-05-23 18:34:02 +0200 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2017-05-23 18:46:44 +0200 |
commit | 9ec2a82cac993648ed603711f84b6b743ca1e106 (patch) | |
tree | 350b58c26e075f52d778adb757f2f539f23b95cb | |
parent | 04dfd78dac85f18b3a6d389f2b9f65ab0a534dff (diff) |
Core/Misc: Prefix all preprocessor defines from CompilerDefs with TRINITY_ to avoid conflicts (PLATFORM_WINDOWS is used/defined by CascLib)
(cherry picked from commit b8db320bf14e327bcd12279871b914d8635ef122)
-rw-r--r-- | src/common/Common.h | 8 | ||||
-rw-r--r-- | src/common/CompilerDefs.h | 34 | ||||
-rw-r--r-- | src/common/Debugging/Errors.h | 2 | ||||
-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 | 18 | ||||
-rw-r--r-- | src/common/GitRevision.cpp | 8 | ||||
-rw-r--r-- | src/common/Logging/AppenderConsole.cpp | 6 | ||||
-rw-r--r-- | src/common/Logging/AppenderFile.cpp | 2 | ||||
-rw-r--r-- | src/common/Logging/Log.h | 2 | ||||
-rw-r--r-- | src/common/Metric/Metric.h | 2 | ||||
-rw-r--r-- | src/common/Threading/ProcessPriority.h | 8 | ||||
-rw-r--r-- | src/common/Utilities/Util.cpp | 8 | ||||
-rw-r--r-- | src/server/authserver/Main.cpp | 12 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 2 | ||||
-rw-r--r-- | src/server/worldserver/CommandLine/CliRunnable.cpp | 14 | ||||
-rw-r--r-- | src/server/worldserver/Main.cpp | 2 |
17 files changed, 65 insertions, 67 deletions
diff --git a/src/common/Common.h b/src/common/Common.h index 5e3550fdeae..1097249bcab 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -53,14 +53,14 @@ #include "Threading/LockedQueue.h" -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS # include <ws2tcpip.h> -# if defined(__INTEL_COMPILER) +# if TRINITY_COMPILER == TRINITY_COMPILER_INTEL # if !defined(BOOST_ASIO_HAS_MOVE) # define BOOST_ASIO_HAS_MOVE # endif // !defined(BOOST_ASIO_HAS_MOVE) -# endif // if defined(__INTEL_COMPILER) +# endif // if TRINITY_COMPILER == TRINITY_COMPILER_INTEL #else # include <sys/types.h> @@ -71,7 +71,7 @@ # include <netdb.h> #endif -#if COMPILER == COMPILER_MICROSOFT +#if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT #include <float.h> diff --git a/src/common/CompilerDefs.h b/src/common/CompilerDefs.h index 10db0589539..0509dcf9177 100644 --- a/src/common/CompilerDefs.h +++ b/src/common/CompilerDefs.h @@ -19,37 +19,37 @@ #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 TRINITY_PLATFORM_WINDOWS 0 +#define TRINITY_PLATFORM_UNIX 1 +#define TRINITY_PLATFORM_APPLE 2 +#define TRINITY_PLATFORM_INTEL 3 // must be first (win 64 also define _WIN32) #if defined( _WIN64 ) -# define PLATFORM PLATFORM_WINDOWS +# define TRINITY_PLATFORM TRINITY_PLATFORM_WINDOWS #elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 ) -# define PLATFORM PLATFORM_WINDOWS +# define TRINITY_PLATFORM TRINITY_PLATFORM_WINDOWS #elif defined( __APPLE_CC__ ) -# define PLATFORM PLATFORM_APPLE +# define TRINITY_PLATFORM TRINITY_PLATFORM_APPLE #elif defined( __INTEL_COMPILER ) -# define PLATFORM PLATFORM_INTEL +# define TRINITY_PLATFORM TRINITY_PLATFORM_INTEL #else -# define PLATFORM PLATFORM_UNIX +# define TRINITY_PLATFORM TRINITY_PLATFORM_UNIX #endif -#define COMPILER_MICROSOFT 0 -#define COMPILER_GNU 1 -#define COMPILER_BORLAND 2 -#define COMPILER_INTEL 3 +#define TRINITY_COMPILER_MICROSOFT 0 +#define TRINITY_COMPILER_GNU 1 +#define TRINITY_COMPILER_BORLAND 2 +#define TRINITY_COMPILER_INTEL 3 #ifdef _MSC_VER -# define COMPILER COMPILER_MICROSOFT +# define TRINITY_COMPILER TRINITY_COMPILER_MICROSOFT #elif defined( __BORLANDC__ ) -# define COMPILER COMPILER_BORLAND +# define TRINITY_COMPILER TRINITY_COMPILER_BORLAND #elif defined( __INTEL_COMPILER ) -# define COMPILER COMPILER_INTEL +# define TRINITY_COMPILER TRINITY_COMPILER_INTEL #elif defined( __GNUC__ ) -# define COMPILER COMPILER_GNU +# define TRINITY_COMPILER TRINITY_COMPILER_GNU # define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #else # error "FATAL ERROR: Unknown compiler." diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index bf06d77d303..c21972af906 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -38,7 +38,7 @@ namespace Trinity } // namespace Trinity -#if COMPILER == COMPILER_MICROSOFT +#if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT #define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127)) #define ASSERT_END __pragma(warning(pop)) #else diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp index 09a027d167b..5585dd25c13 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 TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS && !defined(__MINGW32__) #define WIN32_LEAN_AND_MEAN #pragma warning(disable:4996) #pragma warning(disable:4312) diff --git a/src/common/Debugging/WheatyExceptionReport.h b/src/common/Debugging/WheatyExceptionReport.h index aec52b165f1..91c2ae93179 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 TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS && !defined(__MINGW32__) #include <winnt.h> #include <winternl.h> diff --git a/src/common/Define.h b/src/common/Define.h index 6e3499a46c9..e34ee8bfa18 100644 --- a/src/common/Define.h +++ b/src/common/Define.h @@ -21,7 +21,7 @@ #include "CompilerDefs.h" -#if COMPILER == COMPILER_GNU +#if TRINITY_COMPILER == TRINITY_COMPILER_GNU # if !defined(__STDC_FORMAT_MACROS) # define __STDC_FORMAT_MACROS # endif @@ -55,7 +55,7 @@ # endif #endif -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS # define TRINITY_PATH_MAX MAX_PATH # define _USE_MATH_DEFINES # ifndef DECLSPEC_NORETURN @@ -64,11 +64,11 @@ # ifndef DECLSPEC_DEPRECATED # define DECLSPEC_DEPRECATED __declspec(deprecated) # endif //DECLSPEC_DEPRECATED -#else //PLATFORM != PLATFORM_WINDOWS +#else // TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS # define TRINITY_PATH_MAX PATH_MAX # define DECLSPEC_NORETURN # define DECLSPEC_DEPRECATED -#endif //PLATFORM +#endif // TRINITY_PLATFORM #if !defined(COREDEBUG) # define TRINITY_INLINE inline @@ -79,21 +79,21 @@ # define TRINITY_INLINE #endif //!COREDEBUG -#if COMPILER == COMPILER_GNU +#if TRINITY_COMPILER == TRINITY_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 //TRINITY_COMPILER != TRINITY_COMPILER_GNU # define ATTR_NORETURN # define ATTR_PRINTF(F, V) # define ATTR_DEPRECATED -#endif //COMPILER == COMPILER_GNU +#endif //TRINITY_COMPILER == TRINITY_COMPILER_GNU #ifdef TRINITY_API_USE_DYNAMIC_LINKING -# if COMPILER == COMPILER_MICROSOFT +# if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT # define TC_API_EXPORT __declspec(dllexport) # define TC_API_IMPORT __declspec(dllimport) -# elif COMPILER == COMPILER_GNU +# elif TRINITY_COMPILER == TRINITY_COMPILER_GNU # define TC_API_EXPORT __attribute__((visibility("default"))) # define TC_API_IMPORT # else diff --git a/src/common/GitRevision.cpp b/src/common/GitRevision.cpp index 702cd01d84b..3e578cf1ee8 100644 --- a/src/common/GitRevision.cpp +++ b/src/common/GitRevision.cpp @@ -41,17 +41,17 @@ char const* GitRevision::GetFullDatabase() return _FULL_DATABASE; } -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS # ifdef _WIN64 # define TRINITY_PLATFORM_STR "Win64" # else # define TRINITY_PLATFORM_STR "Win32" # endif -#elif PLATFORM == PLATFORM_APPLE +#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE # define TRINITY_PLATFORM_STR "MacOSX" -#elif PLATFORM == PLATFORM_INTEL +#elif TRINITY_PLATFORM == TRINITY_PLATFORM_INTEL # define TRINITY_PLATFORM_STR "Intel" -#else // PLATFORM_UNIX +#else // TRINITY_PLATFORM_UNIX # define TRINITY_PLATFORM_STR "Unix" #endif diff --git a/src/common/Logging/AppenderConsole.cpp b/src/common/Logging/AppenderConsole.cpp index e61cfdf30fa..3378c185cc5 100644 --- a/src/common/Logging/AppenderConsole.cpp +++ b/src/common/Logging/AppenderConsole.cpp @@ -21,7 +21,7 @@ #include "Config.h" #include "Util.h" -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include <Windows.h> #endif @@ -66,7 +66,7 @@ void AppenderConsole::InitColors(std::string const& str) void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS static WORD WinColorFG[MaxColors] = { 0, // BLACK @@ -153,7 +153,7 @@ void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) void AppenderConsole::ResetColor(bool stdout_stream) { - #if PLATFORM == PLATFORM_WINDOWS + #if TRINITY_PLATFORM == TRINITY_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/Logging/AppenderFile.cpp b/src/common/Logging/AppenderFile.cpp index 8d9ea36bd52..6c68406667d 100644 --- a/src/common/Logging/AppenderFile.cpp +++ b/src/common/Logging/AppenderFile.cpp @@ -20,7 +20,7 @@ #include "StringFormat.h" #include "Log.h" -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS # include <Windows.h> #endif diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 189971561fc..fa67a8ea648 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -166,7 +166,7 @@ inline bool Log::ShouldLog(std::string const& type, LogLevel level) const } \ } -#if PLATFORM != PLATFORM_WINDOWS +#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS void check_args(const char*, ...) ATTR_PRINTF(1, 2); void check_args(std::string const&, ...); diff --git a/src/common/Metric/Metric.h b/src/common/Metric/Metric.h index df8ab6f2a7b..a5d8e5f589a 100644 --- a/src/common/Metric/Metric.h +++ b/src/common/Metric/Metric.h @@ -116,7 +116,7 @@ public: #define sMetric Metric::instance() -#if PLATFORM != PLATFORM_WINDOWS +#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS #define TC_METRIC_EVENT(category, title, description) \ do { \ if (sMetric->IsEnabled()) \ diff --git a/src/common/Threading/ProcessPriority.h b/src/common/Threading/ProcessPriority.h index 65332c6dff3..b4ff3f5ecf6 100644 --- a/src/common/Threading/ProcessPriority.h +++ b/src/common/Threading/ProcessPriority.h @@ -28,11 +28,6 @@ void SetProcessPriority(const std::string& logChannel) { -// Suppresses Mac OS X Warning since logChannel isn't used. -#if PLATFORM_APPLE - (void)logChannel; -#endif - #if defined(_WIN32) || defined(__linux__) ///- Handle affinity for multiple processors and process priority @@ -99,6 +94,9 @@ void SetProcessPriority(const std::string& logChannel) } #endif +#else + // Suppresses unused argument warning for all other platforms + (void)logChannel; #endif } diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 7d482e9486a..58b02addc37 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -24,7 +24,7 @@ #include <stdarg.h> #include <boost/algorithm/string/case_conv.hpp> -#if COMPILER == COMPILER_GNU +#if TRINITY_COMPILER == TRINITY_COMPILER_GNU #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -421,7 +421,7 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension) bool utf8ToConsole(const std::string& utf8str, std::string& conStr) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS std::wstring wstr; if (!Utf8toWStr(utf8str, wstr)) return false; @@ -438,7 +438,7 @@ bool utf8ToConsole(const std::string& utf8str, std::string& conStr) bool consoleToUtf8(const std::string& conStr, std::string& utf8str) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS std::wstring wstr; wstr.resize(conStr.size()); OemToCharBuffW(&conStr[0], &wstr[0], uint32(conStr.size())); @@ -477,7 +477,7 @@ void utf8printf(FILE* out, const char *str, ...) void vutf8printf(FILE* out, const char *str, va_list* ap) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS char temp_buf[32 * 1024]; wchar_t wtemp_buf[32 * 1024]; diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index a911275ef2a..1669e0958b7 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -49,7 +49,7 @@ namespace fs = boost::filesystem; # define _TRINITY_REALM_CONFIG "authserver.conf" #endif -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include "ServiceWin32.h" char serviceName[] = "authserver"; char serviceLongName[] = "TrinityCore auth service"; @@ -90,7 +90,7 @@ int main(int argc, char** argv) if (vm.count("help") || vm.count("version")) return 0; -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS if (configService.compare("install") == 0) return WinServiceInstall() == true ? 0 : 1; else if (configService.compare("uninstall") == 0) @@ -163,7 +163,7 @@ int main(int argc, char** argv) // Set signal handlers boost::asio::signal_set signals(*_ioService, SIGINT, SIGTERM); -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS signals.add(SIGBREAK); #endif signals.async_wait(SignalHandler); @@ -182,7 +182,7 @@ int main(int argc, char** argv) _banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(_banExpiryCheckInterval)); _banExpiryCheckTimer->async_wait(BanExpiryHandler); -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS if (m_ServiceStatus != -1) { _serviceStatusWatchTimer = new boost::asio::deadline_timer(*_ioService); @@ -271,7 +271,7 @@ void BanExpiryHandler(boost::system::error_code const& error) } } -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS void ServiceStatusWatcher(boost::system::error_code const& error) { if (!error) @@ -299,7 +299,7 @@ variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, s ("config,c", value<fs::path>(&configFile)->default_value(fs::absolute(_TRINITY_REALM_CONFIG)), "use <arg> as configuration file") ; -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS options_description win("Windows platform specific options"); win.add_options() ("service,s", value<std::string>(&configService)->default_value(""), "Windows service options: [install | uninstall]") diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 470f2f7f382..fddb3312010 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1185,7 +1185,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 TRINITY_PLATFORM == TRINITY_PLATFORM_UNIX || TRINITY_PLATFORM == TRINITY_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 633cde6a9ad..d5e03edbd04 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -29,7 +29,7 @@ #include "Log.h" #include "Util.h" -#if PLATFORM != PLATFORM_WINDOWS +#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS #include <readline/readline.h> #include <readline/history.h> #include "Chat.h" @@ -86,7 +86,7 @@ int cli_hook_func() void utf8print(void* /*arg*/, const char* str) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS wchar_t wtemp_buf[6000]; size_t wtemp_len = 6000-1; if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len)) @@ -129,7 +129,7 @@ void CliThread() { ///- Display the list of available CLI functions then beep //TC_LOG_INFO("server.worldserver", ""); -#if PLATFORM != PLATFORM_WINDOWS +#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; #endif @@ -148,7 +148,7 @@ void CliThread() char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin); -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS char commandbuf[256]; command_str = fgets(commandbuf, sizeof(commandbuf), stdin); #else @@ -167,7 +167,7 @@ void CliThread() if (!*command_str) { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS printf("TC>"); #else free(command_str); @@ -178,7 +178,7 @@ void CliThread() std::string command; if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8 { -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS printf("TC>"); #else free(command_str); @@ -188,7 +188,7 @@ void CliThread() fflush(stdout); sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); -#if PLATFORM != PLATFORM_WINDOWS +#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS add_history(command.c_str()); free(command_str); #endif diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 6a722219509..76200a8e7ae 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -167,7 +167,7 @@ extern int main(int argc, char** argv) // Set signal handlers (this must be done before starting io_service threads, because otherwise they would unblock and exit) boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM); -#if PLATFORM == PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS signals.add(SIGBREAK); #endif signals.async_wait(SignalHandler); |