From a41ab9326c8f0f7eb738e5d51a239a2b9e276361 Mon Sep 17 00:00:00 2001 From: tfarina Date: Fri, 30 Oct 2015 16:08:48 -0700 Subject: [PATCH] Switch usage of _DEBUG macro to NDEBUG. http://stackoverflow.com/a/29253284/5237416 BUG=None R=tommi@webrtc.org NOPRESUBMIT=true Review URL: https://codereview.webrtc.org/1429513004 Cr-Commit-Position: refs/heads/master@{#10468} --- webrtc/base/diskcache.cc | 10 +++++----- webrtc/base/logging.cc | 8 ++++---- webrtc/base/logging.h | 2 +- webrtc/base/network.cc | 4 ++-- webrtc/base/openssladapter.cc | 8 ++++---- webrtc/base/openssladapter.h | 4 ++-- webrtc/base/opensslidentity.cc | 4 ++-- webrtc/base/opensslstreamadapter.cc | 2 +- webrtc/base/physicalsocketserver.cc | 16 ++++++++-------- webrtc/base/sigslot.h | 18 +++++++++--------- webrtc/base/stringutils.cc | 4 ++-- webrtc/base/task.cc | 8 ++++---- webrtc/base/taskparent.cc | 6 +++--- webrtc/base/taskparent.h | 2 +- webrtc/base/taskrunner.cc | 6 +++--- webrtc/base/taskrunner.h | 4 ++-- webrtc/base/thread.cc | 2 +- webrtc/base/unittest_main.cc | 4 ++-- webrtc/base/win32socketserver.cc | 6 +++--- .../objc/AppRTCDemo/ios/ARDAppDelegate.m | 2 +- webrtc/libjingle/xmpp/xmppclient.cc | 4 ++-- webrtc/libjingle/xmpp/xmpplogintask.cc | 8 ++++---- webrtc/libjingle/xmpp/xmpplogintask.h | 4 ++-- webrtc/libjingle/xmpp/xmpptask.cc | 4 ++-- webrtc/libjingle/xmpp/xmpptask.h | 4 ++-- .../codecs/isac/fix/test/test_iSACfixfloat.c | 16 ++++++++-------- .../test/ReleaseTest-API/ReleaseTest-API.cc | 12 ++++++------ webrtc/modules/rtp_rtcp/source/rtp_utility.cc | 6 +++--- webrtc/system_wrappers/include/logging.h | 2 +- webrtc/voice_engine/voice_engine_defines.h | 4 ++-- 30 files changed, 92 insertions(+), 92 deletions(-) diff --git a/webrtc/base/diskcache.cc b/webrtc/base/diskcache.cc index 6bbc53eb13..7bf1ba261d 100644 --- a/webrtc/base/diskcache.cc +++ b/webrtc/base/diskcache.cc @@ -23,11 +23,11 @@ #include "webrtc/base/stringencode.h" #include "webrtc/base/stringutils.h" -#ifdef _DEBUG +#if !defined(NDEBUG) #define TRANSPARENT_CACHE_NAMES 1 -#else // !_DEBUG +#else #define TRANSPARENT_CACHE_NAMES 0 -#endif // !_DEBUG +#endif namespace rtc { @@ -211,14 +211,14 @@ bool DiskCache::DeleteResource(const std::string& id) { } bool DiskCache::CheckLimit() { -#ifdef _DEBUG +#if !defined(NDEBUG) // Temporary check to make sure everything is working correctly. size_t cache_size = 0; for (EntryMap::iterator it = map_.begin(); it != map_.end(); ++it) { cache_size += it->second.size; } ASSERT(cache_size == total_size_); -#endif // _DEBUG +#endif // TODO: Replace this with a non-brain-dead algorithm for clearing out the // oldest resources... something that isn't O(n^2) diff --git a/webrtc/base/logging.cc b/webrtc/base/logging.cc index b02be27e33..686b9b2b02 100644 --- a/webrtc/base/logging.cc +++ b/webrtc/base/logging.cc @@ -92,13 +92,13 @@ std::string ErrorName(int err, const ConstantLabel* err_table) { ///////////////////////////////////////////////////////////////////////////// // By default, release builds don't log, debug builds at info level -#if _DEBUG +#if !defined(NDEBUG) LoggingSeverity LogMessage::min_sev_ = LS_INFO; LoggingSeverity LogMessage::dbg_sev_ = LS_INFO; -#else // !_DEBUG +#else LoggingSeverity LogMessage::min_sev_ = LS_NONE; LoggingSeverity LogMessage::dbg_sev_ = LS_NONE; -#endif // !_DEBUG +#endif bool LogMessage::log_to_stderr_ = true; namespace { @@ -340,7 +340,7 @@ void LogMessage::OutputToDebug(const std::string& str, LoggingSeverity severity, const std::string& tag) { bool log_to_stderr = log_to_stderr_; -#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && (!defined(_DEBUG) || defined(NDEBUG)) +#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && defined(NDEBUG) // On the Mac, all stderr output goes to the Console log and causes clutter. // So in opt builds, don't log to stderr unless the user specifically sets // a preference to do so. diff --git a/webrtc/base/logging.h b/webrtc/base/logging.h index 1208275a34..e40ca4465f 100644 --- a/webrtc/base/logging.h +++ b/webrtc/base/logging.h @@ -285,7 +285,7 @@ class LogMessageVoidify { rtc::LogMessage(__FILE__, __LINE__, sev).stream() // The _F version prefixes the message with the current function name. -#if (defined(__GNUC__) && defined(_DEBUG)) || defined(WANT_PRETTY_LOG_F) +#if (defined(__GNUC__) && !defined(NDEBUG)) || defined(WANT_PRETTY_LOG_F) #define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": " #define LOG_T_F(sev) LOG(sev) << this << ": " << __PRETTY_FUNCTION__ << ": " #else diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc index 879c1e4529..32b2a91844 100644 --- a/webrtc/base/network.cc +++ b/webrtc/base/network.cc @@ -511,14 +511,14 @@ bool BasicNetworkManager::CreateNetworks(bool include_ignored, PIP_ADAPTER_PREFIX prefixlist = adapter_addrs->FirstPrefix; std::string name; std::string description; -#ifdef _DEBUG +#if !defined(NDEBUG) name = ToUtf8(adapter_addrs->FriendlyName, wcslen(adapter_addrs->FriendlyName)); #endif description = ToUtf8(adapter_addrs->Description, wcslen(adapter_addrs->Description)); for (; address; address = address->Next) { -#ifndef _DEBUG +#if defined(NDEBUG) name = rtc::ToString(count); #endif diff --git a/webrtc/base/openssladapter.cc b/webrtc/base/openssladapter.cc index c906ebb4b4..892b5ccb41 100644 --- a/webrtc/base/openssladapter.cc +++ b/webrtc/base/openssladapter.cc @@ -835,7 +835,7 @@ bool OpenSSLAdapter::SSLPostConnectionCheck(SSL* ssl, const char* host) { return ok; } -#if _DEBUG +#if !defined(NDEBUG) // We only use this for tracing and so it is only needed in debug mode @@ -864,11 +864,11 @@ OpenSSLAdapter::SSLInfoCallback(const SSL* s, int where, int ret) { } } -#endif // _DEBUG +#endif int OpenSSLAdapter::SSLVerifyCallback(int ok, X509_STORE_CTX* store) { -#if _DEBUG +#if !defined(NDEBUG) if (!ok) { char data[256]; X509* cert = X509_STORE_CTX_get_current_cert(store); @@ -949,7 +949,7 @@ OpenSSLAdapter::SetupSSLContext() { return NULL; } -#ifdef _DEBUG +#if !defined(NDEBUG) SSL_CTX_set_info_callback(ctx, SSLInfoCallback); #endif diff --git a/webrtc/base/openssladapter.h b/webrtc/base/openssladapter.h index 3dcb1c5645..cdf45e603f 100644 --- a/webrtc/base/openssladapter.h +++ b/webrtc/base/openssladapter.h @@ -67,9 +67,9 @@ private: static bool VerifyServerName(SSL* ssl, const char* host, bool ignore_bad_cert); bool SSLPostConnectionCheck(SSL* ssl, const char* host); -#if _DEBUG +#if !defined(NDEBUG) static void SSLInfoCallback(const SSL* s, int where, int ret); -#endif // !_DEBUG +#endif static int SSLVerifyCallback(int ok, X509_STORE_CTX* store); static VerificationCallback custom_verify_callback_; friend class OpenSSLStreamAdapter; // for custom_verify_callback_; diff --git a/webrtc/base/opensslidentity.cc b/webrtc/base/opensslidentity.cc index feda6744f0..7894b4887c 100644 --- a/webrtc/base/opensslidentity.cc +++ b/webrtc/base/opensslidentity.cc @@ -186,7 +186,7 @@ void OpenSSLKeyPair::AddReference() { #endif } -#ifdef _DEBUG +#if !defined(NDEBUG) // Print a certificate to the log, for debugging. static void PrintCert(X509* x509) { BIO* temp_memory_bio = BIO_new(BIO_s_mem()); @@ -215,7 +215,7 @@ OpenSSLCertificate* OpenSSLCertificate::Generate( LogSSLErrors("Generating certificate"); return NULL; } -#ifdef _DEBUG +#if !defined(NDEBUG) PrintCert(x509); #endif OpenSSLCertificate* ret = new OpenSSLCertificate(x509); diff --git a/webrtc/base/opensslstreamadapter.cc b/webrtc/base/opensslstreamadapter.cc index 67ed5db4b5..9c3a09ecc0 100644 --- a/webrtc/base/opensslstreamadapter.cc +++ b/webrtc/base/opensslstreamadapter.cc @@ -994,7 +994,7 @@ SSL_CTX* OpenSSLStreamAdapter::SetupSSLContext() { return NULL; } -#ifdef _DEBUG +#if !defined(NDEBUG) SSL_CTX_set_info_callback(ctx, OpenSSLAdapter::SSLInfoCallback); #endif diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc index 86abcf279b..c3abb24d46 100644 --- a/webrtc/base/physicalsocketserver.cc +++ b/webrtc/base/physicalsocketserver.cc @@ -171,12 +171,12 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> { sockaddr* addr = reinterpret_cast(&addr_storage); int err = ::bind(s_, addr, static_cast(len)); UpdateLastError(); -#ifdef _DEBUG +#if !defined(NDEBUG) if (0 == err) { dbg_addr_ = "Bound @ "; dbg_addr_.append(GetLocalAddress().ToString()); } -#endif // _DEBUG +#endif return err; } @@ -361,10 +361,10 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> { if (err == 0) { state_ = CS_CONNECTING; enabled_events_ |= DE_ACCEPT; -#ifdef _DEBUG +#if !defined(NDEBUG) dbg_addr_ = "Listening @ "; dbg_addr_.append(GetLocalAddress().ToString()); -#endif // _DEBUG +#endif } return err; } @@ -549,9 +549,9 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> { ConnState state_; AsyncResolver* resolver_; -#ifdef _DEBUG +#if !defined(NDEBUG) std::string dbg_addr_; -#endif // _DEBUG; +#endif }; #if defined(WEBRTC_POSIX) @@ -1088,10 +1088,10 @@ class SocketDispatcher : public Dispatcher, public PhysicalSocket { if (ff != DE_CONNECT) LOG(LS_VERBOSE) << "Signalled with DE_CONNECT: " << ff; enabled_events_ &= ~DE_CONNECT; -#ifdef _DEBUG +#if !defined(NDEBUG) dbg_addr_ = "Connected @ "; dbg_addr_.append(GetRemoteAddress().ToString()); -#endif // _DEBUG +#endif SignalConnectEvent(this); } if (((ff & DE_ACCEPT) != 0) && (id_ == cache_id)) { diff --git a/webrtc/base/sigslot.h b/webrtc/base/sigslot.h index d9b12b04bc..a5fd5f79af 100644 --- a/webrtc/base/sigslot.h +++ b/webrtc/base/sigslot.h @@ -532,7 +532,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -686,7 +686,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -825,7 +825,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -963,7 +963,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -1101,7 +1101,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -1241,7 +1241,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -1381,7 +1381,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -1521,7 +1521,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); @@ -1662,7 +1662,7 @@ namespace sigslot { m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end()); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool connected(has_slots_interface* pclass) { lock_block lock(this); diff --git a/webrtc/base/stringutils.cc b/webrtc/base/stringutils.cc index 868e475f2d..9580253d1b 100644 --- a/webrtc/base/stringutils.cc +++ b/webrtc/base/stringutils.cc @@ -77,11 +77,11 @@ size_t asccpyn(wchar_t* buffer, size_t buflen, } else if (srclen >= buflen) { srclen = buflen - 1; } -#if _DEBUG +#if !defined(NDEBUG) // Double check that characters are not UTF-8 for (size_t pos = 0; pos < srclen; ++pos) RTC_DCHECK_LT(static_cast(source[pos]), 128); -#endif // _DEBUG +#endif std::copy(source, source + srclen, buffer); buffer[srclen] = 0; return srclen; diff --git a/webrtc/base/task.cc b/webrtc/base/task.cc index bdf8f1df03..b09ced12b4 100644 --- a/webrtc/base/task.cc +++ b/webrtc/base/task.cc @@ -68,7 +68,7 @@ void Task::Start() { void Task::Step() { if (done_) { -#ifdef _DEBUG +#if !defined(NDEBUG) // we do not know how !blocked_ happens when done_ - should be impossible. // But it causes problems, so in retail build, we force blocked_, and // under debug we assert. @@ -88,7 +88,7 @@ void Task::Step() { // SignalDone(); Stop(); -#ifdef _DEBUG +#if !defined(NDEBUG) // verify that stop removed this from its parent ASSERT(!parent()->IsChildTask(this)); #endif @@ -125,7 +125,7 @@ void Task::Step() { // SignalDone(); Stop(); -#if _DEBUG +#if !defined(NDEBUG) // verify that stop removed this from its parent ASSERT(!parent()->IsChildTask(this)); #endif @@ -150,7 +150,7 @@ void Task::Abort(bool nowake) { // "done_" is set before calling "Stop()" to ensure that this code // doesn't execute more than once (recursively) for the same task. Stop(); -#ifdef _DEBUG +#if !defined(NDEBUG) // verify that stop removed this from its parent ASSERT(!parent()->IsChildTask(this)); #endif diff --git a/webrtc/base/taskparent.cc b/webrtc/base/taskparent.cc index db6db37029..14d236dc42 100644 --- a/webrtc/base/taskparent.cc +++ b/webrtc/base/taskparent.cc @@ -46,7 +46,7 @@ void TaskParent::AddChild(Task *child) { children_->insert(child); } -#ifdef _DEBUG +#if !defined(NDEBUG) bool TaskParent::IsChildTask(Task *task) { ASSERT(task != NULL); return task->parent_ == this && children_->find(task) != children_->end(); @@ -69,7 +69,7 @@ bool TaskParent::AnyChildError() { void TaskParent::AbortAllChildren() { if (children_->size() > 0) { -#ifdef _DEBUG +#if !defined(NDEBUG) runner_->IncrementAbortCount(); #endif @@ -78,7 +78,7 @@ void TaskParent::AbortAllChildren() { (*it)->Abort(true); // Note we do not wake } -#ifdef _DEBUG +#if !defined(NDEBUG) runner_->DecrementAbortCount(); #endif } diff --git a/webrtc/base/taskparent.h b/webrtc/base/taskparent.h index e9342c1c52..41008fa98e 100644 --- a/webrtc/base/taskparent.h +++ b/webrtc/base/taskparent.h @@ -32,7 +32,7 @@ class TaskParent { bool AllChildrenDone(); bool AnyChildError(); -#ifdef _DEBUG +#if !defined(NDEBUG) bool IsChildTask(Task *task); #endif diff --git a/webrtc/base/taskrunner.cc b/webrtc/base/taskrunner.cc index e7278f10a1..c50c9f833e 100644 --- a/webrtc/base/taskrunner.cc +++ b/webrtc/base/taskrunner.cc @@ -23,7 +23,7 @@ TaskRunner::TaskRunner() : TaskParent(this), next_timeout_task_(NULL), tasks_running_(false) -#ifdef _DEBUG +#if !defined(NDEBUG) , abort_count_(0), deleting_task_(NULL) #endif @@ -88,11 +88,11 @@ void TaskRunner::InternalRunTasks(bool in_destructor) { need_timeout_recalc = true; } -#ifdef _DEBUG +#if !defined(NDEBUG) deleting_task_ = task; #endif delete task; -#ifdef _DEBUG +#if !defined(NDEBUG) deleting_task_ = NULL; #endif tasks_[i] = NULL; diff --git a/webrtc/base/taskrunner.h b/webrtc/base/taskrunner.h index 9a43aac068..e0cf17513a 100644 --- a/webrtc/base/taskrunner.h +++ b/webrtc/base/taskrunner.h @@ -44,7 +44,7 @@ class TaskRunner : public TaskParent, public sigslot::has_slots<> { void UpdateTaskTimeout(Task* task, int64_t previous_task_timeout_time); -#ifdef _DEBUG +#if !defined(NDEBUG) bool is_ok_to_delete(Task* task) { return task == deleting_task_; } @@ -87,7 +87,7 @@ class TaskRunner : public TaskParent, public sigslot::has_slots<> { std::vector tasks_; Task *next_timeout_task_; bool tasks_running_; -#ifdef _DEBUG +#if !defined(NDEBUG) int abort_count_; Task* deleting_task_; #endif diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc index 8ab381f4df..2a5119b5e4 100644 --- a/webrtc/base/thread.cc +++ b/webrtc/base/thread.cc @@ -345,7 +345,7 @@ bool Thread::SetAllowBlockingCalls(bool allow) { // static void Thread::AssertBlockingIsAllowedOnCurrentThread() { -#ifdef _DEBUG +#if !defined(NDEBUG) Thread* current = Thread::Current(); ASSERT(!current || current->blocking_calls_allowed_); #endif diff --git a/webrtc/base/unittest_main.cc b/webrtc/base/unittest_main.cc index f952b2d547..fb74e9e5e1 100644 --- a/webrtc/base/unittest_main.cc +++ b/webrtc/base/unittest_main.cc @@ -78,12 +78,12 @@ int main(int argc, char** argv) { _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, TestCrtReportHandler); } -#ifdef _DEBUG // Turn on memory leak checking on Windows. +#if !defined(NDEBUG) // Turn on memory leak checking on Windows. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF |_CRTDBG_LEAK_CHECK_DF); if (FLAG_crt_break_alloc >= 0) { _crtBreakAlloc = FLAG_crt_break_alloc; } -#endif // _DEBUG +#endif #endif // WEBRTC_WIN rtc::Filesystem::SetOrganizationName("google"); diff --git a/webrtc/base/win32socketserver.cc b/webrtc/base/win32socketserver.cc index f466bf10cb..72ce4ebb7c 100644 --- a/webrtc/base/win32socketserver.cc +++ b/webrtc/base/win32socketserver.cc @@ -55,7 +55,7 @@ static const int ICMP_HEADER_SIZE = 8u; static const int ICMP_PING_TIMEOUT_MILLIS = 10000u; // TODO: Enable for production builds also? Use FormatMessage? -#ifdef _DEBUG +#if !defined(NDEBUG) LPCSTR WSAErrorToString(int error, LPCSTR *description_result) { LPCSTR string = "Unspecified"; LPCSTR description = "Unspecified description"; @@ -626,7 +626,7 @@ void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { case FD_CONNECT: if (error != ERROR_SUCCESS) { ReportWSAError("WSAAsync:connect notify", error, addr_); -#ifdef _DEBUG +#if !defined(NDEBUG) int32_t duration = TimeSince(connect_time_); LOG(LS_INFO) << "WSAAsync:connect error (" << duration << " ms), faking close"; @@ -639,7 +639,7 @@ void Win32Socket::OnSocketNotify(SOCKET socket, int event, int error) { // though the connect event never did occur. SignalCloseEvent(this, error); } else { -#ifdef _DEBUG +#if !defined(NDEBUG) int32_t duration = TimeSince(connect_time_); LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)"; #endif diff --git a/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m b/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m index 0f4165ebac..9568b94e77 100644 --- a/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m +++ b/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m @@ -29,7 +29,7 @@ ARDMainViewController *viewController = [[ARDMainViewController alloc] init]; _window.rootViewController = viewController; -#ifndef _DEBUG +#if defined(NDEBUG) // In debug builds the default level is LS_INFO and in non-debug builds it is // disabled. Continue to log to console in non-debug builds, but only // warnings and errors. diff --git a/webrtc/libjingle/xmpp/xmppclient.cc b/webrtc/libjingle/xmpp/xmppclient.cc index 7c2a5e693c..f7e88c3927 100644 --- a/webrtc/libjingle/xmpp/xmppclient.cc +++ b/webrtc/libjingle/xmpp/xmppclient.cc @@ -362,7 +362,7 @@ void XmppClient::Private::OnSocketRead() { if (bytes_read == 0) return; -//#ifdef _DEBUG +//#if !defined(NDEBUG) client_->SignalLogInput(bytes, static_cast(bytes_read)); //#endif @@ -386,7 +386,7 @@ void XmppClient::Private::OnStateChange(int state) { } void XmppClient::Private::WriteOutput(const char* bytes, size_t len) { -//#ifdef _DEBUG +//#if !defined(NDEBUG) client_->SignalLogOutput(bytes, static_cast(len)); //#endif diff --git a/webrtc/libjingle/xmpp/xmpplogintask.cc b/webrtc/libjingle/xmpp/xmpplogintask.cc index f5745cd979..e39713d463 100644 --- a/webrtc/libjingle/xmpp/xmpplogintask.cc +++ b/webrtc/libjingle/xmpp/xmpplogintask.cc @@ -25,7 +25,7 @@ using rtc::ConstantLabel; namespace buzz { -#ifdef _DEBUG +#if !defined(NDEBUG) const ConstantLabel XmppLoginTask::LOGINTASK_STATES[] = { KLABEL(LOGINSTATE_INIT), KLABEL(LOGINSTATE_STREAMSTART_SENT), @@ -40,7 +40,7 @@ const ConstantLabel XmppLoginTask::LOGINTASK_STATES[] = { KLABEL(LOGINSTATE_DONE), LASTLABEL }; -#endif // _DEBUG +#endif XmppLoginTask::XmppLoginTask(XmppEngineImpl * pctx) : pctx_(pctx), authNeeded_(true), @@ -84,10 +84,10 @@ XmppLoginTask::Advance() { const XmlElement * element = NULL; -#if _DEBUG +#if !defined(NDEBUG) LOG(LS_VERBOSE) << "XmppLoginTask::Advance - " << rtc::ErrorName(state_, LOGINTASK_STATES); -#endif // _DEBUG +#endif switch (state_) { diff --git a/webrtc/libjingle/xmpp/xmpplogintask.h b/webrtc/libjingle/xmpp/xmpplogintask.h index 58e0a2f3fa..f69a648394 100644 --- a/webrtc/libjingle/xmpp/xmpplogintask.h +++ b/webrtc/libjingle/xmpp/xmpplogintask.h @@ -77,9 +77,9 @@ private: rtc::scoped_ptr sasl_mech_; -#ifdef _DEBUG +#if !defined(NDEBUG) static const rtc::ConstantLabel LOGINTASK_STATES[]; -#endif // _DEBUG +#endif }; } diff --git a/webrtc/libjingle/xmpp/xmpptask.cc b/webrtc/libjingle/xmpp/xmpptask.cc index 09067058ae..84f9ba6b92 100644 --- a/webrtc/libjingle/xmpp/xmpptask.cc +++ b/webrtc/libjingle/xmpp/xmpptask.cc @@ -24,7 +24,7 @@ XmppClientInterface::~XmppClientInterface() { XmppTask::XmppTask(XmppTaskParentInterface* parent, XmppEngine::HandlerLevel level) : XmppTaskBase(parent), stopped_(false) { -#ifdef _DEBUG +#if !defined(NDEBUG) debug_force_timeout_ = false; #endif @@ -70,7 +70,7 @@ void XmppTask::OnDisconnect() { } void XmppTask::QueueStanza(const XmlElement* stanza) { -#ifdef _DEBUG +#if !defined(NDEBUG) if (debug_force_timeout_) return; #endif diff --git a/webrtc/libjingle/xmpp/xmpptask.h b/webrtc/libjingle/xmpp/xmpptask.h index 5b97e89c97..36351b7fa8 100644 --- a/webrtc/libjingle/xmpp/xmpptask.h +++ b/webrtc/libjingle/xmpp/xmpptask.h @@ -119,7 +119,7 @@ class XmppTask : public XmppTaskBase, std::string task_id() const { return id_; } void set_task_id(std::string id) { id_ = id; } -#ifdef _DEBUG +#if !defined(NDEBUG) void set_debug_force_timeout(const bool f) { debug_force_timeout_ = f; } #endif @@ -162,7 +162,7 @@ private: rtc::scoped_ptr next_stanza_; std::string id_; -#ifdef _DEBUG +#if !defined(NDEBUG) bool debug_force_timeout_; #endif }; diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c index b82af1c059..ac0fa350c9 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c @@ -112,12 +112,12 @@ int main(int argc, char* argv[]) { char version_number[20]; int mode = -1, tmp, nbTest = 0; /*,sss;*/ -#ifdef _DEBUG +#if !defined(NDEBUG) FILE* fy; double kbps; size_t totalbits = 0; int totalsmpls = 0; -#endif /* _DEBUG */ +#endif /* only one structure used for ISAC encoder */ ISAC_MainStruct* ISAC_main_inst; @@ -126,12 +126,12 @@ int main(int argc, char* argv[]) { BottleNeckModel BN_data; f_bn = NULL; -#ifdef _DEBUG +#if !defined(NDEBUG) fy = fopen("bit_rate.dat", "w"); fclose(fy); fy = fopen("bytes_frames.dat", "w"); fclose(fy); -#endif /* _DEBUG */ +#endif // histfile = fopen("histo.dat", "ab"); // ratefile = fopen("rates.dat", "ab"); @@ -589,7 +589,7 @@ int main(int argc, char* argv[]) { fprintf(stderr, " \rframe = %d", framecnt); framecnt++; -#ifdef _DEBUG +#if !defined(NDEBUG) totalsmpls += declen; totalbits += 8 * stream_len; @@ -598,15 +598,15 @@ int main(int argc, char* argv[]) { fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); fclose(fy); -#endif /* _DEBUG */ +#endif } -#ifdef _DEBUG +#if !defined(NDEBUG) printf("\n\ntotal bits = %" PRIuS " bits", totalbits); printf("\nmeasured average bitrate = %0.3f kbits/s", (double)totalbits * (FS / 1000) / totalsmpls); printf("\n"); -#endif /* _DEBUG */ +#endif /* Runtime statistics */ runtime = (double)(clock() / (double)CLOCKS_PER_SEC - starttime); diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc index 2e5badd82c..4cef8f7b3b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc @@ -73,10 +73,10 @@ int main(int argc, char* argv[]) { FILE* plFile; int32_t sendBN; -#ifdef _DEBUG +#if !defined(NDEBUG) FILE* fy; double kbps; -#endif /* _DEBUG */ +#endif size_t totalbits = 0; int totalsmpls = 0; @@ -103,12 +103,12 @@ int main(int argc, char* argv[]) { BottleNeckModel BN_data; -#ifdef _DEBUG +#if !defined(NDEBUG) fy = fopen("bit_rate.dat", "w"); fclose(fy); fy = fopen("bytes_frames.dat", "w"); fclose(fy); -#endif /* _DEBUG */ +#endif /* Handling wrong input arguments in the command line */ if ((argc < 3) || (argc > 17)) { @@ -885,14 +885,14 @@ int main(int argc, char* argv[]) { totalsmpls += declen; totalbits += 8 * stream_len; -#ifdef _DEBUG +#if !defined(NDEBUG) kbps = ((double)sampFreqKHz * 1000.) / ((double)cur_framesmpls) * 8.0 * stream_len / 1000.0; // kbits/s fy = fopen("bit_rate.dat", "a"); fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps); fclose(fy); -#endif /* _DEBUG */ +#endif } printf("\n"); printf("total bits = %" PRIuS " bits\n", totalbits); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index bf0b30a064..e32fc988be 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -23,7 +23,7 @@ #include // gettimeofday #include #endif -#if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) +#if (!defined(NDEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) #include #endif @@ -31,7 +31,7 @@ #include "webrtc/modules/rtp_rtcp/source/byte_io.h" #include "webrtc/system_wrappers/include/tick_util.h" -#if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) +#if (!defined(NDEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) #define DEBUG_PRINT(...) \ { \ char msg[256]; \ @@ -41,7 +41,7 @@ #else // special fix for visual 2003 #define DEBUG_PRINT(exp) ((void)0) -#endif // defined(_DEBUG) && defined(_WIN32) +#endif // !defined(NDEBUG) && defined(_WIN32) namespace webrtc { diff --git a/webrtc/system_wrappers/include/logging.h b/webrtc/system_wrappers/include/logging.h index 41c436b1f3..d95c53e176 100644 --- a/webrtc/system_wrappers/include/logging.h +++ b/webrtc/system_wrappers/include/logging.h @@ -131,7 +131,7 @@ class LogMessageVoidify { webrtc::LogMessage(__FILE__, __LINE__, sev).stream() // The _F version prefixes the message with the current function name. -#if (defined(__GNUC__) && defined(_DEBUG)) || defined(WANT_PRETTY_LOG_F) +#if (defined(__GNUC__) && !defined(NDEBUG)) || defined(WANT_PRETTY_LOG_F) #define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": " #else #define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": " diff --git a/webrtc/voice_engine/voice_engine_defines.h b/webrtc/voice_engine/voice_engine_defines.h index f78fb2c558..f929cd0101 100644 --- a/webrtc/voice_engine/voice_engine_defines.h +++ b/webrtc/voice_engine/voice_engine_defines.h @@ -135,7 +135,7 @@ enum { kVoiceEngineMaxRtpExtensionId = 14 }; stat.SetLastError(VE_FUNC_NOT_SUPPORTED); \ return -1; -#if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) +#if (!defined(NDEBUG) && defined(_WIN32) && (_MSC_VER >= 1400)) #include #include #define DEBUG_PRINT(...) \ @@ -147,7 +147,7 @@ enum { kVoiceEngineMaxRtpExtensionId = 14 }; #else // special fix for visual 2003 #define DEBUG_PRINT(exp) ((void)0) -#endif // defined(_DEBUG) && defined(_WIN32) +#endif // !defined(NDEBUG) && defined(_WIN32) #define CHECK_CHANNEL(channel) \ if (CheckChannel(channel) == -1) \