Bug 207757

Summary: [GStreamer] Build failure with Clang/libc++ due to missing WallTime→float for std::isnan()
Product: WebKit Reporter: Adrian Perez <aperez>
Component: Tools / TestsAssignee: Adrian Perez <aperez>
Status: RESOLVED FIXED    
Severity: Normal CC: calvaris, cgarcia, commit-queue, ews-watchlist, gustavo, menard, pnormand, vjaquez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Adrian Perez 2020-02-14 04:44:38 PST
WPE WebKit 2.27.90 (and most surely the GTK port as well) fail to build with
Clang when using libc++ (instead of GNU stdlibc++).

Configuration command:

  CC=clang CXX=clang++ \
  LDFLAGS='-stdlib=libc++ -fuse-ld=lld' \
  CXXLAGS='-stdlib=libc++' \
  cmake -DPORT=WPE -DUSE_LD_GOLD=OFF -DUSE_LD_LLD=ON <...>

Build error:

  ../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:1155:10: error: no matching function for call to 'isnan'
      if (!isnan(priv->downloadStartTime)) {
           ^~~~~
  /usr/bin/../include/c++/v1/math.h:535:1: note: candidate function not viable: no known conversion from 'WTF::WallTime' to 'float' for 1st argument
  isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  ^
  /usr/bin/../include/c++/v1/math.h:539:1: note: candidate function not viable: no known conversion from 'WTF::WallTime' to 'double' for 1st argument
  isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  ^
  /usr/bin/../include/c++/v1/math.h:543:1: note: candidate function not viable: no known conversion from 'WTF::WallTime' to 'long double' for 1st argument
  isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  ^
  /usr/bin/../include/c++/v1/math.h:521:1: note: candidate template ignored: requirement 'std::is_floating_point<WTF::WallTime>::value' was not satisfied [with _A1 = WTF::WallTime]
  isnan(_A1 __lcpp_x) _NOEXCEPT
  ^
  /usr/bin/../include/c++/v1/math.h:529:1: note: candidate template ignored: requirement 'std::is_integral<WTF::WallTime>::value' was not satisfied [with _A1 = WTF::WallTime]
  isnan(_A1) _NOEXCEPT
  ^
  1 error generated.
Comment 1 Adrian Perez 2020-02-15 05:13:01 PST
This happens in trunk as well. There are “std::isnan()” overloads
defined for “WTF::Walltime”, but Clang is being a bit more strict
than GCC here and not considering them when using a bare “isnan()“
call (without the namespace) because the overloaded version is
inside the namespace, and there us no “using std::isnan;” (or
equivalent) anywhere when non-unified builds are disabled.

The fix is to add the “std::” namespace prefix to the function
call =)
Comment 2 Adrian Perez 2020-02-15 05:16:42 PST
Created attachment 390864 [details]
Patch
Comment 3 Adrian Perez 2020-02-15 14:20:38 PST
Comment on attachment 390864 [details]
Patch

Clearing flags on attachment: 390864

Committed r256706: <https://trac.webkit.org/changeset/256706>
Comment 4 Adrian Perez 2020-02-15 14:20:43 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2020-02-15 14:21:17 PST
<rdar://problem/59488736>