diff options
author | Victor Costan <costan@gmail.com> | 2018-08-17 00:19:21 -0700 |
---|---|---|
committer | Victor Costan <costan@gmail.com> | 2018-08-17 00:19:21 -0700 |
commit | fe4bf66fe46a07cd57653bc033c9c03a328c8ed8 (patch) | |
tree | 246724e2173bb88bf55d8594ea7fd33a51e6948c | |
parent | 7fefd231a19a0c9e10273a04204889d138d448b1 (diff) | |
download | snappy-git-fix-warn.tar.gz |
Fix unused member warning in release builds.fix-warn
-rw-r--r-- | snappy.cc | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1048,12 +1048,14 @@ size_t Compress(Source* reader, Sink* writer) { // Writer template argument to SnappyDecompressor::DecompressAllTags(). class SnappyIOVecWriter { private: - const struct iovec* output_iov_; - // output_iov_end_ is set to iov + count and used to determine when // the end of the iovs is reached. const struct iovec* output_iov_end_; +#if !defined(NDEBUG) + const struct iovec* output_iov_; +#endif // !defined(NDEBUG) + // Current iov that is being written into. const struct iovec* curr_iov_; @@ -1077,8 +1079,10 @@ class SnappyIOVecWriter { // Does not take ownership of iov. iov must be valid during the // entire lifetime of the SnappyIOVecWriter. inline SnappyIOVecWriter(const struct iovec* iov, size_t iov_count) - : output_iov_(iov), - output_iov_end_(iov + iov_count), + : output_iov_end_(iov + iov_count), +#if !defined(NDEBUG) + output_iov_(iov), +#endif // !defined(NDEBUG) curr_iov_(iov), curr_iov_output_(iov_count ? reinterpret_cast<char*>(iov->iov_base) : nullptr), @@ -1163,7 +1167,9 @@ class SnappyIOVecWriter { offset -= from_iov_offset; --from_iov; +#if !defined(NDEBUG) assert(from_iov >= output_iov_); +#endif // !defined(NDEBUG) from_iov_offset = from_iov->iov_len; } |