[llvm-branch-commits] [llvm-branch] r341044 - Merging r340751:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 30 02:31:53 PDT 2018


Author: hans
Date: Thu Aug 30 02:31:52 2018
New Revision: 341044

URL: http://llvm.org/viewvc/llvm-project?rev=341044&view=rev
Log:
Merging r340751:
------------------------------------------------------------------------
r340751 | hans | 2018-08-27 17:55:39 +0200 (Mon, 27 Aug 2018) | 7 lines

Use a lambda for calls to ::open in RetryAfterSignal

In Bionic, open can be overloaded for _FORTIFY_SOURCE support, causing
compile errors of RetryAfterSignal due to overload resolution. Wrapping
the call in a lambda avoids this.

Based on a patch by Chih-Wei Huang <cwhuang at linux.org.tw>!
------------------------------------------------------------------------

Modified:
    llvm/branches/release_70/   (props changed)
    llvm/branches/release_70/lib/Support/Unix/Path.inc
    llvm/branches/release_70/lib/Support/Unix/Process.inc

Propchange: llvm/branches/release_70/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 30 02:31:52 2018
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,338552,338554,338569,338599,338610,338658,338665,338682,338703,338709,338716,338751,338762,338817,338841,338902,338915,338968,339073,339091,339166,339179,339184,339190,339225,339316,339319,339411,339492,339515,339533,339535-339536,339600,339636,339674,339769,339822,339883,339895-339896,339945,340158,340303,340416-340417,340455,340641,340691,340820,340839
+/llvm/trunk:155241,338552,338554,338569,338599,338610,338658,338665,338682,338703,338709,338716,338751,338762,338817,338841,338902,338915,338968,339073,339091,339166,339179,339184,339190,339225,339316,339319,339411,339492,339515,339533,339535-339536,339600,339636,339674,339769,339822,339883,339895-339896,339945,340158,340303,340416-340417,340455,340641,340691,340751,340820,340839

Modified: llvm/branches/release_70/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_70/lib/Support/Unix/Path.inc?rev=341044&r1=341043&r2=341044&view=diff
==============================================================================
--- llvm/branches/release_70/lib/Support/Unix/Path.inc (original)
+++ llvm/branches/release_70/lib/Support/Unix/Path.inc Thu Aug 30 02:31:52 2018
@@ -769,8 +769,10 @@ std::error_code openFile(const Twine &Na
 
   SmallString<128> Storage;
   StringRef P = Name.toNullTerminatedStringRef(Storage);
-  if ((ResultFD = sys::RetryAfterSignal(-1, ::open, P.begin(), OpenFlags, Mode)) <
-      0)
+  // Call ::open in a lambda to avoid overload resolution in RetryAfterSignal
+  // when open is overloaded, such as in Bionic.
+  auto Open = [&]() { return ::open(P.begin(), OpenFlags, Mode); };
+  if ((ResultFD = sys::RetryAfterSignal(-1, Open)) < 0)
     return std::error_code(errno, std::generic_category());
 #ifndef O_CLOEXEC
   if (!(Flags & OF_ChildInherit)) {

Modified: llvm/branches/release_70/lib/Support/Unix/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_70/lib/Support/Unix/Process.inc?rev=341044&r1=341043&r2=341044&view=diff
==============================================================================
--- llvm/branches/release_70/lib/Support/Unix/Process.inc (original)
+++ llvm/branches/release_70/lib/Support/Unix/Process.inc Thu Aug 30 02:31:52 2018
@@ -211,7 +211,10 @@ std::error_code Process::FixupStandardFi
     assert(errno == EBADF && "expected errno to have EBADF at this point!");
 
     if (NullFD < 0) {
-      if ((NullFD = RetryAfterSignal(-1, ::open, "/dev/null", O_RDWR)) < 0)
+      // Call ::open in a lambda to avoid overload resolution in
+      // RetryAfterSignal when open is overloaded, such as in Bionic.
+      auto Open = [&]() { return ::open("/dev/null", O_RDWR); };
+      if ((NullFD = RetryAfterSignal(-1, Open)) < 0)
         return std::error_code(errno, std::generic_category());
     }
 




More information about the llvm-branch-commits mailing list