Bug 189542

Summary: [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: New BugsAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, commit-queue, pvollan, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 171618    
Attachments:
Description Flags
Patch none

Description Fujii Hironori 2018-09-12 03:55:36 PDT
[Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'

While trying to build WebKit WinCairo port with the latest Clang (Bug 171618),
the following compilation errors are reported.

> [4/664] Building CXX object Source\WebCore\CMakeFiles\WebCore.dir\platform\graphics\win\IntPointWin.cpp.obj
> FAILED: Source/WebCore/CMakeFiles/WebCore.dir/platform/graphics/win/IntPointWin.cpp.obj 
> C:\tools\llvm\bin\clang-cl.exe (...) -c ..\..\Source\WebCore\platform\graphics\win\IntPointWin.cpp
> ..\..\Source\WebCore\platform\graphics\win\IntPointWin.cpp(56,17):  error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT' (aka 'short') in initializer list [-Wc++11-narrowing]
>     POINTS p = {m_x, m_y};
>                 ^~~
> ..\..\Source\WebCore\platform\graphics\win\IntPointWin.cpp(56,17):  note: insert an explicit cast to silence this issue
>     POINTS p = {m_x, m_y};
>                 ^~~
>                 static_cast<SHORT>( )
> ..\..\Source\WebCore\platform\graphics\win\IntPointWin.cpp(56,22):  error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT' (aka 'short') in initializer list [-Wc++11-narrowing]
>     POINTS p = {m_x, m_y};
>                      ^~~
> ..\..\Source\WebCore\platform\graphics\win\IntPointWin.cpp(56,22):  note: insert an explicit cast to silence this issue
>     POINTS p = {m_x, m_y};
>                      ^~~
>                      static_cast<SHORT>( )
> 2 errors generated.

> [15/31] Building CXX object Source\WebKit\CMakeFiles\WebKit.dir\UIProcess\win\WebInspectorProxyWin.cpp.obj
> FAILED: Source/WebKit/CMakeFiles/WebKit.dir/UIProcess/win/WebInspectorProxyWin.cpp.obj 
> C:\tools\llvm\bin\clang-cl.exe (...) -c ..\..\Source\WebKit\UIProcess\win\WebInspectorProxyWin.cpp
> ..\..\Source\WebKit\UIProcess\win\WebInspectorProxyWin.cpp(234,22):  error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'LONG' (aka 'long') in initializer list [-Wc++11-narrowing]
>     RECT r = { 0, 0, initialWindowWidth, initialWindowHeight };
>                      ^~~~~~~~~~~~~~~~~~
> ..\..\Source\WebKit\UIProcess\win\WebInspectorProxyWin.cpp(234,22):  note: insert an explicit cast to silence this issue
>     RECT r = { 0, 0, initialWindowWidth, initialWindowHeight };
>                      ^~~~~~~~~~~~~~~~~~
>                      static_cast<LONG>()
> ..\..\Source\WebKit\UIProcess\win\WebInspectorProxyWin.cpp(234,42):  error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'LONG' (aka 'long') in initializer list [-Wc++11-narrowing]
>     RECT r = { 0, 0, initialWindowWidth, initialWindowHeight };
>                                          ^~~~~~~~~~~~~~~~~~~
> ..\..\Source\WebKit\UIProcess\win\WebInspectorProxyWin.cpp(234,42):  note: insert an explicit cast to silence this issue
>     RECT r = { 0, 0, initialWindowWidth, initialWindowHeight };
>                                          ^~~~~~~~~~~~~~~~~~~
>                                          static_cast<LONG>( )
> 2 errors generated.
Comment 1 Fujii Hironori 2018-09-12 04:07:49 PDT
Created attachment 349539 [details]
Patch
Comment 2 WebKit Commit Bot 2018-09-12 09:47:28 PDT
Comment on attachment 349539 [details]
Patch

Clearing flags on attachment: 349539

Committed r235942: <https://trac.webkit.org/changeset/235942>
Comment 3 WebKit Commit Bot 2018-09-12 09:47:29 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2018-09-12 09:49:16 PDT
<rdar://problem/44386326>