<div dir="ltr">Hi Pavel,<br><br><div class="gmail_quote"><div dir="ltr">Il giorno lun 16 lug 2018 alle ore 19:14 Pavel Labath <<a href="mailto:labath@google.com" target="_blank">labath@google.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think all/most systems have open(2) defined as a variadic (...)<br>
function, so that can't be the only reason why this is failing for<br>
you. There must be something more which is specific to your platform.<br>
Nevertheless, the workaround is not bad, so there's no harm in<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">changing this. Some people would even prefer the lambda based syntax.<br></blockquote><div><br></div><div>We are using basically the same Build System/compilers of AOSP, </div><div>it seam that just using clang can produce the error because of behavior different from gcc.</div><div>In some comments in the web behaviors of gcc and clang were described as different.</div><div><br></div><div>If you are also using clang, are you using the clang version with AOSP (8.1.0_r33 at the time of reporting) </div><div>I propose to check in order to identify root cause, then evaluate how to proceed.</div><div><br></div><div>Mauro</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, 8 Jul 2018 at 21:28, Mauro Rossi <<a href="mailto:issor.oruam@gmail.com" target="_blank">issor.oruam@gmail.com</a>> wrote:<br>
><br>
> From: Chih-Wei Huang <<a href="mailto:cwhuang@linux.org.tw" target="_blank">cwhuang@linux.org.tw</a>><br>
><br>
> The ::open() function has unlimited arguments. Seems the compiler can't<br>
> infer the template argument from it:<br>
><br>
> external/llvm70/lib/Support/Unix/Path.inc:770:19: error: no matching function for call to 'RetryAfterSignal'<br>
>   if ((ResultFD = sys::RetryAfterSignal(-1, ::open, P.begin(), OpenFlags, Mode)) <<br>
>                   ^~~~~~~~~~~~~~~~~~~~~<br>
> external/llvm70/lib/Support/../../include/llvm/Support/Errno.h:34:13: note: candidate template ignored: couldn't infer template argument 'Fun'<br>
> inline auto RetryAfterSignal(const FailT &Fail, const Fun &F,<br>
>             ^<br>
> 1 error generated.<br>
><br>
> To avoid that, use a lambda function to wrap the ::open() function.<br>
> ---<br>
>  lib/Support/Unix/Path.inc    | 4 ++--<br>
>  lib/Support/Unix/Process.inc | 2 +-<br>
>  2 files changed, 3 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc<br>
> index b8fea5bda4f..44a8b981c48 100644<br>
> --- a/lib/Support/Unix/Path.inc<br>
> +++ b/lib/Support/Unix/Path.inc<br>
> @@ -766,8 +766,8 @@ std::error_code openFile(const Twine &Name, int &ResultFD,<br>
><br>
>    SmallString<128> Storage;<br>
>    StringRef P = Name.toNullTerminatedStringRef(Storage);<br>
> -  if ((ResultFD = sys::RetryAfterSignal(-1, ::open, P.begin(), OpenFlags, Mode)) <<br>
> -      0)<br>
> +  auto openfun([&] { return ::open(P.begin(), OpenFlags, Mode); });<br>
> +  if ((ResultFD = sys::RetryAfterSignal(-1, openfun)) < 0)<br>
>      return std::error_code(errno, std::generic_category());<br>
>  #ifndef O_CLOEXEC<br>
>    if (!(Flags & OF_ChildInherit)) {<br>
> diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc<br>
> index fa515d44f3f..1111cd2fe2c 100644<br>
> --- a/lib/Support/Unix/Process.inc<br>
> +++ b/lib/Support/Unix/Process.inc<br>
> @@ -211,7 +211,7 @@ std::error_code Process::FixupStandardFileDescriptors() {<br>
>      assert(errno == EBADF && "expected errno to have EBADF at this point!");<br>
><br>
>      if (NullFD < 0) {<br>
> -      if ((NullFD = RetryAfterSignal(-1, ::open, "/dev/null", O_RDWR)) < 0)<br>
> +      if ((NullFD = RetryAfterSignal(-1, [] { return ::open("/dev/null", O_RDWR); })) < 0)<br>
>          return std::error_code(errno, std::generic_category());<br>
>      }<br>
><br>
> --<br>
> 2.17.1<br>
><br>
</blockquote></div></div>