فهرست منبع

Merge branch 'master' of github.com:bkaradzic/bx

bkaradzic 12 سال پیش
والد
کامیت
12deeaca89
5فایلهای تغییر یافته به همراه26 افزوده شده و 7 حذف شده
  1. 2 2
      3rdparty/UnitTest++/src/Posix/SignalTranslator.h
  2. 3 2
      include/bx/macros.h
  3. 5 2
      include/bx/os.h
  4. 10 0
      premake/bx.lua
  5. 6 1
      tests/macros.cpp

+ 2 - 2
3rdparty/UnitTest++/src/Posix/SignalTranslator.h

@@ -22,8 +22,8 @@ private:
     struct sigaction m_old_SIGTRAP_action;
     struct sigaction m_old_SIGSEGV_action;
     struct sigaction m_old_SIGBUS_action;
-    struct sigaction m_old_SIGABRT_action;
-    struct sigaction m_old_SIGALRM_action;
+//    struct sigaction m_old_SIGABRT_action;
+//    struct sigaction m_old_SIGALRM_action;
 };
 
 #if !defined (__GNUC__)

+ 3 - 2
include/bx/macros.h

@@ -50,7 +50,6 @@
 #	define BX_NO_VTABLE
 #	define BX_OVERRIDE
 #	define BX_PRINTF_ARGS(_format, _args) __attribute__ ( (format(__printf__, _format, _args) ) )
-#	define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__)
 #	if BX_COMPILER_CLANG || BX_PLATFORM_IOS
 #		define BX_THREAD /* not supported right now */
 #	else
@@ -67,12 +66,14 @@
 #	define BX_NO_VTABLE __declspec(novtable)
 #	define BX_OVERRIDE override
 #	define BX_PRINTF_ARGS(_format, _args)
-#	define BX_STATIC_ASSERT(_condition, ...) typedef char BX_CONCATENATE(BX_STATIC_ASSERT_, __LINE__)[1][(_condition)]
 #	define BX_THREAD __declspec(thread)
 #else
 #	error "Unknown BX_COMPILER_?"
 #endif
 
+// #define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__)
+#define BX_STATIC_ASSERT(_condition, ...) typedef char BX_CONCATENATE(BX_STATIC_ASSERT_, __LINE__)[1][(_condition)]
+
 #define BX_CACHE_LINE_ALIGN_MARKER() BX_ALIGN_STRUCT(BX_CACHE_LINE_SIZE, struct) {}
 #define BX_CACHE_LINE_ALIGN(_def) BX_CACHE_LINE_ALIGN_MARKER(); _def; BX_CACHE_LINE_ALIGN_MARKER()
 

+ 5 - 2
include/bx/os.h

@@ -12,19 +12,22 @@
 #	include <windows.h>
 #elif BX_PLATFORM_NACL || BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_IOS
 #	include <sched.h> // sched_yield
-#	if BX_PLATFORM_OSX || BX_PLATFORM_NACL
+#	if BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
 #		include <pthread.h> // mach_port_t
-#	endif // BX_PLATFORM_OSX || BX_PLATFORM_NACL
+#	endif // BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
+
 #	if BX_PLATFORM_NACL
 #		include <sys/nacl_syscalls.h> // nanosleep
 #	else
 #		include <time.h> // nanosleep
 #		include <dlfcn.h> // dlopen, dlclose, dlsym
 #	endif // BX_PLATFORM_NACL
+
 #	if BX_PLATFORM_LINUX
 #		include <unistd.h> // syscall
 #		include <sys/syscall.h>
 #	endif // BX_PLATFORM_LINUX
+
 #	if BX_PLATFORM_ANDROID
 #		include "debug.h" // getTid is not implemented...
 #	endif // BX_PLATFORM_ANDROID

+ 10 - 0
premake/bx.lua

@@ -7,6 +7,16 @@ project "bx"
 	uuid "4db0b09e-d6df-11e1-a0ec-65ccdd6a022f"
 	kind "StaticLib"
 
+	configuration { "osx or ios" }
+		-- OSX ar doesn't like creating archive without object files
+		-- here is object file...
+		prebuildcommands {
+			"@echo \"void dummy() {}\" > /tmp/dummy.cpp",
+		}
+		files {
+			"/tmp/dummy.cpp",
+		}
+
 	files {
 		"../include/**.h",
 	}

+ 6 - 1
tests/macros.cpp

@@ -28,6 +28,11 @@ BX_STATIC_ASSERT(256 == BX_ALIGN_256(256) );
 BX_STATIC_ASSERT(256 == BX_ALIGN_256(256) );
 BX_STATIC_ASSERT(512 == BX_ALIGN_256(511) );
 
+BX_NO_INLINE void unusedFunction()
+{
+	CHECK(false);
+}
+
 TEST(macros)
 {
 	uint32_t unused0;
@@ -37,7 +42,7 @@ TEST(macros)
 	BX_UNUSED(unused0, unused1);
 
 	uint32_t unused2;
-	BX_UNUSED(unused0, unused1, unused2);
+	BX_UNUSED(unused0, unused1, unused2, unusedFunction() );
 
 	CHECK_EQUAL(1, BX_VA_ARGS_COUNT(1) );
 	CHECK_EQUAL(2, BX_VA_ARGS_COUNT(1, 2) );