RESOLVED FIXED Bug 27873
[Patch] Fix compile error for ambigous call to abs()
https://bugs.webkit.org/show_bug.cgi?id=27873
Summary [Patch] Fix compile error for ambigous call to abs()
Harald Fernengel
Reported 2009-07-31 03:54:33 PDT
Created attachment 33869 [details] compile fix for ambigous call to abs() DateMath.cpp calls abs(long int) - which is ambiguous in some tool chains, for example on QNX: /home/harald/qt/qt/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp: In function 'double WTF::parseDateFromNullTerminatedCharacters(const char*)': /home/harald/qt/qt/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp:844: error: call of overloaded 'abs(long int&)' is ambiguous /opt/qnx640/target/qnx6///usr/include/stdlib.h:122: note: candidates are: int std::abs(int) /opt/qnx640/target/qnx6///usr/include/math.h:1042: note: long double std::abs(long double) /opt/qnx640/target/qnx6///usr/include/math.h:692: note: float std::abs(float) /opt/qnx640/target/qnx6///usr/include/math.h:624: note: double std::abs(double) make[1]: *** [obj/debug/DateMath.o] Error 1 Patch replaces the abs() call to labs(), which takes a long int and returns a long int. This also removes two implicit casts.
Attachments
compile fix for ambigous call to abs() (1001 bytes, patch)
2009-07-31 03:54 PDT, Harald Fernengel
eric: review-
same patch, but with updated ChangeLog entry (1.02 KB, patch)
2009-08-03 04:35 PDT, Harald Fernengel
abarth: commit-queue+
Darin Adler
Comment 1 2009-07-31 09:33:49 PDT
Comment on attachment 33869 [details] compile fix for ambigous call to abs() Another approach we use for issues like this is to put code in MathExtras.h to work around platform differences. Take a look at MathExtras.h to see what I mean. But this change seems OK. I think the change log is not so good. It says "fix compilation" which is far too vague. The bug mentions the QNX platform and the change log should too. I'm going to say r=me, though, because this seems like a good fix.
Eric Seidel (no email)
Comment 2 2009-07-31 20:54:02 PDT
Comment on attachment 33869 [details] compile fix for ambigous call to abs() Please fix the ChangeLog per Darin's comments.
Harald Fernengel
Comment 3 2009-08-03 04:35:00 PDT
Created attachment 33970 [details] same patch, but with updated ChangeLog entry Updated ChangeLog entry as requested.
Adam Barth
Comment 4 2009-08-03 23:14:41 PDT
Comment on attachment 33970 [details] same patch, but with updated ChangeLog entry Clearing review flag on attachment: 33970 Sending JavaScriptCore/ChangeLog Sending JavaScriptCore/wtf/DateMath.cpp Transmitting file data .. Committed revision 46746. http://trac.webkit.org/changeset/46746
Adam Barth
Comment 5 2009-08-03 23:14:44 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.