Bug 189612 - [Win][Clang][WebKitLegacy] error: cannot pass object of non-trivial type through variadic function
Summary: [Win][Clang][WebKitLegacy] error: cannot pass object of non-trivial type thro...
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-13 20:19 PDT by Fujii Hironori
Modified: 2018-09-17 19:56 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.62 KB, patch)
2018-09-13 20:35 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-13 20:19:44 PDT
[Win][Clang][WebKitLegacy] error: cannot pass object of non-trivial type through variadic function

While doing Bug 171618, the following compilation errors are reported.

> [5/31] Building CXX object Source\WebKitLegacy\CMakeFiles\WebKitLegacy.dir\win\DefaultPolicyDelegate.cpp.obj
> FAILED: Source/WebKitLegacy/CMakeFiles/WebKitLegacy.dir/win/DefaultPolicyDelegate.cpp.obj 
> C:\tools\llvm\bin\clang-cl.exe  (...) -c ..\..\Source\WebKitLegacy\win\DefaultPolicyDelegate.cpp
> In file included from ..\..\Source\WebKitLegacy\win\DefaultPolicyDelegate.cpp:26:
> ..\..\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\DefaultPolicyDelegate.cpp(182,72):  error: cannot pass object of non-trivial type 'WebCore::BString' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
>     LOG_ERROR("called unableToImplementPolicyWithError:%S inFrame:%S", errorStr ? errorStr : TEXT(""), frameName ? frameName : TEXT(""));
>                                                                        ^
> ..\..\Source\WebKitLegacy\win\DefaultPolicyDelegate.cpp(182,104):  error: cannot pass object of non-trivial type 'WebCore::BString' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
>     LOG_ERROR("called unableToImplementPolicyWithError:%S inFrame:%S", errorStr ? errorStr : TEXT(""), frameName ? frameName : TEXT(""));
>                                                                                                        ^
> 1 warning and 2 errors generated.


> [4/31] Building CXX object Source\WebKitLegacy\CMakeFiles\WebKitLegacy.dir\win\WebLocalizableStrings.cpp.obj
> FAILED: Source/WebKitLegacy/CMakeFiles/WebKitLegacy.dir/win/WebLocalizableStrings.cpp.obj 
> C:\tools\llvm\bin\clang-cl.exe (...) -c ..\..\Source\WebKitLegacy\win\WebLocalizableStrings.cpp
> In file included from ..\..\Source\WebKitLegacy\win\WebLocalizableStrings.cpp:26:
> ..\..\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\WebLocalizableStrings.cpp(164,95):  error: cannot pass object of non-trivial type 'const WTF::String' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
>     ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
>                                                                                               ^
> 1 warning and 1 error generated.
> [5/31] Building CXX object Source\WebKitLegacy\CMakeFiles\WebKitLegacy.dir\win\DefaultPolicyDelegate.cpp.obj
Comment 1 Fujii Hironori 2018-09-13 20:24:52 PDT
MSVC reports compilation warnings.

> 1>------ Build started: Project: WebKitLegacy (WebKitLegacy\WebKitLegacy), Configuration: Debug x64 ------
> 1>DefaultPolicyDelegate.cpp
> 1>c:\webkit\ga\source\webkitlegacy\win\defaultpolicydelegate.cpp(182): warning C4840: non-portable use of class 'WebCore::BString' as an argument to a variadic function
> 1>c:\webkit\ga\source\webkitlegacy\win\defaultpolicydelegate.cpp(182): note: 'WebCore::BString::BString' is non-trivial
> 1>c:\webkit\ga\webkitbuild\debug\derivedsources\forwardingheaders\webcore\bstring.h(61): note: see declaration of 'WebCore::BString::BString'
> 1>c:\webkit\ga\source\webkitlegacy\win\defaultpolicydelegate.cpp(182): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
> 1>c:\webkit\ga\webkitbuild\debug\derivedsources\forwardingheaders\webcore\bstring.h(45): note: see declaration of 'WebCore::BString'
> 1>Done building project "WebKitLegacy.vcxproj".
> ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

> 1>------ Build started: Project: WebKitLegacy (WebKitLegacy\WebKitLegacy), Configuration: Debug x64 ------
> 1>WebLocalizableStrings.cpp
> 1>c:\webkit\ga\source\webkitlegacy\win\weblocalizablestrings.cpp(164): warning C4840: non-portable use of class 'WTF::String' as an argument to a variadic function
> 1>c:\webkit\ga\source\webkitlegacy\win\weblocalizablestrings.cpp(164): note: 'WTF::String::String' is non-trivial
> 1>c:\webkit\ga\webkitbuild\debug\derivedsources\forwardingheaders\wtf\text\wtfstring.h(130): note: see declaration of 'WTF::String::String'
> 1>c:\webkit\ga\source\webkitlegacy\win\weblocalizablestrings.cpp(164): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
> 1>c:\webkit\ga\webkitbuild\debug\derivedsources\forwardingheaders\wtf\text\wtfstring.h(78): note: see declaration of 'WTF::String'
> 1>Done building project "WebKitLegacy.vcxproj".
> ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Comment 2 Fujii Hironori 2018-09-13 20:35:53 PDT
Created attachment 349729 [details]
Patch
Comment 3 Fujii Hironori 2018-09-17 19:55:34 PDT
Comment on attachment 349729 [details]
Patch

Clearing flags on attachment: 349729

Committed r236099: <https://trac.webkit.org/changeset/236099>
Comment 4 Fujii Hironori 2018-09-17 19:55:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2018-09-17 19:56:25 PDT
<rdar://problem/44543910>