From efd57a8aeceda4191348c15fb95502f496ea6a00 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 22 Jun 2017 14:18:55 +0000 Subject: Revert "[Support] Add RetryAfterSignal helper function" and subsequent fix The fix in r306003 uncovered a pretty fundamental problem that libc++ implementation of std::result_of does not handle the prototype of open(2) correctly (presumably because it contains ...). This makes the whole function unusable in its current form, so I am also reverting the original commit (r305892), which introduced the function, at least until I figure out a way to solve the libc++ issue. llvm-svn: 306005 --- llvm/unittests/Support/ErrnoTest.cpp | 38 ------------------------------------ 1 file changed, 38 deletions(-) delete mode 100644 llvm/unittests/Support/ErrnoTest.cpp (limited to 'llvm/unittests/Support/ErrnoTest.cpp') diff --git a/llvm/unittests/Support/ErrnoTest.cpp b/llvm/unittests/Support/ErrnoTest.cpp deleted file mode 100644 index 888c162822d..00000000000 --- a/llvm/unittests/Support/ErrnoTest.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===- ErrnoTest.cpp - Error handling unit tests --------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Support/Errno.h" -#include "gtest/gtest.h" - -using namespace llvm::sys; - -static int *ReturnPointer() { return new int(47); } - -TEST(ErrnoTest, RetryAfterSignal) { - EXPECT_EQ(1, RetryAfterSignal(-1, [] { return 1; })); - - EXPECT_EQ(-1, RetryAfterSignal(-1, [] { - errno = EAGAIN; - return -1; - })); - EXPECT_EQ(EAGAIN, errno); - - unsigned calls = 0; - EXPECT_EQ(1, RetryAfterSignal(-1, [&calls] { - errno = EINTR; - ++calls; - return calls == 1 ? -1 : 1; - })); - EXPECT_EQ(2u, calls); - - EXPECT_EQ(1, RetryAfterSignal(-1, [](int x) { return x; }, 1)); - - std::unique_ptr P{RetryAfterSignal(nullptr, ReturnPointer)}; - EXPECT_EQ(47, *P); -} -- cgit v1.2.3