RESOLVED FIXED Bug 32675
HTMLInputElement::stepMismatch() uses ambiguous overload of pow()
https://bugs.webkit.org/show_bug.cgi?id=32675
Summary HTMLInputElement::stepMismatch() uses ambiguous overload of pow()
Steve Block
Reported 2009-12-17 11:34:19 PST
HTMLInputElement::stepMismatch() calls pow() with two integer arguments. This causes a compile error due to an ambiguous overload on Android. This was added in http://trac.webkit.org/changeset/51159
Attachments
Patch 1 for Bug 32675 (1.71 KB, patch)
2009-12-17 11:46 PST, Steve Block
no flags
constant fix as recommended by Darin (1.59 KB, patch)
2009-12-17 23:01 PST, Eric Seidel (no email)
no flags
Steve Block
Comment 1 2009-12-17 11:46:57 PST
Created attachment 45099 [details] Patch 1 for Bug 32675 Cast first argument of pow to double to force 'double pow(double, int)'
WebKit Review Bot
Comment 2 2009-12-17 11:49:48 PST
style-queue ran check-webkit-style on attachment 45099 [details] without any errors.
Eric Seidel (no email)
Comment 3 2009-12-17 12:49:48 PST
Comment on attachment 45099 [details] Patch 1 for Bug 32675 This looks OK to me. It would be nice if you could post the error in the bug for posterity, or even in the ChangeLog. It's not clear to me what other signature on Andriod would be causing this error.
Eric Seidel (no email)
Comment 4 2009-12-17 12:51:03 PST
(I CC'd darin adler just because he was one of the primary driving forces behind our MathExtras.h and similar WTF files which deal with x-platform issues similar to this one. I figured he might like to see this go by.)
Steve Block
Comment 5 2009-12-17 14:19:03 PST
The build error is ... external/webkit/WebCore/html/HTMLInputElement.cpp:343: error: call of overloaded 'pow(int, int)' is ambiguous bionic/libm/include/math.h:222: note: candidates are: double pow(double, double) external/webkit/WebKit/android/stlport/stl/_cmath.h:443: note: float pow(float, float) external/webkit/WebKit/android/stlport/stl/_cmath.h:443: note: long double pow(long double, long double) external/webkit/WebKit/android/stlport/stl/_cmath.h:448: note: float pow(float, int) external/webkit/WebKit/android/stlport/stl/_cmath.h:455: note: double pow(double, int) external/webkit/WebKit/android/stlport/stl/_cmath.h:468: note: long double pow(long double, int) The problem is that pow(int, int) isn't defined, nor is it in the c standard or c98.
Eric Seidel (no email)
Comment 6 2009-12-17 14:26:43 PST
We have a pow() in MathExtras: http://trac.webkit.org/browser/trunk/JavaScriptCore/wtf/MathExtras.h We also seem to try hard to avoid use of cmath: http://trac.webkit.org/changeset/13104 http://trac.webkit.org/changeset/11667 http://trac.webkit.org/changeset/12225 And sometimes add it? http://trac.webkit.org/changeset/10511 I'm not convinced this is the right work-around. It would be nice if someone who is more familiar with our historical header troubles could comment.
Eric Seidel (no email)
Comment 7 2009-12-17 14:28:12 PST
Actually, I take that back. This change has nothing really to do with cmath. I think it's still fine.
WebKit Commit Bot
Comment 8 2009-12-17 14:37:26 PST
Comment on attachment 45099 [details] Patch 1 for Bug 32675 Clearing flags on attachment: 45099 Committed r52292: <http://trac.webkit.org/changeset/52292>
WebKit Commit Bot
Comment 9 2009-12-17 14:37:31 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 10 2009-12-17 16:48:12 PST
I would have preferred the use of the constant, 2.0, which is a double rather than writing it as static_cast<double>(2), which seems less elegant to me.
Eric Seidel (no email)
Comment 11 2009-12-17 16:58:45 PST
Bah! Agreed. Clearly i wans't thinking. I'll fix it.
Eric Seidel (no email)
Comment 12 2009-12-17 23:01:43 PST
Created attachment 45126 [details] constant fix as recommended by Darin
Eric Seidel (no email)
Comment 13 2009-12-17 23:08:12 PST
Going to have the commit-queue land this for me to make sure I didn't make any stupid typos. This laptop is too slow to build on.
Eric Seidel (no email)
Comment 14 2009-12-17 23:08:52 PST
Comment on attachment 45126 [details] constant fix as recommended by Darin Make the commit-queue land this. Since I already filled in the reviewer the commit-queue won't get confused by me marking this r+.
mitz
Comment 15 2009-12-17 23:16:31 PST
And since it’s C++, you could also use numeric_limits<double>::digits() instead of DBL_MANT_DIG
WebKit Commit Bot
Comment 16 2009-12-17 23:17:20 PST
Comment on attachment 45126 [details] constant fix as recommended by Darin Clearing flags on attachment: 45126 Committed r52302: <http://trac.webkit.org/changeset/52302>
WebKit Commit Bot
Comment 17 2009-12-17 23:17:26 PST
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 18 2009-12-17 23:45:36 PST
Nifty. I don't actually know what either of those values do. :) But that's OK. That part of this function wasn't touched by either patch. I'm not going to go back and do the limits conversion now, but if I'm ever in that code again I'd be happy to!
Note You need to log in before you can comment on or make changes to this bug.