RESOLVED INVALID 88313
[Qt][Win] Fix build fails because of min/max macros and std::numeric_limits<*>::min/max() clashing
https://bugs.webkit.org/show_bug.cgi?id=88313
Summary [Qt][Win] Fix build fails because of min/max macros and std::numeric_limits<*...
Csaba Osztrogonác
Reported 2012-06-05 01:37:56 PDT
qwebframe.cpp, ... doesn't build because of this problem.
Attachments
Patch (1.18 KB, patch)
2012-06-05 08:53 PDT, Csaba Osztrogonác
no flags
Patch (1.19 KB, patch)
2012-06-05 09:07 PDT, Csaba Osztrogonác
no flags
Patch (3.39 KB, patch)
2012-06-07 09:08 PDT, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2012-06-05 08:53:48 PDT
Csaba Osztrogonác
Comment 2 2012-06-05 09:07:08 PDT
Created attachment 145813 [details] Patch Typo fixed. Thanks GTK EWS. :)
Simon Hausmann
Comment 3 2012-06-05 14:22:32 PDT
Comment on attachment 145813 [details] Patch This is like a sledge-hammer :). Is it perhaps cleaner to do NOMINMAX only in those .cpp files where the clash occurs? That seems to be the more common solution and I think preferred if for example it only happens in qwebframe.cpp.
Csaba Osztrogonác
Comment 4 2012-06-07 05:29:34 PDT
(In reply to comment #3) > (From update of attachment 145813 [details]) > This is like a sledge-hammer :). Is it perhaps cleaner to do NOMINMAX only in those .cpp files where the clash occurs? That seems to be the more common solution and I think preferred if for example it only happens in qwebframe.cpp. :) As far as I remember we need this for 5-10 files not only one. Let me check how many files need it.
Csaba Osztrogonác
Comment 5 2012-06-07 08:52:28 PDT
problematic source files: - Source/WebKit/qt/Api/qwebview.cpp - Source/WebKit/qt/Api/gqraphicswebview.cpp - Source/WebKit/qt/Api/qwebpage.cpp - Source/WebKit/qt/Api/qwebhistory.cpp - Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp Patch is coming soon.
Csaba Osztrogonác
Comment 6 2012-06-07 09:08:17 PDT
Created attachment 146300 [details] Patch Add NOMINMAX only to problematic sources instead of using sledgehammer :)
Balazs Kelemen
Comment 7 2012-06-08 08:45:35 PDT
(In reply to comment #6) > Created an attachment (id=146300) [details] > Patch > > Add NOMINMAX only to problematic sources instead of using sledgehammer :) In most parts of the project we already use the sledgehammer approach. In config.h's you can find this - under #if OS(WINDOWS) // If we don't define these, they get defined in windef.h. // We want to use std::min and std::max. #ifndef max #define max max #endif #ifndef min #define min min #endif What I don't know is that which config.h is used in Source/WebKit/qt and why it does not have this. Furthermore, adding NOMINMAX seems more elegant than this ifdef hackery but I'm not sure it would work on every platform. I favor fixing it in the appropriate config.h for consistency.
Jocelyn Turcotte
Comment 8 2012-06-11 12:13:51 PDT
WebCore/config.h is used by WebKit/qt. We "#define max max" correctly in config.h but the problem is that qdatetime.h does "#undef max" before WinDef.h gets included. How the hell did this end up in a public Qt header...
Simon Hausmann
Comment 9 2012-06-11 12:22:53 PDT
(In reply to comment #8) > WebCore/config.h is used by WebKit/qt. > > We "#define max max" correctly in config.h but the problem is that qdatetime.h does "#undef max" before WinDef.h gets included. > > How the hell did this end up in a public Qt header... Well spotted!! And pretty recently changed, too: https://codereview.qt-project.org/#change,13166 The header file uses std::min/max in an inline function, but yeah, the fix is there IMHO.
Simon Hausmann
Comment 10 2012-06-12 01:19:31 PDT
Work in progress at https://codereview.qt-project.org/#change,28549 - If we can't get that into Qt, then we have to change the existing workaround in WebKit to use NOMINMAX instead of #define min min/max max
Csaba Osztrogonác
Comment 11 2012-06-12 06:25:05 PDT
(In reply to comment #10) > Work in progress at https://codereview.qt-project.org/#change,28549 - If we can't get that into Qt, then we have to change the existing workaround in WebKit to use NOMINMAX instead of #define min min/max max I tried it, it works for me without workaround for WebKit. ;-)
Simon Hausmann
Comment 12 2012-06-13 08:17:47 PDT
(In reply to comment #11) > (In reply to comment #10) > > Work in progress at https://codereview.qt-project.org/#change,28549 - If we can't get that into Qt, then we have to change the existing workaround in WebKit to use NOMINMAX instead of #define min min/max max > > I tried it, it works for me without workaround for WebKit. ;-) Great. The change is slowly making its way into Qt. Most of the submodules are patched already and the qtbase change is staged (after the n-th try :) Let's close this as INVALID then, because the root cause for this bug is an upstream issue that disabled the existing workaround.
Simon Hausmann
Comment 13 2012-06-13 08:18:17 PDT
Comment on attachment 146300 [details] Patch Clearing review
Note You need to log in before you can comment on or make changes to this bug.