RESOLVED FIXED 162302
[GTK] webkit-gtk-2.14.0 build failure of ScrollbarThemeGtk with libc++
https://bugs.webkit.org/show_bug.cgi?id=162302
Summary [GTK] webkit-gtk-2.14.0 build failure of ScrollbarThemeGtk with libc++
Jeremy Huddleston Sequoia
Reported 2016-09-20 10:43:10 PDT
2.14.0 fails to build with the following error using clang+libc++ on darwin: webkitgtk-2.14.0/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp:547:35: error: call to 'abs' is ambiguous contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0); ^~~~~~~~ ../include/c++/v1/cmath:664:1: note: candidate function abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} ^ ../include/c++/v1/cmath:668:1: note: candidate function abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);} ^ ../include/c++/v1/cmath:672:1: note: candidate function abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} ^ webkitgtk-2.14.0/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp:552:34: error: call to 'abs' is ambiguous contentsRect.move(0, std::abs(rect.height() - preferredSize.height())); ^~~~~~~~ ../include/c++/v1/cmath:664:1: note: candidate function abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);} ^ ../include/c++/v1/cmath:668:1: note: candidate function abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);} ^ ../include/c++/v1/cmath:672:1: note: candidate function abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);} ^ 2 errors generated. Casting the call site to (double) addresses the issue.
Attachments
0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc (2.34 KB, patch)
2016-09-20 10:52 PDT, Jeremy Huddleston Sequoia
no flags
0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc (2.31 KB, patch)
2016-09-20 11:10 PDT, Jeremy Huddleston Sequoia
cgarcia: review-
mcatanzaro: commit-queue-
0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc (1.63 KB, patch)
2016-09-21 00:36 PDT, Jeremy Huddleston Sequoia
no flags
Jeremy Huddleston Sequoia
Comment 1 2016-09-20 10:52:06 PDT
Created attachment 289382 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc
WebKit Commit Bot
Comment 2 2016-09-20 10:54:29 PDT
Attachment 289382 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jeremy Huddleston Sequoia
Comment 3 2016-09-20 11:10:45 PDT
Created attachment 289387 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc
Alex Christensen
Comment 4 2016-09-20 11:50:05 PDT
Comment on attachment 289387 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc If such a cast is needed, please use static_cast instead of a c-style cast.
Michael Catanzaro
Comment 5 2016-09-20 12:29:04 PDT
Comment on attachment 289387 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc Yes, as Alex said.
Carlos Garcia Campos
Comment 6 2016-09-20 23:13:30 PDT
Comment on attachment 289387 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc View in context: https://bugs.webkit.org/attachment.cgi?id=289387&action=review > Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp:547 > - contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0); > + contentsRect.move(std::abs((double)(rect.width() - preferredSize.width())), 0); I think it would be cleaner to cast the result of abs, because both rect and preferredSize are ints, instead of using the abs overload for floats with integers, we could use the int one and cast the result. Another way to disambiguate this could be using std::fabs, adn then we don't need any ugly cast.
Jeremy Huddleston Sequoia
Comment 7 2016-09-20 23:39:26 PDT
Oh, I wonder if it's not picking up the integral std::abs() because of a missing #include <cstdlib>. Giving that a try.
Jeremy Huddleston Sequoia
Comment 8 2016-09-21 00:36:43 PDT
Created attachment 289435 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc Yep, changed patch to include <cstdlib>, so the integer versions are available.
WebKit Commit Bot
Comment 9 2016-09-21 02:51:05 PDT
Comment on attachment 289435 [details] 0002-GTK-Fix-build-failure-of-ScrollbarThemeGtk-with-libc Clearing flags on attachment: 289435 Committed r206205: <http://trac.webkit.org/changeset/206205>
WebKit Commit Bot
Comment 10 2016-09-21 02:51:09 PDT
All reviewed patches have been landed. Closing bug.
Michael Catanzaro
Comment 11 2016-09-21 06:24:10 PDT
(In reply to comment #7) > Oh, I wonder if it's not picking up the integral std::abs() because of a > missing #include <cstdlib>. Giving that a try. Ugh, let's remember to check for this whenever we see a patch that changes std::abs. It's not the first time this has been an issue, but I forgot.
Note You need to log in before you can comment on or make changes to this bug.