mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
feat(Core/Misc): replace all prefix preprocessor defines from CompilerDefs with AC_ (#2419)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()) }; \
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user