From fe04a4ec2867959552e0abd8c6cb1741bb06042c Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Fri, 12 Jul 2019 22:25:17 +0000 Subject: [PATCH] [DirectoryWatcher][NFC] Silence warnings in release build git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365968 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../linux/DirectoryWatcher-linux.cpp | 5 ++++- unittests/DirectoryWatcher/DirectoryWatcherTest.cpp | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 87d133f46d..0c9f799b63 100644 --- a/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -55,7 +55,10 @@ struct SemaphorePipe { }; void signal() { - ssize_t Result = llvm::sys::RetryAfterSignal(-1, write, FDWrite, "A", 1); +#ifndef NDEBUG + ssize_t Result = +#endif + llvm::sys::RetryAfterSignal(-1, write, FDWrite, "A", 1); assert(Result != -1); } ~SemaphorePipe() { diff --git a/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp index a2c50fc7d0..0808ff47de 100644 --- a/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ b/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -38,12 +38,18 @@ struct DirectoryWatcherTestFixture { DirectoryWatcherTestFixture() { SmallString<128> pathBuf; - std::error_code UniqDirRes = createUniqueDirectory("dirwatcher", pathBuf); +#ifndef NDEBUG + std::error_code UniqDirRes = +#endif + createUniqueDirectory("dirwatcher", pathBuf); assert(!UniqDirRes); TestRootDir = pathBuf.str(); path::append(pathBuf, "watch"); TestWatchedDir = pathBuf.str(); - std::error_code CreateDirRes = create_directory(TestWatchedDir, false); +#ifndef NDEBUG + std::error_code CreateDirRes = +#endif + create_directory(TestWatchedDir, false); assert(!CreateDirRes); } @@ -415,8 +421,9 @@ TEST(DirectoryWatcherTest, ChangeMetadata) { const int FD = HopefullyTheFD.get(); const TimePoint<> NewTimePt = std::chrono::system_clock::now() - std::chrono::minutes(1); - +#ifndef NDEBUG std::error_code setTimeRes = +#endif llvm::sys::fs::setLastAccessAndModificationTime(FD, NewTimePt, NewTimePt); assert(!setTimeRes); -- 2.40.0