refactor(*): change namespace relationships and fix name errors

This commit is contained in:
_Redstone_c_ 2021-12-03 22:55:37 +08:00
parent 6c49240000
commit 4605c0a682
2 changed files with 17 additions and 49 deletions

View File

@ -33,11 +33,11 @@
// Define the unnamed namespace
#define NAMESPACE_UNNAMED_BEGIN namespace {
#define NAMESPACE_UNNAMED_END }
// Create an alias for the namespace - like typedef
#define NAMESPACE_DEFINE(Source, Target) NAMESPACE_BEGIN(Target) NAMESPACE_USING(Source) NAMESPACE_END(Target)
#define NAMESPACE_INLINE_UNNAMED_BEGIN inline namespace {
#define NAMESPACE_INLINE_UNNAMED_END }
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
enum { INDEX_NONE = -1 };
@ -46,4 +46,5 @@ enum { UNICODE_BOM = 0xfeff };
enum EForceInit { ForceInit };
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -6,6 +6,7 @@
#include <cstdlib>
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
// Build information macro.
@ -66,18 +67,18 @@ NAMESPACE_MODULE_BEGIN(Utility)
#if PLATFORM_WINDOWS
# define VARARGS __cdecl
# define CDECL __cdecl
# define NAMESPACE_STDCALL __NAMESPACE_STDcall
# define FORCEINLINE __forceinline
# define FORCENOINLINE __declspec(noinline)
# define VARARGS __cdecl
# define CDECL __cdecl
# define STDCALL __stdcall
# define FORCEINLINE __forceinline
# define FORCENOINLINE __declspec(noinline)
# define RESTRICT __restrict
#elif PLATFORM_LINUX
# define VARARGS
# define CDECL
# define NAMESPACE_STDCALL
# define STDCALL
# define FORCENOINLINE __attribute__((noinline))
# define RESTRICT __restrict
@ -91,59 +92,24 @@ NAMESPACE_MODULE_BEGIN(Utility)
# define VARARGS
# define CDECL
# define NAMESPACE_STDCALL
# define STDCALL
# define FORCEINLINE
# define FORCENOINLINE
# define RESTRICT __restrict
#endif
// Alignment.
#if PLATFORM_WINDOWS
# if defined(__clang__)
# define GCC_PACK(n) __attribute__((packed,aligned(n)))
# define GCC_ALIGN(n) __attribute__((aligned(n)))
# if defined(_MSC_VER)
# define MS_ALIGN(n) __declspec(align(n))
# endif
# else
# define GCC_PACK(n)
# define GCC_ALIGN(n)
# define MS_ALIGN(n) __declspec(align(n))
# endif
#elif PLATFORM_LINUX
# define GCC_PACK(n) __attribute__((packed,aligned(n)))
# define GCC_ALIGN(n) __attribute__((aligned(n)))
# define MS_ALIGN(n)
#else
# define GCC_PACK(n)
# define GCC_ALIGN(n)
# define MS_ALIGN(n)
#endif
// DLL export and import definitions.
#if PLATFORM_WINDOWS
# define DLLEXPORT __declspec(dllexport)
# define DLLIMPORT __declspec(dllimport)
# define DLLEXPORT __declspec(dllexport)
# define DLLIMPORT __declspec(dllimport)
#elif PLATFORM_LINUX
# define DLLEXPORT __attribute__((visibility("default")))
# define DLLIMPORT __attribute__((visibility("default")))
# define DLLEXPORT __attribute__((visibility("default")))
# define DLLIMPORT __attribute__((visibility("default")))
#else
@ -200,4 +166,5 @@ typedef NAMESPACE_STD::nullptr_t nullptr_t;
#define TEXT(x) TEXT_PASTE(x)
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END