[libcxx] r315874 - Silence clang's -Wtautological-constant-compare in last_write_time.pass.cpp
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 15 13:12:42 PDT 2017
Author: lebedevri
Date: Sun Oct 15 13:12:42 2017
New Revision: 315874
URL: http://llvm.org/viewvc/llvm-project?rev=315874&view=rev
Log:
Silence clang's -Wtautological-constant-compare in last_write_time.pass.cpp
Previously this broke the builders, when D38101 was committed.
Silence the warning so that it can be re-landed.
Modified:
libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp?rev=315874&r1=315873&r2=315874&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Sun Oct 15 13:12:42 2017
@@ -88,6 +88,13 @@ bool TestSupportsNegativeTimes() {
return !ec && new_write_time <= -5;
}
+// In some configurations, the comparison is tautological and the test is valid.
+// We disable the warning so that we can actually test it regardless.
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-constant-compare"
+#endif
+
bool TestSupportsMaxTime() {
using namespace std::chrono;
using Lim = std::numeric_limits<std::time_t>;
@@ -106,11 +113,22 @@ bool TestSupportsMaxTime() {
return !ec && new_write_time > max_sec - 1;
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
static const bool SupportsNegativeTimes = TestSupportsNegativeTimes();
static const bool SupportsMaxTime = TestSupportsMaxTime();
} // end namespace
+// In some configurations, the comparison is tautological and the test is valid.
+// We disable the warning so that we can actually test it regardless.
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-constant-compare"
+#endif
+
// Check if a time point is representable on a given filesystem. Check that:
// (A) 'tp' is representable as a time_t
// (B) 'tp' is non-negative or the filesystem supports negative times.
@@ -127,6 +145,10 @@ inline bool TimeIsRepresentableByFilesys
return true;
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
TEST_SUITE(exists_test_suite)
TEST_CASE(signature_test)
More information about the cfe-commits
mailing list