Changeset 239093 in webkit


Ignore:
Timestamp:
Dec 11, 2018 5:34:05 PM (5 years ago)
Author:
Fujii Hironori
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 '{ }'.

Location:
trunk/Source/WTF
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r239078 r239093  
     12018-12-11  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Win][Clang] Fix compilation warnings of WTF
     4        https://bugs.webkit.org/show_bug.cgi?id=192583
     5
     6        Reviewed by Alex Christensen.
     7
     8        clang-cl reports the following warnings.
     9
     10        > [92/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\StackBounds.cpp.obj
     11        > ..\..\Source\WTF\wtf\StackBounds.cpp(163,48):  warning: missing field 'AllocationBase' initializer [-Wmissing-field-initializers]
     12        >     MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
     13        >                                                ^
     14        > 1 warning generated.
     15        > [160/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\win\RunLoopWin.cpp.obj
     16        > ..\..\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]
     17        > static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
     18        >                                                      ^
     19        > ..\..\Source\WTF\wtf\win\RunLoopWin.cpp(86,32):  warning: missing field 'lpfnWndProc' initializer [-Wmissing-field-initializers]
     20        >     WNDCLASS windowClass = { 0 };
     21        >                                ^
     22        > 2 warnings generated.
     23        > [175/206] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\DateMath.cpp.obj
     24        > ..\..\Source\WTF\wtf\DateMath.cpp(125,20):  warning: unused function 'getLocalTime' [-Wunused-function]
     25        > static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
     26        >                    ^
     27        > 1 warning generated.
     28
     29        * wtf/DateMath.cpp:
     30        (WTF::getLocalTime): Defined only if used.
     31        * wtf/StackBounds.cpp:
     32        (WTF::StackBounds::currentThreadStackBoundsInternal): Initialize stackOrigin with '{ }'.
     33        * wtf/win/RunLoopWin.cpp: Change the type of kRunLoopMessageWindowClassName to LPCWSTR.
     34        (WTF::RunLoop::registerRunLoopMessageWindowClass): Initialize windowClass with '{ }'.
     35
    1362018-12-11  Andy Estes  <aestes@apple.com>
    237
  • trunk/Source/WTF/wtf/DateMath.cpp

    r237099 r239093  
    123123};
    124124
     125#if !OS(WINDOWS) || HAVE(TM_GMTOFF)
    125126static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
    126127{
    127 #if COMPILER(MSVC)
    128     localtime_s(localTM, localTime);
    129 #elif HAVE(LOCALTIME_R)
     128#if HAVE(LOCALTIME_R)
    130129    localtime_r(localTime, localTM);
    131130#else
     
    133132#endif
    134133}
     134#endif
    135135
    136136bool isLeapYear(int year)
  • trunk/Source/WTF/wtf/StackBounds.cpp

    r237099 r239093  
    161161{
    162162    ASSERT(stackDirection() == StackDirection::Downward);
    163     MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
     163    MEMORY_BASIC_INFORMATION stackOrigin { };
    164164    VirtualQuery(&stackOrigin, &stackOrigin, sizeof(stackOrigin));
    165165    // stackOrigin.AllocationBase points to the reserved stack memory base address.
  • trunk/Source/WTF/wtf/win/RunLoopWin.cpp

    r237099 r239093  
    3232
    3333static const UINT PerformWorkMessage = WM_USER + 1;
    34 static const LPWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
     34static const LPCWSTR kRunLoopMessageWindowClassName = L"RunLoopMessageWindow";
    3535
    3636LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     
    8484    // FIXME: This really only needs to be called once.
    8585
    86     WNDCLASS windowClass = { 0 };
     86    WNDCLASS windowClass { };
    8787    windowClass.lpfnWndProc     = RunLoop::RunLoopWndProc;
    8888    windowClass.cbWndExtra      = sizeof(RunLoop*);
Note: See TracChangeset for help on using the changeset viewer.