Bug 189538 - [Win][Clang][WebKitLegacy] Fix compilation errors and warnings of WebPreferences.cpp
Summary: [Win][Clang][WebKitLegacy] Fix compilation errors and warnings of WebPreferen...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks: 171618
  Show dependency treegraph
 
Reported: 2018-09-11 23:38 PDT by Fujii Hironori
Modified: 2018-09-12 19:16 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.05 KB, patch)
2018-09-11 23:58 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2018-09-11 23:38:19 PDT
[Win][Clang][WebKitLegacy] Fix compilation errors and warnings of WebPreferences.cpp

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

> [8/31] Building CXX object Source\WebKitLegacy\CMakeFiles\WebKitLegacy.dir\win\WebPreferences.cpp.obj
> FAILED: Source/WebKitLegacy/CMakeFiles/WebKitLegacy.dir/win/WebPreferences.cpp.obj 
> C:\tools\llvm\bin\clang-cl.exe  (...) -c ..\..\Source\WebKitLegacy\win\WebPreferences.cpp
> In file included from ..\..\Source\WebKitLegacy\win\WebPreferences.cpp:27:
> ..\..\Source\WebKitLegacy\win/WebKitDLL.h(53,37):  warning: 'gClassNameCount' has C-linkage specified, but returns user-defined type 'HashCountedSet<WTF::String> &' which is incompatible with C [-Wreturn-type-c-linkage]
> extern HashCountedSet<WTF::String>& gClassNameCount();
>                                     ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(518,26):  error: cannot initialize a variable of type 'CFPropertyListFormat' with an rvalue of type 'long long'
>     CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0 | kCFPropertyListXMLFormat_v1_0;
>                          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(1355,15):  warning: initialization of pointer of type 'BOOL *' (aka 'int *') to null from a constant boolean expression [-Wbool-conversion]
>     enabled = false;
>               ^~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(83,9):  error: no matching function for call to 'CFNumberGetValue'
>         CFNumberGetValue(static_cast<CFNumberRef>(value), CFNumberTraits<NumberType>::Type, &val);
>         ^~~~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(98,12):  note: in instantiation of function template specialization 'numberValueForPreferencesValue<int>' requested here
>     return numberValueForPreferencesValue<int>(value);
>            ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(133,9):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> Boolean CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
>         ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(83,9):  error: no matching function for call to 'CFNumberGetValue'
>         CFNumberGetValue(static_cast<CFNumberRef>(value), CFNumberTraits<NumberType>::Type, &val);
>         ^~~~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(409,12):  note: in instantiation of function template specialization 'numberValueForPreferencesValue<float>' requested here
>     return numberValueForPreferencesValue<float>(valueForKey(key).get());
>            ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(133,9):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> Boolean CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
>         ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(83,9):  error: no matching function for call to 'CFNumberGetValue'
>         CFNumberGetValue(static_cast<CFNumberRef>(value), CFNumberTraits<NumberType>::Type, &val);
>         ^~~~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(414,12):  note: in instantiation of function template specialization 'numberValueForPreferencesValue<long long>' requested here
>     return numberValueForPreferencesValue<LONGLONG>(valueForKey(key).get());
>            ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(133,9):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> Boolean CFNumberGetValue(CFNumberRef number, CFNumberType theType, void *valuePtr);
>         ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(93,20):  error: no matching function for call to 'CFNumberCreate'
>     return adoptCF(CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
>                    ^~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(435,25):  note: in instantiation of function template specialization 'cfNumber<int>' requested here
>     setValueForKey(key, cfNumber(value).get());
>                         ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(102,13):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
>             ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(93,20):  error: no matching function for call to 'CFNumberCreate'
>     return adoptCF(CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
>                    ^~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(445,25):  note: in instantiation of function template specialization 'cfNumber<float>' requested here
>     setValueForKey(key, cfNumber(value).get());
>                         ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(102,13):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
>             ^
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(93,20):  error: no matching function for call to 'CFNumberCreate'
>     return adoptCF(CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
>                    ^~~~~~~~~~~~~~
> ..\..\Source\WebKitLegacy\win\WebPreferences.cpp(465,25):  note: in instantiation of function template specialization 'cfNumber<long long>' requested here
>     setValueForKey(key, cfNumber(value).get());
>                         ^
> C:\webkit\ga\WebKitBuild\Debug\..\..\WebKitLibraries\win\include\CoreFoundation\CFNumber.h(102,13):  note: candidate function not viable: no known conversion from 'const unsigned int' to 'CFNumberType' for 2nd argument
> CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
>             ^
> 2 warnings and 7 errors generated.
Comment 1 Fujii Hironori 2018-09-11 23:58:20 PDT
Created attachment 349527 [details]
Patch
Comment 2 Build Bot 2018-09-11 23:59:56 PDT
Attachment 349527 [details] did not pass style-queue:


ERROR: Source/WebKitLegacy/win/WebPreferences.cpp:64:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKitLegacy/win/WebPreferences.cpp:65:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKitLegacy/win/WebPreferences.cpp:66:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKitLegacy/win/WebPreferences.cpp:67:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Per Arne Vollan 2018-09-12 09:06:52 PDT
Comment on attachment 349527 [details]
Patch

R=me.
Comment 4 Fujii Hironori 2018-09-12 19:15:00 PDT
Comment on attachment 349527 [details]
Patch

Clearing flags on attachment: 349527

Committed r235966: <https://trac.webkit.org/changeset/235966>
Comment 5 Fujii Hironori 2018-09-12 19:15:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-09-12 19:16:32 PDT
<rdar://problem/44403488>