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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315874 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Lebedev
2017-10-15 20:12:42 +00:00
parent 5384fd8538
commit 0fdc4c9c6b

View File

@@ -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 TimeIsRepresentableByFilesystem(file_time_type tp) {
return true;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
TEST_SUITE(exists_test_suite)
TEST_CASE(signature_test)