r365968 - [DirectoryWatcher][NFC] Silence warnings in release build

Jan Korous via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 15:25:17 PDT 2019


Author: jkorous
Date: Fri Jul 12 15:25:17 2019
New Revision: 365968

URL: http://llvm.org/viewvc/llvm-project?rev=365968&view=rev
Log:
[DirectoryWatcher][NFC] Silence warnings in release build

Modified:
    cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
    cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=365968&r1=365967&r2=365968&view=diff
==============================================================================
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Fri Jul 12 15:25:17 2019
@@ -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() {

Modified: cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp?rev=365968&r1=365967&r2=365968&view=diff
==============================================================================
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp (original)
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp Fri Jul 12 15:25:17 2019
@@ -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, ChangeMetadat
     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);




More information about the cfe-commits mailing list