Makefile.am | 4 ++++ common/Util.hpp | 8 ++++++++ configure.ac | 1 + net/clientnb.cpp | 15 ++++++++++++--- 4 files changed, 25 insertions(+), 3 deletions(-)
New commits: commit a0ba8948dc8789f4b4518c8f6611466269724239 Author: Jan Holesovsky <[email protected]> Date: Wed Apr 5 11:57:28 2017 +0200 Suppress assert()'s in the production builds. Change-Id: I2074ed335b7201337e6519440ff6bed1809be915 diff --git a/Makefile.am b/Makefile.am index 3f45901e..c4721805 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,10 @@ AM_CPPFLAGS = -pthread -DLOOLWSD_DATADIR='"@LOOLWSD_DATADIR@"' \ -DDEBUG_ABSSRCDIR='"@abs_srcdir@"' \ ${include_paths} +if !ENABLE_DEBUG +AM_CPPFLAGS += -DNDEBUG +endif + AM_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib $(ZLIB_LIBS) if ENABLE_SSL diff --git a/common/Util.hpp b/common/Util.hpp index b0e29024..63bffc97 100644 --- a/common/Util.hpp +++ b/common/Util.hpp @@ -77,12 +77,20 @@ namespace Util template <typename T> void assertIsLocked(const T& lock) { +#ifdef NDEBUG + (void) lock; +#else assert(lock.owns_lock()); +#endif } inline void assertIsLocked(std::mutex& mtx) { +#ifdef NDEBUG + (void) mtx; +#else assert(!mtx.try_lock()); +#endif } /// Returns the process PSS in KB (works only when we have perms for /proc/pid/smaps). diff --git a/configure.ac b/configure.ac index 650ae281..b04b8ea9 100644 --- a/configure.ac +++ b/configure.ac @@ -246,6 +246,7 @@ AS_IF([test "$enable_ssl" != "no"], [AC_DEFINE([ENABLE_SSL],0,[Whether to enable SSL])]) AM_CONDITIONAL([ENABLE_SSL], [test "$enable_ssl" != "no"]) +AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "true"]) ENABLE_SSL= if test "$enable_ssl" != "no"; then diff --git a/net/clientnb.cpp b/net/clientnb.cpp index 311491e6..d7b75e21 100644 --- a/net/clientnb.cpp +++ b/net/clientnb.cpp @@ -144,7 +144,10 @@ struct ThreadWorker : public Runnable { Session ping(_domain ? _domain : "init", EnableHttps); ping.sendPing(i); - int back = ping.getResponseInt(); +#ifndef NDEBUG + int back = +#endif + ping.getResponseInt(); assert(back == i + 1); } } @@ -209,7 +212,10 @@ struct Client : public Poco::Util::Application ws->sendFrame(&i, sizeof(i), WebSocket::SendFlags::FRAME_BINARY); size_t back[5]; int flags = 0; - int recvd = ws->receiveFrame((void *)back, sizeof(back), flags); +#ifndef NDEBUG + int recvd = +#endif + ws->receiveFrame((void *)back, sizeof(back), flags); assert(recvd == sizeof(size_t)); assert(back[0] == i + 1); } @@ -233,7 +239,10 @@ struct Client : public Poco::Util::Application res.resize(i); int flags; - int recvd = ws->receiveFrame(res.data(), res.size(), flags); +#ifndef NDEBUG + int recvd = +#endif + ws->receiveFrame(res.data(), res.size(), flags); assert(recvd == static_cast<int>(i)); if (i == sizeof(size_t)) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
