mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -17,25 +17,28 @@
|
||||
#endif // BX_CONFIG_ALLOCATOR_CRT
|
||||
|
||||
#ifndef BX_CONFIG_CRT_FILE_READER_WRITER
|
||||
# define BX_CONFIG_CRT_FILE_READER_WRITER !(BX_PLATFORM_NACL)
|
||||
# define BX_CONFIG_CRT_FILE_READER_WRITER !(0 \
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_CRT_NONE \
|
||||
)
|
||||
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
|
||||
|
||||
#ifndef BX_CONFIG_CRT_PROCESS
|
||||
# define BX_CONFIG_CRT_PROCESS !(0 \
|
||||
# define BX_CONFIG_CRT_PROCESS !(0 \
|
||||
|| BX_CRT_NONE \
|
||||
|| BX_PLATFORM_EMSCRIPTEN \
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_PS4 \
|
||||
|| BX_PLATFORM_WINRT \
|
||||
|| BX_PLATFORM_XBOXONE \
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_PS4 \
|
||||
|| BX_PLATFORM_WINRT \
|
||||
|| BX_PLATFORM_XBOXONE \
|
||||
)
|
||||
#endif // BX_CONFIG_CRT_PROCESS
|
||||
|
||||
#ifndef BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
# define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX || BX_PLATFORM_IOS)
|
||||
#endif // BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
|
||||
#ifndef BX_CONFIG_SUPPORTS_THREADING
|
||||
# define BX_CONFIG_SUPPORTS_THREADING !(BX_PLATFORM_EMSCRIPTEN)
|
||||
# define BX_CONFIG_SUPPORTS_THREADING !(0 \
|
||||
|| BX_PLATFORM_EMSCRIPTEN \
|
||||
|| BX_CRT_NONE \
|
||||
)
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_CONFIG_H_HEADER_GUARD
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "bx.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
namespace bx
|
||||
{
|
||||
///
|
||||
@@ -61,6 +59,4 @@ namespace bx
|
||||
|
||||
#include "inline/mutex.inl"
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_MUTEX_H_HEADER_GUARD
|
||||
|
||||
@@ -268,9 +268,24 @@
|
||||
|| BX_PLATFORM_RPI \
|
||||
)
|
||||
|
||||
#ifndef BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
|
||||
# define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
|
||||
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
|
||||
#define BX_PLATFORM_NONE !(0 \
|
||||
|| BX_PLATFORM_ANDROID \
|
||||
|| BX_PLATFORM_EMSCRIPTEN \
|
||||
|| BX_PLATFORM_BSD \
|
||||
|| BX_PLATFORM_HURD \
|
||||
|| BX_PLATFORM_IOS \
|
||||
|| BX_PLATFORM_LINUX \
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_OSX \
|
||||
|| BX_PLATFORM_PS4 \
|
||||
|| BX_PLATFORM_QNX \
|
||||
|| BX_PLATFORM_RPI \
|
||||
|| BX_PLATFORM_STEAMLINK \
|
||||
|| BX_PLATFORM_WINDOWS \
|
||||
|| BX_PLATFORM_WINRT \
|
||||
|| BX_PLATFORM_XBOX360 \
|
||||
|| BX_PLATFORM_XBOXONE \
|
||||
)
|
||||
|
||||
#if BX_COMPILER_GCC
|
||||
# define BX_COMPILER_NAME "GCC " \
|
||||
@@ -337,8 +352,10 @@
|
||||
# define BX_PLATFORM_NAME "Xbox 360"
|
||||
#elif BX_PLATFORM_XBOXONE
|
||||
# define BX_PLATFORM_NAME "Xbox One"
|
||||
#else
|
||||
#elif BX_PLATFORM_NONE
|
||||
# define BX_PLATFORM_NAME "None"
|
||||
#else
|
||||
# error "Unknown BX_PLATFORM!"
|
||||
#endif // BX_PLATFORM_
|
||||
|
||||
#if BX_CPU_ARM
|
||||
@@ -363,12 +380,16 @@
|
||||
# define BX_CRT_NAME "MSVC C Runtime"
|
||||
#elif BX_CRT_MINGW
|
||||
# define BX_CRT_NAME "MinGW C Runtime"
|
||||
#elif BX_CRT_LIBCXX
|
||||
# define BX_CRT_NAME "Clang C Library"
|
||||
#elif BX_CRT_NEWLIB
|
||||
# define BX_CRT_NAME "Newlib"
|
||||
#elif BX_CRT_MUSL
|
||||
# define BX_CRT_NAME "musl libc"
|
||||
#else
|
||||
#elif BX_CRT_NONE
|
||||
# define BX_CRT_NAME "None"
|
||||
#else
|
||||
# error "Unknown BX_CRT!"
|
||||
#endif // BX_CRT_
|
||||
|
||||
#if BX_ARCH_32BIT
|
||||
@@ -377,6 +398,10 @@
|
||||
# define BX_ARCH_NAME "64-bit"
|
||||
#endif // BX_ARCH_
|
||||
|
||||
#ifndef BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
|
||||
# define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
|
||||
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
|
||||
|
||||
#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
|
||||
# pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
|
||||
# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "bx.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
namespace bx
|
||||
{
|
||||
///
|
||||
@@ -39,6 +37,4 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_SEM_H_HEADER_GUARD
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "bx.h"
|
||||
#include "semaphore.h"
|
||||
|
||||
#if BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
namespace bx
|
||||
{
|
||||
///
|
||||
@@ -82,6 +80,4 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_CONFIG_SUPPORTS_THREADING
|
||||
|
||||
#endif // BX_THREAD_H_HEADER_GUARD
|
||||
|
||||
@@ -8,32 +8,39 @@ local naclToolchain = ""
|
||||
|
||||
local function crtNone()
|
||||
|
||||
if _OPTIONS["with-crtnone"] then
|
||||
defines { "BX_CRT_NONE" }
|
||||
defines {
|
||||
"BX_CRT_NONE=1",
|
||||
}
|
||||
|
||||
buildoptions {
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-Wa,--noexecstack",
|
||||
"-ffreestanding",
|
||||
}
|
||||
|
||||
linkoptions {
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-Wa,--noexecstack",
|
||||
"-ffreestanding",
|
||||
}
|
||||
|
||||
configuration { "linux-*" }
|
||||
|
||||
buildoptions {
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-Wa,--noexecstack",
|
||||
"-ffreestanding",
|
||||
|
||||
"-mpreferred-stack-boundary=4",
|
||||
"-mstackrealign",
|
||||
}
|
||||
|
||||
linkoptions {
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-Wa,--noexecstack",
|
||||
"-ffreestanding",
|
||||
|
||||
"-mpreferred-stack-boundary=4",
|
||||
"-mstackrealign",
|
||||
}
|
||||
end
|
||||
|
||||
configuration {}
|
||||
end
|
||||
|
||||
function toolchain(_buildDir, _libDir)
|
||||
@@ -546,6 +553,10 @@ function toolchain(_buildDir, _libDir)
|
||||
flags { "EnableAVX" }
|
||||
end
|
||||
|
||||
if _OPTIONS["with-crtnone"] then
|
||||
crtNone()
|
||||
end
|
||||
|
||||
flags {
|
||||
"NoPCH",
|
||||
"NativeWChar",
|
||||
@@ -741,9 +752,6 @@ function toolchain(_buildDir, _libDir)
|
||||
}
|
||||
buildoptions { "-m64" }
|
||||
|
||||
configuration { "linux-*" }
|
||||
crtNone()
|
||||
|
||||
configuration { "linux-clang" }
|
||||
|
||||
configuration { "linux-gcc-6" }
|
||||
|
||||
@@ -175,13 +175,13 @@ namespace bx
|
||||
|
||||
bool CommandLine::hasArg(const char _short, const char* _long) const
|
||||
{
|
||||
const char* arg = findOption(_short, _long, 0);
|
||||
const char* arg = findOption(_short, _long, int32_t(0) );
|
||||
return NULL != arg;
|
||||
}
|
||||
|
||||
bool CommandLine::hasArg(const char* _long) const
|
||||
{
|
||||
const char* arg = findOption('\0', _long, 0);
|
||||
const char* arg = findOption('\0', _long, int32_t(0) );
|
||||
return NULL != arg;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
#if BX_CRT_NONE
|
||||
|
||||
typedef int64_t off64_t;
|
||||
typedef int32_t pid_t;
|
||||
|
||||
extern "C" void* memcpy(void* _dst, const void* _src, size_t _numBytes)
|
||||
{
|
||||
bx::memCopy(_dst, _src, _numBytes);
|
||||
@@ -30,6 +27,11 @@ extern "C" void* memset(void* _dst, int _ch, size_t _numBytes)
|
||||
return _dst;
|
||||
}
|
||||
|
||||
#if !BX_PLATFORM_NONE
|
||||
|
||||
typedef int64_t off64_t;
|
||||
typedef int32_t pid_t;
|
||||
|
||||
extern "C" int32_t memcmp(const void* _lhs, const void* _rhs, size_t _numBytes)
|
||||
{
|
||||
return bx::memCmp(_lhs, _rhs, _numBytes);
|
||||
@@ -489,6 +491,8 @@ extern "C" void free(void* _ptr)
|
||||
BX_UNUSED(_ptr);
|
||||
}
|
||||
|
||||
#endif // BX_PLATFORM_*
|
||||
|
||||
extern "C" void abort()
|
||||
{
|
||||
while (true) {};
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <bx/uint32_t.h>
|
||||
#include <bx/string.h>
|
||||
|
||||
#if !BX_PLATFORM_NONE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -453,3 +455,5 @@ namespace bx
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // !BX_PLATFORM_NONE
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
# endif // BX_PLATFORM_XBOXONE
|
||||
#endif // BX_PLATFORM_
|
||||
|
||||
#ifndef BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
# define BX_CONFIG_SEMAPHORE_PTHREAD (0 \
|
||||
|| BX_PLATFORM_OSX \
|
||||
|| BX_PLATFORM_IOS \
|
||||
)
|
||||
#endif // BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
|
||||
namespace bx
|
||||
{
|
||||
struct SemaphoreInternal
|
||||
|
||||
@@ -31,10 +31,13 @@ namespace bx
|
||||
int64_t i64 = now.tv_sec*INT64_C(1000000000) + now.tv_nsec;
|
||||
#elif BX_PLATFORM_EMSCRIPTEN
|
||||
int64_t i64 = int64_t(1000.0f * emscripten_get_now() );
|
||||
#else
|
||||
#elif !BX_PLATFORM_NONE
|
||||
struct timeval now;
|
||||
gettimeofday(&now, 0);
|
||||
int64_t i64 = now.tv_sec*INT64_C(1000000) + now.tv_usec;
|
||||
#else
|
||||
BX_CHECK(false, "Not implemented!");
|
||||
int64_t i64 = UINT64_MAX;
|
||||
#endif // BX_PLATFORM_
|
||||
return i64;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user