RESOLVED DUPLICATE of bug 172144 172081
[Win] Correct OS(WINDOWS) and PLATFORM(WIN) compiler guards
https://bugs.webkit.org/show_bug.cgi?id=172081
Summary [Win] Correct OS(WINDOWS) and PLATFORM(WIN) compiler guards
Daewoong Jang
Reported 2017-05-13 18:50:24 PDT
Corrects mixed use of OS(WINDOWS) and PLATFORM(WIN) compiler guards. Most of lines within PLATFORM(WIN) guards in JavaScriptCore are actually OS-dependent implementation and can cause runtime errors if the module was built for Windows without PLATFORM(WIN) compiler flag enabled.
Attachments
Patch (5.79 KB, patch)
2017-05-13 18:54 PDT, Daewoong Jang
no flags
Patch (4.57 KB, patch)
2017-05-13 19:03 PDT, Daewoong Jang
mark.lam: review-
Daewoong Jang
Comment 1 2017-05-13 18:54:43 PDT
Daewoong Jang
Comment 2 2017-05-13 19:03:20 PDT
Mark Lam
Comment 3 2017-05-13 20:33:25 PDT
Comment on attachment 310048 [details] Patch r- because ... According to Platform.h: ... #elif OS(WINDOWS) #define WTF_PLATFORM_WIN 1 #endif Hence, if OS(WINDOWS), then PLATFORM(WIN) is always true. The 2 are always tied together it seems. So, why is that not sufficient?
Daewoong Jang
Comment 4 2017-05-13 21:01:59 PDT
(In reply to Mark Lam from comment #3) > Comment on attachment 310048 [details] > Patch > > r- because ... > > According to Platform.h: > ... > #elif OS(WINDOWS) > #define WTF_PLATFORM_WIN 1 > #endif > > Hence, if OS(WINDOWS), then PLATFORM(WIN) is always true. The 2 are always > tied together it seems. So, why is that not sufficient? It is not sufficient when building on Windows with PLATFORM(WIN) turned off(by adding #undef WTF_PLATFORM_WIN to Platform.h) to avoid using Windows platform features. I agree that this changes are unnecessary as there are only AppleWin and WinCairo ports, but I believe the lines guarded by PLATFORM(WIN) are actually OS-dependent and it would be good to correct them. So I appreciate if these changes accepted if they are not wrong and harmful.
Mark Lam
Comment 5 2017-05-13 21:21:02 PDT
(In reply to Daewoong Jang from comment #4) > (In reply to Mark Lam from comment #3) > > Comment on attachment 310048 [details] > > Patch > > > > r- because ... > > > > According to Platform.h: > > ... > > #elif OS(WINDOWS) > > #define WTF_PLATFORM_WIN 1 > > #endif > > > > Hence, if OS(WINDOWS), then PLATFORM(WIN) is always true. The 2 are always > > tied together it seems. So, why is that not sufficient? > > It is not sufficient when building on Windows with PLATFORM(WIN) turned > off(by adding #undef WTF_PLATFORM_WIN to Platform.h) to avoid using Windows > platform features. > > I agree that this changes are unnecessary as there are only AppleWin and > WinCairo ports, but I believe the lines guarded by PLATFORM(WIN) are > actually OS-dependent and it would be good to correct them. > > So I appreciate if these changes accepted if they are not wrong and harmful. I understand that you're trying to use OS(WINDOWS) without PLATFORM(WIN). However, I don't understand why one would want to build for Windows and yet not use the Windows platform. Can you clarify what the difference is, and what use case you are thinking of i.e. why does it make sense to have OS(WINDOWS) without PLATFORM(WIN)? I may be ignorant about this, but to me, OS(WINDOWS) is synonymous with PLATFORM(WIN), but obviously, you don't think the 2 are the same. As a result, I'm not quite sure if it is wrong to reclassify the code as belonging to OS(WINDOWS) vs PLATFORM(WIN). Clarifying the difference may make a stronger case for your change. I'm also cc'ing some other folks who know Windows better. They might be able to judge this better. Thanks.
Daewoong Jang
Comment 6 2017-05-13 21:30:02 PDT
(In reply to Mark Lam from comment #5) > (In reply to Daewoong Jang from comment #4) > > (In reply to Mark Lam from comment #3) > > > Comment on attachment 310048 [details] > > > Patch > > > > > > r- because ... > > > > > > According to Platform.h: > > > ... > > > #elif OS(WINDOWS) > > > #define WTF_PLATFORM_WIN 1 > > > #endif > > > > > > Hence, if OS(WINDOWS), then PLATFORM(WIN) is always true. The 2 are always > > > tied together it seems. So, why is that not sufficient? > > > > It is not sufficient when building on Windows with PLATFORM(WIN) turned > > off(by adding #undef WTF_PLATFORM_WIN to Platform.h) to avoid using Windows > > platform features. > > > > I agree that this changes are unnecessary as there are only AppleWin and > > WinCairo ports, but I believe the lines guarded by PLATFORM(WIN) are > > actually OS-dependent and it would be good to correct them. > > > > So I appreciate if these changes accepted if they are not wrong and harmful. > > I understand that you're trying to use OS(WINDOWS) without PLATFORM(WIN). > However, I don't understand why one would want to build for Windows and yet > not use the Windows platform. Can you clarify what the difference is, and > what use case you are thinking of i.e. why does it make sense to have > OS(WINDOWS) without PLATFORM(WIN)? I may be ignorant about this, but to me, > OS(WINDOWS) is synonymous with PLATFORM(WIN), but obviously, you don't think > the 2 are the same. As a result, I'm not quite sure if it is wrong to > reclassify the code as belonging to OS(WINDOWS) vs PLATFORM(WIN). > Clarifying the difference may make a stronger case for your change. > > I'm also cc'ing some other folks who know Windows better. They might be > able to judge this better. Thanks. Thank you for your kind reply. Currently I'm working on a WebKit-based project and in the project Windows binaries are being built on some kind of POSIX emulation layer. This is why I remove WTF_PLATFORM_WIN flag. Thank you.
Daewoong Jang
Comment 7 2017-06-08 21:47:51 PDT
*** This bug has been marked as a duplicate of bug 172144 ***
Note You need to log in before you can comment on or make changes to this bug.