Use some C++17 features
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 21:17:59 +0000 (21:17 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 21:17:59 +0000 (21:17 +0000)
commitb3c0f421637b2d8c89d85e236b760cf11c85f9e4
treef0cc153e624684ae696c69d39d3704594dd8d60a
parent4207b27f6ebd981bbac3e887f7afa46481b213f3
Use some C++17 features
https://bugs.webkit.org/show_bug.cgi?id=185135

Reviewed by Alex Christensen.

.:

As discussed here [0] let's move WebKit to a subset of C++17. We
now require GCC 6 [1] which means that, according to [2] we can
use the following C++17 language features (I removed some
uninteresting ones):

 - New auto rules for direct-list-initialization
 - static_assert with no message
 - typename in a template template parameter
 - Nested namespace definition
 - Attributes for namespaces and enumerators
 - u8 character literals
 - Allow constant evaluation for all non-type template arguments
 - Fold Expressions
 - Unary fold expressions and empty parameter packs
 - __has_include in preprocessor conditional
 - Differing begin and end types in range-based for
 - Improving std::pair and std::tuple

Consult the Tony Tables [3] to see before / after examples.

Of course we can use any library feature if we're willing to
import them to WTF (and they don't require language support).

  [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
  [1]: https://trac.webkit.org/changeset/231152/webkit
  [2]: https://en.cppreference.com/w/cpp/compiler_support
  [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md

* Source/cmake/WebKitCompilerFlags.cmake:

Source/WebCore:

As discussed here [0] let's move WebKit to a subset of C++17. We
now require GCC 6 [1] which means that, according to [2] we can
use the following C++17 language features (I removed some
uninteresting ones):

 - New auto rules for direct-list-initialization
 - static_assert with no message
 - typename in a template template parameter
 - Nested namespace definition
 - Attributes for namespaces and enumerators
 - u8 character literals
 - Allow constant evaluation for all non-type template arguments
 - Fold Expressions
 - Unary fold expressions and empty parameter packs
 - __has_include in preprocessor conditional
 - Differing begin and end types in range-based for
 - Improving std::pair and std::tuple

Consult the Tony Tables [3] to see before / after examples.

Of course we can use any library feature if we're willing to
import them to WTF (and they don't require language support).

  [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
  [1]: https://trac.webkit.org/changeset/231152/webkit
  [2]: https://en.cppreference.com/w/cpp/compiler_support
  [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md

* DerivedSources.make:
* platform/URLParser.cpp: work around an odd GCC 6 bug with class
  static value as a template parameter.
(WebCore::URLParser::percentDecode):
(WebCore::URLParser::domainToASCII):
(WebCore::URLParser::hasForbiddenHostCodePoint):
(WebCore::URLParser::parseHostAndPort):
* platform/URLParser.h:

Source/WebKit:

As discussed here [0] let's move WebKit to a subset of C++17. We
now require GCC 6 [1] which means that, according to [2] we can
use the following C++17 language features (I removed some
uninteresting ones):

 - New auto rules for direct-list-initialization
 - static_assert with no message
 - typename in a template template parameter
 - Nested namespace definition
 - Attributes for namespaces and enumerators
 - u8 character literals
 - Allow constant evaluation for all non-type template arguments
 - Fold Expressions
 - Unary fold expressions and empty parameter packs
 - __has_include in preprocessor conditional
 - Differing begin and end types in range-based for
 - Improving std::pair and std::tuple

Consult the Tony Tables [3] to see before / after examples.

Of course we can use any library feature if we're willing to
import them to WTF (and they don't require language support).

  [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
  [1]: https://trac.webkit.org/changeset/231152/webkit
  [2]: https://en.cppreference.com/w/cpp/compiler_support
  [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md

* Configurations/Base.xcconfig:
* DerivedSources.make:
* PlatformMac.cmake:

Source/WebKitLegacy:

* PlatformMac.cmake:

Source/WebKitLegacy/mac:

* Configurations/WebKitLegacy.xcconfig:

Source/WTF:

* wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it
defines std::conjunction. Use the feature test macro instead.

Tools:

* DumpRenderTree/PlatformMac.cmake:
* gtk/ycm_extra_conf.py:
(FlagsForFile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/StdLibExtras.h
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/platform/URLParser.cpp
Source/WebCore/platform/URLParser.h
Source/WebKit/ChangeLog
Source/WebKit/Configurations/Base.xcconfig
Source/WebKit/DerivedSources.make
Source/WebKit/PlatformMac.cmake
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/PlatformMac.cmake
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig
Source/cmake/WebKitCompilerFlags.cmake
Tools/ChangeLog
Tools/DumpRenderTree/PlatformMac.cmake
Tools/gtk/ycm_extra_conf.py