RESOLVED FIXED 73563
use NOMINMAX instead of #define min min
https://bugs.webkit.org/show_bug.cgi?id=73563
Summary use NOMINMAX instead of #define min min
Paul
Reported 2011-12-01 07:45:09 PST
This is a patch from my code. I'm working with QT 4.7.4, but I've checked webkit's code on the trunk via trac's Source Browse and I see the problem still exists. Instead of using #define min min and #define max max, to avoid problems with windef.h just use #define NOMINMAX This is actually what is done in wtf/Platform.h although I think that only applies for WINCE. === modified file 'qt/src/3rdparty/javascriptcore/JavaScriptCore/config.h' --- qt/src/3rdparty/javascriptcore/JavaScriptCore/config.h 2011-10-08 14:07:42 +0000 +++ qt/src/3rdparty/javascriptcore/JavaScriptCore/config.h 2011-12-01 15:14:46 +0000 @@ -41,8 +41,7 @@ // If we don't define these, they get defined in windef.h. // We want to use std::min and std::max -#define max max -#define min min +#define NOMINMAX /* Windows min and max conflict with standard macros */ #if !COMPILER(MSVC7) && !OS(WINCE) // We need to define this before the first #include of stdlib.h or it won't contain rand_s.
Attachments
Patch (6.32 KB, patch)
2011-12-04 18:01 PST, Paul
no flags
Patch (13.25 KB, patch)
2013-09-20 14:30 PDT, Patrick R. Gansterer
no flags
Patch (13.28 KB, patch)
2013-09-20 14:50 PDT, Patrick R. Gansterer
no flags
Alexey Proskuryakov
Comment 1 2011-12-01 11:51:11 PST
Would you be willing to submit a patch, as described in <http://www.webkit.org/coding/contributing.html>? Please correct the comment above, too.
Paul
Comment 2 2011-12-04 18:01:59 PST
Paul
Comment 3 2011-12-04 18:05:44 PST
Uploaded patch that adjusts 5 header files to declare NOMINMAX instead of using the trick #define min min This is the more correct way of dealing with windef.h's #define min/max issue on the windows platform. I have not tested it, as I am not set up to build Webkit, sorry. If I need to make more significant changes in the future then I'll go through that process. Also, I'm not sure how to edit previously made comments.
WebKit Review Bot
Comment 4 2011-12-04 20:00:05 PST
Comment on attachment 117817 [details] Patch Attachment 117817 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10729611 New failing tests: svg/custom/linking-uri-01-b.svg
Paul
Comment 5 2011-12-04 20:06:49 PST
I don't see how my patch could've generated an image mismatch in the test suite, I can only assume it was broken before the patch was applied... can that be the case?
Julien Chaffraix
Comment 6 2011-12-05 17:00:54 PST
> I can only assume it was broken before the patch was applied... can that be the case? It's a flaky test (cf webkit-dev) and is likely not your wrong doing.
Adam Roben (:aroben)
Comment 7 2011-12-06 06:36:24 PST
Comment on attachment 117817 [details] Patch I agree this is better than #define min min! I think an even better way to do this these days would be to put this in WebKitLibraries/win/tools/vsprops/common.vsprops. All projects inherit settings from there.
Patrick R. Gansterer
Comment 8 2013-09-20 14:30:11 PDT
Early Warning System Bot
Comment 9 2013-09-20 14:44:50 PDT
Early Warning System Bot
Comment 10 2013-09-20 14:47:57 PDT
Patrick R. Gansterer
Comment 11 2013-09-20 14:50:07 PDT
Brent Fulgham
Comment 12 2013-09-23 15:09:03 PDT
Comment on attachment 212221 [details] Patch This looks good. I wish the EWS had been working when you filed the bug, but I don't see any obvious reason for this to fail. Let's land it and I'll roll it out if there is any build problem.
Patrick R. Gansterer
Comment 13 2013-09-23 15:24:36 PDT
Comment on attachment 212221 [details] Patch Clearing flags on attachment: 212221 Committed r156302: <http://trac.webkit.org/changeset/156302>
Patrick R. Gansterer
Comment 14 2013-09-23 15:24:43 PDT
All reviewed patches have been landed. Closing bug.
Patrick R. Gansterer
Comment 15 2013-10-30 15:17:19 PDT
*** Bug 109161 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.