Bug 159124

Summary: [GTK] 2.4.11 fails to build with gcc 6 and glibc 2.23
Product: WebKit Reporter: Alberto Garcia <berto>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: bugs-noreply, mcatanzaro
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   

Description Alberto Garcia 2016-06-26 03:21:52 PDT
../Source/WebCore/platform/gtk/GtkClickCounter.cpp: In member function 'int WebCore::GtkClickCounter::clickCountForGdkButtonEvent(GtkWidget*, GdkEventButton*)':
../Source/WebCore/platform/gtk/GtkClickCounter.cpp:88:59: error: call of overloaded 'abs(gdouble)' is ambiguous
         || ((abs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance)
                                                           ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/stdlib.h:36,
                 from ../Source/WTF/wtf/FastMalloc.h:25,
                 from ../Source/JavaScriptCore/config.h:60,
                 from ../Source/WebCore/platform/gtk/GtkClickCounter.cpp:19:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/c++/6/stdlib.h:36:0,
                 from ../Source/WTF/wtf/FastMalloc.h:25,
                 from ../Source/JavaScriptCore/config.h:60,
                 from ../Source/WebCore/platform/gtk/GtkClickCounter.cpp:19:
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
../Source/WebCore/platform/gtk/GtkClickCounter.cpp:89:62: error: call of overloaded 'abs(gdouble)' is ambiguous
             && (abs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance)
                                                              ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/c++/6/stdlib.h:36,
                 from ../Source/WTF/wtf/FastMalloc.h:25,
                 from ../Source/JavaScriptCore/config.h:60,
                 from ../Source/WebCore/platform/gtk/GtkClickCounter.cpp:19:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/c++/6/stdlib.h:36:0,
                 from ../Source/WTF/wtf/FastMalloc.h:25,
                 from ../Source/JavaScriptCore/config.h:60,
                 from ../Source/WebCore/platform/gtk/GtkClickCounter.cpp:19:
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
GNUmakefile:51931: recipe for target 'Source/WebCore/platform/gtk/libPlatformGtk_la-GtkClickCounter.lo' failed
make[2]: *** [Source/WebCore/platform/gtk/libPlatformGtk_la-GtkClickCounter.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
Comment 1 Michael Catanzaro 2016-06-26 08:52:02 PDT
Fedora patch:

diff -Nur webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/GtkClickCounter.cpp webkitgtk-2.4.9/Source/WebCore/platform/gtk/GtkClickCounter.cpp
--- webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/GtkClickCounter.cpp	2015-05-20 03:03:24.000000000 -0600
+++ webkitgtk-2.4.9/Source/WebCore/platform/gtk/GtkClickCounter.cpp	2016-02-07 11:30:42.392686308 -0700
@@ -85,8 +85,8 @@
     guint32 eventTime = getEventTime(event);
 
     if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
-        || ((abs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance)
-            && (abs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance)
+        || ((fabs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance)
+            && (fabs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance)
             && (eventTime - m_previousClickTime < static_cast<guint>(doubleClickTime))
             && (buttonEvent->button == m_previousClickButton)))
         m_currentClickCount++;
diff -Nur webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp webkitgtk-2.4.9/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp
--- webkitgtk-2.4.9.orig/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp	2015-05-20 03:03:24.000000000 -0600
+++ webkitgtk-2.4.9/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp	2016-02-07 11:49:36.384691005 -0700
@@ -659,7 +659,7 @@
     if (!std::isfinite(time))
         return String::fromUTF8(_("indefinite time"));
 
-    int seconds = static_cast<int>(abs(time));
+    int seconds = static_cast<int>(fabs(time));
     int days = seconds / (60 * 60 * 24);
     int hours = seconds / (60 * 60);
     int minutes = (seconds / 60) % 60;
Comment 2 Alberto Garcia 2016-06-26 10:47:48 PDT
(In reply to comment #1)
> Fedora patch:

It works fine, thanks!