Cleaning up asserts and file/line macros.

This commit is contained in:
Ben Vanik
2014-07-12 16:51:52 -07:00
parent 840357413c
commit bf882714d0
92 changed files with 636 additions and 613 deletions

View File

@@ -26,13 +26,13 @@ XEvent::~XEvent() {
}
void XEvent::Initialize(bool manual_reset, bool initial_state) {
XEASSERTNULL(handle_);
assert_null(handle_);
handle_ = CreateEvent(NULL, manual_reset, initial_state, NULL);
}
void XEvent::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) {
XEASSERTNULL(handle_);
assert_null(handle_);
bool manual_reset;
switch (header.type_flags >> 24) {
@@ -43,7 +43,7 @@ void XEvent::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) {
manual_reset = false;
break;
default:
XEASSERTALWAYS();
assert_always();
return;
}

View File

@@ -81,7 +81,7 @@ public:
} while (info->next_entry_offset != 0);
}
};
XEASSERTSTRUCTSIZE(XDirectoryInfo, 72);
static_assert_size(XDirectoryInfo, 72);
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff540287(v=vs.85).aspx
class XVolumeInfo {
@@ -102,7 +102,7 @@ public:
xe_copy_memory(dst + 20, this->label_length, this->label, this->label_length);
}
};
XEASSERTSTRUCTSIZE(XVolumeInfo, 24);
static_assert_size(XVolumeInfo, 24);
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff540251(v=vs.85).aspx
class XFileSystemAttributeInfo {
@@ -121,7 +121,7 @@ public:
xe_copy_memory(dst + 12, this->fs_name_length, this->fs_name, this->fs_name_length);
}
};
XEASSERTSTRUCTSIZE(XFileSystemAttributeInfo, 16);
static_assert_size(XFileSystemAttributeInfo, 16);
class XFile : public XObject {
public:

View File

@@ -26,22 +26,22 @@ XMutant::~XMutant() {
}
void XMutant::Initialize(bool initial_owner) {
XEASSERTNULL(handle_);
assert_null(handle_);
handle_ = CreateMutex(NULL, initial_owner ? TRUE : FALSE, NULL);
}
void XMutant::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) {
XEASSERTNULL(handle_);
assert_null(handle_);
// Haven't seen this yet, but it's possible.
XEASSERTALWAYS();
assert_always();
}
X_STATUS XMutant::ReleaseMutant(
uint32_t priority_increment, bool abandon, bool wait) {
// TODO(benvanik): abandoning.
XEASSERTFALSE(abandon);
assert_false(abandon);
BOOL result = ReleaseMutex(handle_);
if (result) {
return X_STATUS_SUCCESS;

View File

@@ -28,7 +28,7 @@ XNotifyListener::~XNotifyListener() {
}
void XNotifyListener::Initialize(uint64_t mask) {
XEASSERTNULL(wait_handle_);
assert_null(wait_handle_);
lock_ = xe_mutex_alloc();
wait_handle_ = CreateEvent(NULL, TRUE, FALSE, NULL);

View File

@@ -26,13 +26,13 @@ XSemaphore::~XSemaphore() {
}
void XSemaphore::Initialize(int32_t initial_count, int32_t maximum_count) {
XEASSERTNULL(handle_);
assert_null(handle_);
handle_ = CreateSemaphore(NULL, initial_count, maximum_count, NULL);
}
void XSemaphore::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) {
XEASSERTNULL(handle_);
assert_null(handle_);
// NOT IMPLEMENTED
// We expect Initialize to be called shortly.

View File

@@ -334,7 +334,7 @@ X_STATUS XThread::PlatformCreate() {
this);
#else
// TODO(benvanik): pthread_create_suspended_np on linux
XEASSERTALWAYS();
assert_always();
#endif // OSX
} else {
result_code = pthread_create(
@@ -552,7 +552,7 @@ X_STATUS XThread::Delay(
if (timeout_ticks > 0) {
// Absolute time, based on January 1, 1601.
// TODO(benvanik): convert time to relative time.
XEASSERTALWAYS();
assert_always();
timeout_ms = 0;
} else if (timeout_ticks < 0) {
// Relative time.

View File

@@ -28,7 +28,7 @@ XTimer::~XTimer() {
}
void XTimer::Initialize(uint32_t timer_type) {
XEASSERTNULL(handle_);
assert_null(handle_);
bool manual_reset = false;
switch (timer_type) {
@@ -39,7 +39,7 @@ void XTimer::Initialize(uint32_t timer_type) {
manual_reset = false;
break;
default:
XEASSERTALWAYS();
assert_always();
break;
}
@@ -71,7 +71,7 @@ X_STATUS XTimer::SetTimer(
void XTimer::CompletionRoutine(
XTimer* timer, DWORD timer_low, DWORD timer_high) {
XEASSERT(timer->current_routine_);
assert_true(timer->current_routine_);
// Queue APC to call back routine with (arg, low, high).
// TODO(benvanik): APC dispatch.