#define __attribute__(X)
#endif
+#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
+
#if defined(__cplusplus)
//----------------------------------------------------------------------
MainLoopPosix::UnregisterReadObject(IOObject::WaitableHandle handle)
{
bool erased = m_read_fds.erase(handle);
- (void) erased;
+ UNUSED_IF_ASSERT_DISABLED(erased);
assert(erased);
}
char buffer[1024];
int num_printed = snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o");
assert (num_printed < 1024);
- // Quiet unused variable warning for release builds.
- (void) num_printed;
+ UNUSED_IF_ASSERT_DISABLED(num_printed);
success = tbreak_regex_cmd_ap->AddRegexCommand (break_regexes[i][0], buffer);
if (!success)
break;
const size_t count_v13 = count_v11 +
addr_size + // sharedCacheSlide
sizeof (uuid_t); // sharedCacheUUID
- (void) count_v13; // Avoid warnings when assertions are off.
+ UNUSED_IF_ASSERT_DISABLED(count_v13);
assert (sizeof (buf) >= count_v13);
Error error;
while (type.HasAtLeast(1) && type.Peek() != '"')
buffer.Printf("%c",type.Next());
StringLexer::Character next = type.Next();
- (void) next; // Avoid warnings when assertions are off.
+ UNUSED_IF_ASSERT_DISABLED(next);
assert (next == '"');
return buffer.GetString();
}
int platform_port;
std::string platform_path;
bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme, platform_ip, platform_port, platform_path);
- (void)ok;
+ UNUSED_IF_ASSERT_DISABLED(ok);
assert(ok);
Error error = StartDebugserverProcess (
platform_ip.c_str(),
m_decls_to_deport->erase(decl);
DeclOrigin &origin = to_context_md->m_origins[decl];
- (void)origin;
+ UNUSED_IF_ASSERT_DISABLED(origin);
assert (origin.ctx == m_source_ctx); // otherwise we should never have added this
// because it doesn't need to be deported
size_t intersect_size;
size_t opcode_offset;
const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
- (void)intersects;
+ UNUSED_IF_ASSERT_DISABLED(intersects);
assert(intersects);
assert(addr <= intersect_addr && intersect_addr < addr + size);
assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
else
{
bool res = AddProcessToMap(pid, processSP);
- (void)res;
+ UNUSED_IF_ASSERT_DISABLED(res);
assert(res && "Couldn't add process to map!");
return pid;
}
if (pid != INVALID_NUB_PROCESS)
{
bool res = AddProcessToMap(pid, processSP);
- (void)res;
+ UNUSED_IF_ASSERT_DISABLED(res);
assert(res && "Couldn't add process to map!");
spawn_waitpid_thread(pid);
}
typedef nub_size_t (*DNBCallbackCopyExecutableImageInfos)(nub_process_t pid, struct DNBExecutableImageInfo **image_infos, nub_bool_t only_changed, void *baton);
typedef void (*DNBCallbackLog)(void *baton, uint32_t flags, const char *format, va_list args);
+#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
+
#endif // #ifndef __DNBDefs_h__
DNBBreakpoint *bp = bps[i];
const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
- (void)intersects;
+ UNUSED_IF_ASSERT_DISABLED(intersects);
assert(intersects);
assert(addr <= intersect_addr && intersect_addr < addr + size);
assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);
p += sizeof(m_state.context.exc);
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
}
p += sizeof(m_state.context.exc);
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
if (SetGPRState() | SetVFPState() | SetEXCState())
p += sizeof(m_state.context.exc);
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
}
DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM64::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
p += sizeof(m_state.context.exc);
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
SetGPRState();
SetVFPState();
// make sure we end up with exactly what we think we should have
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
}
}
// make sure we end up with exactly what we think we should have
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
kern_return_t kret;
if ((kret = SetGPRState()) != KERN_SUCCESS)
// make sure we end up with exactly what we think we should have
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
}
// make sure we end up with exactly what we think we should have
size_t bytes_written = p - (uint8_t *)buf;
- (void)bytes_written;
+ UNUSED_IF_ASSERT_DISABLED(bytes_written);
assert (bytes_written == size);
kern_return_t kret;