| Summary: | Use variadic templates to reduce the line count of wtf/text/StringConcatenate.h | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Sam Weinig <sam> | ||||||||
| Component: | New Bugs | Assignee: | Sam Weinig <sam> | ||||||||
| Status: | RESOLVED DUPLICATE | ||||||||||
| Severity: | Normal | CC: | andersca, benjamin, bfulgham, cmarcelo, commit-queue, mrowe | ||||||||
| Priority: | P2 | ||||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Sam Weinig
2014-02-23 12:56:35 PST
Created attachment 225012 [details]
Patch
Attachment 225012 [details] did not pass style-queue:
ERROR: Source/WTF/wtf/text/StringConcatenate.h:518: Do not use 'using namespace TryMakeStringDetails;'. [build/using_namespace] [4]
Total errors found: 1 in 5 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 225013 [details]
Just the new code
Adding a file with just new code, as the diff is a bit hard to read.
(In reply to comment #2) > Attachment 225012 [details] did not pass style-queue: > > > ERROR: Source/WTF/wtf/text/StringConcatenate.h:518: Do not use 'using namespace TryMakeStringDetails;'. [build/using_namespace] [4] I don't think this should be an error. The using namespace declaration is used inside a function. Created attachment 225523 [details]
Patch
This doesn't seem to work on Windows. Sometimes we run into problems with char*/wchar_t*
Example error:
WebSocketFrame.cpp
1>C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(521): error C2079: 'adaptedStrings' uses undefined class 'std::tuple<WTF::StringTypeAdapter<StringType1>,WTF::StringTypeAdapter<const char*>>'
with
[
StringType1=WTF::StringAppend<const char *,WTF::String>
] (..\Modules\websockets\WebSocketFrame.cpp)
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringOperators.h(38) : see reference to function template instantiation 'WTF::PassRefPtr<WTF::StringImpl> WTF::tryMakeString<StringType1,StringType2>(StringType1,StringType2)' being compiled
with
[
StringType1=WTF::StringAppend<const char *,WTF::String>
, StringType2=const char *
]
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringOperators.h(37) : while compiling class template member function 'WTF::StringAppend<WTF::StringAppend<const char *,WTF::String>,const char *>::operator WTF::String(void) const'
..\Modules\websockets\WebSocketFrame.cpp(99) : see reference to function template instantiation 'WTF::StringAppend<WTF::StringAppend<const char *,WTF::String>,const char *>::operator WTF::String(void) const' being compiled
..\Modules\websockets\WebSocketFrame.cpp(99) : see reference to class template instantiation 'WTF::StringAppend<WTF::StringAppend<const char *,WTF::String>,const char *>' being compiled
1>C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(521): error C2078: too many initializers (..\Modules\websockets\WebSocketFrame.cpp)
1>C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(521): error C2440: 'initializing' : cannot convert from 'const char *' to 'int' (..\Modules\websockets\WebSocketFrame.cpp)
There is no context in which this conversion is possible
1>C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(522): error C2783: 'WTF::PassRefPtr<WTF::StringImpl> WTF::TryMakeStringDetails::tryMakeStringTuple(Tuple)' : could not deduce template argument for 'Indicies' (..\Modules\websockets\WebSocketFrame.cpp)
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(509) : see declaration of 'WTF::TryMakeStringDetails::tryMakeStringTuple'
1>C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(522): error C2780: 'WTF::PassRefPtr<WTF::StringImpl> WTF::TryMakeStringDetails::tryMakeStringTuple(Tuple &&,std::index_sequence<Index...>)' : expects 2 arguments - 1 provided (..\Modules\websockets\WebSocketFrame.cpp)
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\include\private\wtf/text/StringConcatenate.h(503) : see declaration of 'WTF::TryMakeStringDetails::tryMakeStringTuple'
I wrote up a very similar patch this evening since I wasn't aware of this one. I don't think it's necessary to use std::tuple for this. Comment on attachment 225523 [details]
Patch
This patch doesn't apply anymore, but it looks like it would be useful. Put up a rebaselined patch!
(In reply to comment #8) > Comment on attachment 225523 [details] > Patch > > This patch doesn't apply anymore, but it looks like it would be useful. Put > up a rebaselined patch! +1! And I think our Windows builds can handle this now... *** This bug has been marked as a duplicate of bug 147142 *** |