Bug 211608 - WTF headers should compile independently
Summary: WTF headers should compile independently
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Don Olmstead
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-07 20:38 PDT by Don Olmstead
Modified: 2020-05-08 09:50 PDT (History)
9 users (show)

See Also:


Attachments
Patch (10.13 KB, patch)
2020-05-07 20:46 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (10.38 KB, patch)
2020-05-07 21:40 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (10.74 KB, patch)
2020-05-07 22:09 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2020-05-07 20:38:25 PDT
Some WTF headers do not compile on their own.

These issues were found when creating a file that just includes the header file directly.
Comment 1 Don Olmstead 2020-05-07 20:46:46 PDT Comment hidden (obsolete)
Comment 2 Don Olmstead 2020-05-07 21:40:40 PDT Comment hidden (obsolete)
Comment 3 Don Olmstead 2020-05-07 22:09:32 PDT
Created attachment 398836 [details]
Patch
Comment 4 Ross Kirsling 2020-05-07 22:55:05 PDT
Comment on attachment 398836 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398836&action=review

> Source/WTF/wtf/LoggingHashMap.h:116
>      auto keys() { return m_map.keys(); }
> -    const auto keys() const { return m_map.keys(); }
> +    auto keys() const { return m_map.keys(); }
>      auto values() { return m_map.values(); }
> -    const auto values() const { return m_map.values(); }
> +    auto values() const { return m_map.values(); }

Whoops; it's good to mark these as const methods but these really are two different return types for each.
Comment 5 Don Olmstead 2020-05-08 06:27:34 PDT
Comment on attachment 398836 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398836&action=review

>> Source/WTF/wtf/LoggingHashMap.h:116
>> +    auto values() const { return m_map.values(); }
> 
> Whoops; it's good to mark these as const methods but these really are two different return types for each.

In file included from WTF\DerivedSources\LoggingHashMapInclude.cpp:2:
..\..\Source\WTF\wtf\LoggingHashMap.h(114,5): warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
    const auto keys() const { return m_map.keys(); }
    ^~~~~~
..\..\Source\WTF\wtf\LoggingHashMap.h(116,5): warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
    const auto values() const { return m_map.values(); }
    ^~~~~~
Comment 6 Yusuke Suzuki 2020-05-08 08:11:36 PDT
Comment on attachment 398836 [details]
Patch

r=me
Comment 7 EWS 2020-05-08 08:39:44 PDT
Committed r261384: <https://trac.webkit.org/changeset/261384>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 398836 [details].
Comment 8 Radar WebKit Bug Importer 2020-05-08 08:40:16 PDT
<rdar://problem/63022258>
Comment 9 Darin Adler 2020-05-08 09:50:22 PDT
Comment on attachment 398836 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398836&action=review

> Source/WTF/wtf/IndexSparseSet.h:33
> +template<typename KeyTypeArg, typename ValueTypeArg>
> +struct KeyValuePair;

I would have written:

template<typename, typename> struct KeyValuePair;

I try to go minimal in forward declarations, repeating the minimum.

> Source/WTF/wtf/LoggingHashMap.h:56
> +    typedef typename HashMap::MappedTraits::PeekType MappedPeekType;

Would be nice to do "using" here. Also, can this live in the private part that already exists below instead of dropping into private and then back to public.

> Source/WTF/wtf/RunLoopTimer.h:36
> +#if USE(CF)
>  #include <wtf/RetainPtr.h>
> +#endif

Surprised we don’t get a warning about "private:" at the end of a class definition with nothing after it before the closing brace.

> Source/WTF/wtf/persistence/PersistentCoder.h:31
> +template <class T>
> +class Optional;

template<typename> class Optional;

But also, maybe use <wtf/Forward.h> instead?

> Source/WTF/wtf/text/NullTextBreakIterator.h:23
> +#include <wtf/text/StringView.h>

Can we include less, maybe just Forward.h? Or is that not enough?

> Source/WTF/wtf/text/StringOperators.h:24
> +#include <wtf/text/WTFString.h>

Can we include less, maybe just Forward.h? I’m really concerned about include cycles here -- this seems like a bad change!

> Source/WTF/wtf/text/StringToIntegerConversion.h:29
> +#include <unicode/utypes.h>
> +#include <wtf/ASCIICType.h>

Seems like ASCIICType.h should have been sufficient on its own; didn't need  to add both.