Title: [239093] trunk/Source/WTF
Revision
239093
Author
hironori.fu...@sony.com
Date
2018-12-11 17:34:05 -0800 (Tue, 11 Dec 2018)

Log Message

[Win][Clang] Fix compilation warnings of WTF
https://bugs.webkit.org/show_bug.cgi?id=192583

Reviewed by Alex Christensen.

clang-cl reports the following warnings.

> [92/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\StackBounds.cpp.obj
> ..\..\Source\WTF\wtf\StackBounds.cpp(163,48):  warning: missing field 'AllocationBase' initializer [-Wmissing-field-initializers]
>     MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
>                                                ^
> 1 warning generated.
> [160/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\win\RunLoopWin.cpp.obj
> ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(34,54):  warning: ISO C++11 does not allow conversion from string literal to 'const LPWSTR' (aka 'wchar_t *const') [-Wwritable-strings]
> static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
>                                                      ^
> ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(86,32):  warning: missing field 'lpfnWndProc' initializer [-Wmissing-field-initializers]
>     WNDCLASS windowClass = { 0 };
>                                ^
> 2 warnings generated.
> [175/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\DateMath.cpp.obj
> ..\..\Source\WTF\wtf\DateMath.cpp(125,20):  warning: unused function 'getLocalTime' [-Wunused-function]
> static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
>                    ^
> 1 warning generated.

* wtf/DateMath.cpp:
(WTF::getLocalTime): Defined only if used.
* wtf/StackBounds.cpp:
(WTF::StackBounds::currentThreadStackBoundsInternal): Initialize stackOrigin with '{ }'.
* wtf/win/RunLoopWin.cpp: Change the type of kRunLoopMessageWindowClassName to LPCWSTR.
(WTF::RunLoop::registerRunLoopMessageWindowClass): Initialize windowClass with '{ }'.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (239092 => 239093)


--- trunk/Source/WTF/ChangeLog	2018-12-12 01:15:55 UTC (rev 239092)
+++ trunk/Source/WTF/ChangeLog	2018-12-12 01:34:05 UTC (rev 239093)
@@ -1,3 +1,38 @@
+2018-12-11  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [Win][Clang] Fix compilation warnings of WTF
+        https://bugs.webkit.org/show_bug.cgi?id=192583
+
+        Reviewed by Alex Christensen.
+
+        clang-cl reports the following warnings.
+
+        > [92/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\StackBounds.cpp.obj
+        > ..\..\Source\WTF\wtf\StackBounds.cpp(163,48):  warning: missing field 'AllocationBase' initializer [-Wmissing-field-initializers]
+        >     MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
+        >                                                ^
+        > 1 warning generated.
+        > [160/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\win\RunLoopWin.cpp.obj
+        > ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(34,54):  warning: ISO C++11 does not allow conversion from string literal to 'const LPWSTR' (aka 'wchar_t *const') [-Wwritable-strings]
+        > static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
+        >                                                      ^
+        > ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(86,32):  warning: missing field 'lpfnWndProc' initializer [-Wmissing-field-initializers]
+        >     WNDCLASS windowClass = { 0 };
+        >                                ^
+        > 2 warnings generated.
+        > [175/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\DateMath.cpp.obj
+        > ..\..\Source\WTF\wtf\DateMath.cpp(125,20):  warning: unused function 'getLocalTime' [-Wunused-function]
+        > static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
+        >                    ^
+        > 1 warning generated.
+
+        * wtf/DateMath.cpp:
+        (WTF::getLocalTime): Defined only if used.
+        * wtf/StackBounds.cpp:
+        (WTF::StackBounds::currentThreadStackBoundsInternal): Initialize stackOrigin with '{ }'.
+        * wtf/win/RunLoopWin.cpp: Change the type of kRunLoopMessageWindowClassName to LPCWSTR.
+        (WTF::RunLoop::registerRunLoopMessageWindowClass): Initialize windowClass with '{ }'.
+
 2018-12-11  Andy Estes  <aes...@apple.com>
 
         Introduce makeBlockPtr for lambdas

Modified: trunk/Source/WTF/wtf/DateMath.cpp (239092 => 239093)


--- trunk/Source/WTF/wtf/DateMath.cpp	2018-12-12 01:15:55 UTC (rev 239092)
+++ trunk/Source/WTF/wtf/DateMath.cpp	2018-12-12 01:34:05 UTC (rev 239093)
@@ -122,16 +122,16 @@
     {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
 };
 
+#if !OS(WINDOWS) || HAVE(TM_GMTOFF)
 static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
 {
-#if COMPILER(MSVC)
-    localtime_s(localTM, localTime);
-#elif HAVE(LOCALTIME_R)
+#if HAVE(LOCALTIME_R)
     localtime_r(localTime, localTM);
 #else
     localtime_s(localTime, localTM);
 #endif
 }
+#endif
 
 bool isLeapYear(int year)
 {

Modified: trunk/Source/WTF/wtf/StackBounds.cpp (239092 => 239093)


--- trunk/Source/WTF/wtf/StackBounds.cpp	2018-12-12 01:15:55 UTC (rev 239092)
+++ trunk/Source/WTF/wtf/StackBounds.cpp	2018-12-12 01:34:05 UTC (rev 239093)
@@ -160,7 +160,7 @@
 StackBounds StackBounds::currentThreadStackBoundsInternal()
 {
     ASSERT(stackDirection() == StackDirection::Downward);
-    MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
+    MEMORY_BASIC_INFORMATION stackOrigin { };
     VirtualQuery(&stackOrigin, &stackOrigin, sizeof(stackOrigin));
     // stackOrigin.AllocationBase points to the reserved stack memory base address.
 

Modified: trunk/Source/WTF/wtf/win/RunLoopWin.cpp (239092 => 239093)


--- trunk/Source/WTF/wtf/win/RunLoopWin.cpp	2018-12-12 01:15:55 UTC (rev 239092)
+++ trunk/Source/WTF/wtf/win/RunLoopWin.cpp	2018-12-12 01:34:05 UTC (rev 239093)
@@ -31,7 +31,7 @@
 namespace WTF {
 
 static const UINT PerformWorkMessage = WM_USER + 1;
-static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
+static const LPCWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
 
 LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -83,7 +83,7 @@
 {
     // FIXME: This really only needs to be called once.
 
-    WNDCLASS windowClass = { 0 };
+    WNDCLASS windowClass { };
     windowClass.lpfnWndProc     = RunLoop::RunLoopWndProc;
     windowClass.cbWndExtra      = sizeof(RunLoop*);
     windowClass.lpszClassName   = kRunLoopMessageWindowClassName;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to