diff options
Diffstat (limited to 'test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp')
-rw-r--r-- | test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index ed25649531b9..cdd177399aa7 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -88,6 +88,16 @@ 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. Also, that +// diagnostic is pretty new, so also don't fail if old clang does not support it +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + bool TestSupportsMaxTime() { using namespace std::chrono; using Lim = std::numeric_limits<std::time_t>; @@ -106,11 +116,25 @@ 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. Also, that +// diagnostic is pretty new, so also don't fail if old clang does not support it +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wunknown-pragmas" +#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 +151,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) |