Title: [262486] trunk/Source
Revision
262486
Author
commit-qu...@webkit.org
Date
2020-06-03 07:29:10 -0700 (Wed, 03 Jun 2020)

Log Message

Make generated C++ code use modern C++
https://bugs.webkit.org/show_bug.cgi?id=190714

Patch by Rob Buis <rb...@igalia.com> on 2020-06-03
Reviewed by Jonathan Bedard.

Source/_javascript_Core:

Update inspector protocol generator and rebaseline the tests.

* inspector/scripts/codegen/cpp_generator_templates.py:
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/expected/enum-values.json-result:
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
* inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
* inspector/scripts/tests/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
* yarr/generateYarrUnicodePropertyTables.py:

Source/WebCore:

Replace typedef usage by alias-declaration.

No new tests. No change in behavior.

* css/makeprop.pl:
* dom/make_names.pl:
(printHeaderHead):
(printInit):
(printTypeHelpersHeaderFile):
(printFactoryCppFile):
(printFactoryHeaderFile):
(printWrapperFactoryCppFile):
(printWrapperFactoryHeaderFile):

Source/WebKit:

Replace typedef usage by alias-declaration.

* Scripts/test-legacyMessages.h:
* Scripts/test-superclassMessages.h:
* Scripts/testMessages.h:
* Scripts/webkit/messages.py:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (262485 => 262486)


--- trunk/Source/_javascript_Core/ChangeLog	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-06-03 14:29:10 UTC (rev 262486)
@@ -1,3 +1,27 @@
+2020-06-03  Rob Buis  <rb...@igalia.com>
+
+        Make generated C++ code use modern C++
+        https://bugs.webkit.org/show_bug.cgi?id=190714
+
+        Reviewed by Jonathan Bedard.
+
+        Update inspector protocol generator and rebaseline the tests.
+
+        * inspector/scripts/codegen/cpp_generator_templates.py:
+        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
+        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
+        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
+        * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
+        * inspector/scripts/tests/expected/enum-values.json-result:
+        * inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
+        * inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
+        * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-array-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
+        * inspector/scripts/tests/expected/type-declaration-object-type.json-result:
+        * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
+        * yarr/generateYarrUnicodePropertyTables.py:
+
 2020-06-02  Mark Lam  <mark....@apple.com>
 
         Rolling out r262475 to unbreak Windows bot.

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator_templates.py (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator_templates.py	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator_templates.py	2020-06-03 14:29:10 UTC (rev 262486)
@@ -139,8 +139,8 @@
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    typedef void (${domainName}BackendDispatcher::*CallHandler)(long requestId, RefPtr<JSON::Object>&& message);
-    typedef HashMap<String, CallHandler> DispatchMap;
+    using CallHandler = void (${domainName}BackendDispatcher::*)(long requestId, RefPtr<JSON::Object>&& message);
+    using DispatchMap = HashMap<String, CallHandler>;
     static NeverDestroyed<DispatchMap> dispatchMap;
     if (dispatchMap.get().isEmpty()) {
         static const struct MethodTable {

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py	2020-06-03 14:29:10 UTC (rev 262486)
@@ -169,7 +169,7 @@
             typedef_lines = []
             if len(declaration.description) > 0:
                 typedef_lines.append('/* %s */' % declaration.description)
-            typedef_lines.append('typedef %s %s;' % (primitive_name, declaration.type_name))
+            typedef_lines.append('using %s = %s;' % (declaration.type_name, primitive_name))
             sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines)))
 
         for declaration in array_declarations:
@@ -177,7 +177,7 @@
             typedef_lines = []
             if len(declaration.description) > 0:
                 typedef_lines.append('/* %s */' % declaration.description)
-            typedef_lines.append('typedef JSON::ArrayOf<%s> %s;' % (element_type, declaration.type_name))
+            typedef_lines.append('using %s = JSON::ArrayOf<%s>;' % (declaration.type_name, element_type))
             sections.append(self.wrap_with_guard_for_condition(declaration.condition, '\n'.join(typedef_lines)))
 
         lines = []
@@ -486,7 +486,7 @@
                 enum_lines = []
                 enum_lines.append('template<>')
                 enum_lines.append('struct DefaultHash<Inspector::Protocol::%s::%s> {' % (domain.domain_name, enum_type.raw_name()))
-                enum_lines.append('    typedef IntHash<Inspector::Protocol::%s::%s> Hash;' % (domain.domain_name, enum_type.raw_name()))
+                enum_lines.append('    using Hash = IntHash<Inspector::Protocol::%s::%s>;' % (domain.domain_name, enum_type.raw_name()))
                 enum_lines.append('};')
                 domain_lines.append(self.wrap_with_guard_for_condition(enum_type.declaration().condition, '\n'.join(enum_lines)))
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -618,8 +618,8 @@
 // Typedefs.
 namespace Database {
 /* Unique identifier of Database object. */
-typedef int DatabaseId;
-typedef JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors> ColorList;
+using DatabaseId = int;
+using ColorList = JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors>;
 } // Database
 // End of typedefs.
 
@@ -734,7 +734,7 @@
 // Hash declarations in the 'Database' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> {
-    typedef IntHash<Inspector::Protocol::Database::PrimaryColors> Hash;
+    using Hash = IntHash<Inspector::Protocol::Database::PrimaryColors>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -529,8 +529,8 @@
 // Typedefs.
 namespace Database {
 /* Unique identifier of Database object. */
-typedef int DatabaseId;
-typedef JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors> ColorList;
+using DatabaseId = int;
+using ColorList = JSON::ArrayOf<Inspector::Protocol::Database::PrimaryColors>;
 } // Database
 // End of typedefs.
 
@@ -645,7 +645,7 @@
 // Hash declarations in the 'Database' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Database::PrimaryColors> {
-    typedef IntHash<Inspector::Protocol::Database::PrimaryColors> Hash;
+    using Hash = IntHash<Inspector::Protocol::Database::PrimaryColors>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -337,8 +337,8 @@
     RefPtr<JSON::Object> parameters;
     message->getObject("params"_s, parameters);
 
-    typedef void (Network3BackendDispatcher::*CallHandler)(long requestId, RefPtr<JSON::Object>&& message);
-    typedef HashMap<String, CallHandler> DispatchMap;
+    using CallHandler = void (Network3BackendDispatcher::*)(long requestId, RefPtr<JSON::Object>&& message);
+    using DispatchMap = HashMap<String, CallHandler>;
     static NeverDestroyed<DispatchMap> dispatchMap;
     if (dispatchMap.get().isEmpty()) {
         static const struct MethodTable {
@@ -637,7 +637,7 @@
 // Typedefs.
 namespace Network2 {
 /* Unique loader identifier. */
-typedef String LoaderId;
+using LoaderId = String;
 } // Network2
 // End of typedefs.
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -493,7 +493,7 @@
 // Hash declarations in the 'TypeDomain' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::TypeDomain::TypeDomainEnum> {
-    typedef IntHash<Inspector::Protocol::TypeDomain::TypeDomainEnum> Hash;
+    using Hash = IntHash<Inspector::Protocol::TypeDomain::TypeDomainEnum>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -382,9 +382,9 @@
 // Typedefs.
 namespace Database {
 /* Unique identifier of Database object. */
-typedef String DatabaseId;
-typedef String PrimaryColors;
-typedef JSON::ArrayOf<String> ColorList;
+using DatabaseId = String;
+using PrimaryColors = String;
+using ColorList = JSON::ArrayOf<String>;
 } // Database
 // End of typedefs.
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -313,12 +313,12 @@
 // Typedefs.
 namespace Runtime {
 /* Unique object identifier. */
-typedef String RemoteObjectId;
+using RemoteObjectId = String;
 } // Runtime
 
 namespace Runtime2 {
 /* Unique object identifier. */
-typedef String RemoteObjectId;
+using RemoteObjectId = String;
 } // Runtime2
 // End of typedefs.
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -313,7 +313,7 @@
 // Typedefs.
 namespace Runtime {
 /* Unique object identifier. */
-typedef int RemoteObjectId;
+using RemoteObjectId = int;
 } // Runtime
 // End of typedefs.
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -322,16 +322,16 @@
 
 // Typedefs.
 namespace Debugger {
-typedef int BreakpointId;
+using BreakpointId = int;
 } // Debugger
 
 namespace Runtime {
-typedef int ObjectId;
-typedef JSON::ArrayOf<int> LuckyNumbers;
-typedef JSON::ArrayOf<String> BabyNames;
-typedef JSON::ArrayOf<int> NewObjects;
-typedef JSON::ArrayOf<int> OldObjects;
-typedef JSON::ArrayOf<Inspector::Protocol::Debugger::Reason> StopReasons;
+using ObjectId = int;
+using LuckyNumbers = JSON::ArrayOf<int>;
+using BabyNames = JSON::ArrayOf<String>;
+using NewObjects = JSON::ArrayOf<int>;
+using OldObjects = JSON::ArrayOf<int>;
+using StopReasons = JSON::ArrayOf<Inspector::Protocol::Debugger::Reason>;
 } // Runtime
 // End of typedefs.
 
@@ -380,7 +380,7 @@
 // Hash declarations in the 'Debugger' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Debugger::Reason> {
-    typedef IntHash<Inspector::Protocol::Debugger::Reason> Hash;
+    using Hash = IntHash<Inspector::Protocol::Debugger::Reason>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -379,11 +379,11 @@
 // Hash declarations in the 'Runtime' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Runtime::FarmAnimals> {
-    typedef IntHash<Inspector::Protocol::Runtime::FarmAnimals> Hash;
+    using Hash = IntHash<Inspector::Protocol::Runtime::FarmAnimals>;
 };
 template<>
 struct DefaultHash<Inspector::Protocol::Runtime::TwoLeggedAnimals> {
-    typedef IntHash<Inspector::Protocol::Runtime::TwoLeggedAnimals> Hash;
+    using Hash = IntHash<Inspector::Protocol::Runtime::TwoLeggedAnimals>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -333,7 +333,7 @@
 
 // Typedefs.
 namespace Database {
-typedef JSON::ArrayOf<Inspector::Protocol::Database::Error> ErrorList;
+using ErrorList = JSON::ArrayOf<Inspector::Protocol::Database::Error>;
 } // Database
 // End of typedefs.
 
@@ -909,7 +909,7 @@
 // Hash declarations in the 'Database' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Database::MouseButton> {
-    typedef IntHash<Inspector::Protocol::Database::MouseButton> Hash;
+    using Hash = IntHash<Inspector::Protocol::Database::MouseButton>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result (262485 => 262486)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result	2020-06-03 14:29:10 UTC (rev 262486)
@@ -327,8 +327,8 @@
 
 // Typedefs.
 namespace Test {
-typedef int CastedObjectId;
-typedef int UncastedObjectId;
+using CastedObjectId = int;
+using UncastedObjectId = int;
 } // Test
 // End of typedefs.
 
@@ -596,11 +596,11 @@
 // Hash declarations in the 'Test' Domain
 template<>
 struct DefaultHash<Inspector::Protocol::Test::UncastedAnimals> {
-    typedef IntHash<Inspector::Protocol::Test::UncastedAnimals> Hash;
+    using Hash = IntHash<Inspector::Protocol::Test::UncastedAnimals>;
 };
 template<>
 struct DefaultHash<Inspector::Protocol::Test::CastedAnimals> {
-    typedef IntHash<Inspector::Protocol::Test::CastedAnimals> Hash;
+    using Hash = IntHash<Inspector::Protocol::Test::CastedAnimals>;
 };
 
 } // namespace WTF

Modified: trunk/Source/_javascript_Core/yarr/generateYarrUnicodePropertyTables.py (262485 => 262486)


--- trunk/Source/_javascript_Core/yarr/generateYarrUnicodePropertyTables.py	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/_javascript_Core/yarr/generateYarrUnicodePropertyTables.py	2020-06-03 14:29:10 UTC (rev 262486)
@@ -551,7 +551,7 @@
         for propertyData in cls.allPropertyData:
             propertyData.dump(file, propertyData != cls.allPropertyData[-1])
 
-        file.write("typedef std::unique_ptr<CharacterClass> (*CreateCharacterClass)();\n")
+        file.write("using CreateCharacterClass = std::unique_ptr<CharacterClass> (*)();\n")
         file.write("static CreateCharacterClass createFunctions[{}] = {{\n   ".format(len(cls.allPropertyData)))
         functionsOnThisLine = 0
         for propertyData in cls.allPropertyData:

Modified: trunk/Source/WebCore/ChangeLog (262485 => 262486)


--- trunk/Source/WebCore/ChangeLog	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebCore/ChangeLog	2020-06-03 14:29:10 UTC (rev 262486)
@@ -1,3 +1,24 @@
+2020-06-03  Rob Buis  <rb...@igalia.com>
+
+        Make generated C++ code use modern C++
+        https://bugs.webkit.org/show_bug.cgi?id=190714
+
+        Reviewed by Jonathan Bedard.
+
+        Replace typedef usage by alias-declaration.
+
+        No new tests. No change in behavior.
+
+        * css/makeprop.pl:
+        * dom/make_names.pl:
+        (printHeaderHead):
+        (printInit):
+        (printTypeHelpersHeaderFile):
+        (printFactoryCppFile):
+        (printFactoryHeaderFile):
+        (printWrapperFactoryCppFile):
+        (printWrapperFactoryHeaderFile):
+
 2020-06-03  Javier Fernandez  <jfernan...@igalia.com>
 
         [css-grid] Dynamically setting "position: absolute" in a grid item doesn't trigger a relayout of that element

Modified: trunk/Source/WebCore/css/makeprop.pl (262485 => 262486)


--- trunk/Source/WebCore/css/makeprop.pl	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebCore/css/makeprop.pl	2020-06-03 14:29:10 UTC (rev 262486)
@@ -618,7 +618,7 @@
 } // namespace WebCore
 
 namespace WTF {
-template<> struct DefaultHash<WebCore::CSSPropertyID> { typedef IntHash<unsigned> Hash; };
+template<> struct DefaultHash<WebCore::CSSPropertyID> { using Hash = IntHash<unsigned>; };
 template<> struct HashTraits<WebCore::CSSPropertyID> : GenericHashTraits<WebCore::CSSPropertyID> {
     static const bool emptyValueIsZero = true;
     static void constructDeletedValue(WebCore::CSSPropertyID& slot) { slot = static_cast<WebCore::CSSPropertyID>(WebCore::lastCSSProperty + 1); }

Modified: trunk/Source/WebCore/dom/make_names.pl (262485 => 262486)


--- trunk/Source/WebCore/dom/make_names.pl	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebCore/dom/make_names.pl	2020-06-03 14:29:10 UTC (rev 262486)
@@ -542,10 +542,8 @@
     my ($F, $prefix, $namespace, $includes, $definitions) = @_;
 
     print F<<END
-#ifndef ${prefix}_${namespace}Names_h
+#pragma once
 
-#define ${prefix}_${namespace}Names_h
-
 $includes
 
 namespace WebCore {
@@ -583,7 +581,6 @@
     if ($isDefinition) {
         print F "\nWEBCORE_EXPORT void init();\n\n";
         print F "} }\n\n";
-        print F "#endif\n\n";
         return;
     }
 
@@ -695,14 +692,11 @@
     open F, ">$headerPath";
     printLicenseHeader($F);
 
-    print F "#ifndef ".$parameters{namespace}."ElementTypeHelpers_h\n";
-    print F "#define ".$parameters{namespace}."ElementTypeHelpers_h\n\n";
+    print F "#pragma once\n\n";
     print F "#include \"".$parameters{namespace}."Names.h\"\n\n";
 
     printTypeHelpers($F, \%allTags);
 
-    print F "#endif\n";
-
     close F;
 }
 
@@ -967,7 +961,7 @@
 
 namespace WebCore {
 
-typedef Ref<$parameters{namespace}Element> (*$parameters{namespace}ConstructorFunction)(const QualifiedName&, Document&$formElementArgumentForDeclaration, bool createdByParser);
+using $parameters{namespace}ConstructorFunction = Ref<$parameters{namespace}Element> (*)(const QualifiedName&, Document&$formElementArgumentForDeclaration, bool createdByParser);
 
 END
     ;
@@ -1087,8 +1081,7 @@
     printLicenseHeader($F);
 
     print F<<END
-#ifndef $parameters{namespace}ElementFactory_h
-#define $parameters{namespace}ElementFactory_h
+#pragma once
 
 #include <wtf/Forward.h>
 
@@ -1126,8 +1119,6 @@
 
 }
 
-#endif // $parameters{namespace}ElementFactory_h
-
 END
 ;
 
@@ -1247,7 +1238,7 @@
 
 namespace WebCore {
 
-typedef JSDOMObject* (*Create$parameters{namespace}ElementWrapperFunction)(JSDOMGlobalObject*, Ref<$parameters{namespace}Element>&&);
+using Create$parameters{namespace}ElementWrapperFunction = JSDOMObject* (*)(JSDOMGlobalObject*, Ref<$parameters{namespace}Element>&&);
 
 END
 ;
@@ -1338,11 +1329,8 @@
 
     printLicenseHeader($F);
 
-    print F "#ifndef JS$parameters{namespace}ElementWrapperFactory_h\n";
-    print F "#define JS$parameters{namespace}ElementWrapperFactory_h\n\n";
+    print F "#pragma once\n\n";
 
-    print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith};
-
     print F <<END
 #include <wtf/Forward.h>
 
@@ -1359,9 +1347,5 @@
 END
     ;
 
-    print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};
-
-    print F "#endif // JS$parameters{namespace}ElementWrapperFactory_h\n";
-
     close F;
 }

Modified: trunk/Source/WebKit/ChangeLog (262485 => 262486)


--- trunk/Source/WebKit/ChangeLog	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebKit/ChangeLog	2020-06-03 14:29:10 UTC (rev 262486)
@@ -1,3 +1,17 @@
+2020-06-03  Rob Buis  <rb...@igalia.com>
+
+        Make generated C++ code use modern C++
+        https://bugs.webkit.org/show_bug.cgi?id=190714
+
+        Reviewed by Jonathan Bedard.
+
+        Replace typedef usage by alias-declaration.
+
+        * Scripts/test-legacyMessages.h:
+        * Scripts/test-superclassMessages.h:
+        * Scripts/testMessages.h:
+        * Scripts/webkit/messages.py:
+
 2020-06-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK4] WTR: Forward key events to the active popup menu

Modified: trunk/Source/WebKit/Scripts/test-legacyMessages.h (262485 => 262486)


--- trunk/Source/WebKit/Scripts/test-legacyMessages.h	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebKit/Scripts/test-legacyMessages.h	2020-06-03 14:29:10 UTC (rev 262486)
@@ -65,7 +65,7 @@
 
 class LoadURL {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadURL; }
     static const bool isSync = false;
@@ -87,7 +87,7 @@
 #if ENABLE(TOUCH_EVENTS)
 class LoadSomething {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadSomething; }
     static const bool isSync = false;
@@ -110,7 +110,7 @@
 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
 class TouchEvent {
 public:
-    typedef std::tuple<const WebKit::WebTouchEvent&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebTouchEvent&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TouchEvent; }
     static const bool isSync = false;
@@ -133,7 +133,7 @@
 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
 class AddEvent {
 public:
-    typedef std::tuple<const WebKit::WebTouchEvent&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebTouchEvent&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_AddEvent; }
     static const bool isSync = false;
@@ -156,7 +156,7 @@
 #if ENABLE(TOUCH_EVENTS)
 class LoadSomethingElse {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadSomethingElse; }
     static const bool isSync = false;
@@ -178,7 +178,7 @@
 
 class DidReceivePolicyDecision {
 public:
-    typedef std::tuple<uint64_t, uint64_t, uint32_t> Arguments;
+    using Arguments = std::tuple<uint64_t, uint64_t, uint32_t>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DidReceivePolicyDecision; }
     static const bool isSync = false;
@@ -199,7 +199,7 @@
 
 class Close {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_Close; }
     static const bool isSync = false;
@@ -215,7 +215,7 @@
 
 class PreferencesDidChange {
 public:
-    typedef std::tuple<const WebKit::WebPreferencesStore&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebPreferencesStore&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_PreferencesDidChange; }
     static const bool isSync = false;
@@ -236,7 +236,7 @@
 
 class SendDoubleAndFloat {
 public:
-    typedef std::tuple<double, float> Arguments;
+    using Arguments = std::tuple<double, float>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SendDoubleAndFloat; }
     static const bool isSync = false;
@@ -257,7 +257,7 @@
 
 class SendInts {
 public:
-    typedef std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> Arguments;
+    using Arguments = std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SendInts; }
     static const bool isSync = false;
@@ -278,7 +278,7 @@
 
 class CreatePlugin {
 public:
-    typedef std::tuple<uint64_t, const WebKit::Plugin::Parameters&> Arguments;
+    using Arguments = std::tuple<uint64_t, const WebKit::Plugin::Parameters&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_CreatePlugin; }
     static const bool isSync = true;
@@ -301,7 +301,7 @@
 
 class RunJavaScriptAlert {
 public:
-    typedef std::tuple<uint64_t, const String&> Arguments;
+    using Arguments = std::tuple<uint64_t, const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_RunJavaScriptAlert; }
     static const bool isSync = true;
@@ -324,7 +324,7 @@
 
 class GetPlugins {
 public:
-    typedef std::tuple<bool> Arguments;
+    using Arguments = std::tuple<bool>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_GetPlugins; }
     static const bool isSync = true;
@@ -347,7 +347,7 @@
 
 class GetPluginProcessConnection {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_GetPluginProcessConnection; }
     static const bool isSync = true;
@@ -372,7 +372,7 @@
 
 class TestMultipleAttributes {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestMultipleAttributes; }
     static const bool isSync = true;
@@ -392,7 +392,7 @@
 
 class TestParameterAttributes {
 public:
-    typedef std::tuple<uint64_t, double, double> Arguments;
+    using Arguments = std::tuple<uint64_t, double, double>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestParameterAttributes; }
     static const bool isSync = false;
@@ -413,7 +413,7 @@
 
 class TemplateTest {
 public:
-    typedef std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> Arguments;
+    using Arguments = std::tuple<const HashMap<String, std::pair<String, uint64_t>>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TemplateTest; }
     static const bool isSync = false;
@@ -434,7 +434,7 @@
 
 class SetVideoLayerID {
 public:
-    typedef std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&> Arguments;
+    using Arguments = std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SetVideoLayerID; }
     static const bool isSync = false;
@@ -456,7 +456,7 @@
 #if PLATFORM(MAC)
 class DidCreateWebProcessConnection {
 public:
-    typedef std::tuple<const IPC::MachPort&, const OptionSet<WebKit::SelectionFlags>&> Arguments;
+    using Arguments = std::tuple<const IPC::MachPort&, const OptionSet<WebKit::SelectionFlags>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DidCreateWebProcessConnection; }
     static const bool isSync = false;
@@ -479,7 +479,7 @@
 #if PLATFORM(MAC)
 class InterpretKeyEvent {
 public:
-    typedef std::tuple<uint32_t> Arguments;
+    using Arguments = std::tuple<uint32_t>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_InterpretKeyEvent; }
     static const bool isSync = true;
@@ -504,7 +504,7 @@
 #if ENABLE(DEPRECATED_FEATURE)
 class DeprecatedOperation {
 public:
-    typedef std::tuple<const IPC::DummyType&> Arguments;
+    using Arguments = std::tuple<const IPC::DummyType&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DeprecatedOperation; }
     static const bool isSync = false;
@@ -527,7 +527,7 @@
 #if ENABLE(EXPERIMENTAL_FEATURE)
 class ExperimentalOperation {
 public:
-    typedef std::tuple<const IPC::DummyType&> Arguments;
+    using Arguments = std::tuple<const IPC::DummyType&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_ExperimentalOperation; }
     static const bool isSync = false;

Modified: trunk/Source/WebKit/Scripts/test-superclassMessages.h (262485 => 262486)


--- trunk/Source/WebKit/Scripts/test-superclassMessages.h	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebKit/Scripts/test-superclassMessages.h	2020-06-03 14:29:10 UTC (rev 262486)
@@ -48,7 +48,7 @@
 
 class LoadURL {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadURL; }
     static const bool isSync = false;
@@ -70,7 +70,7 @@
 #if ENABLE(TEST_FEATURE)
 class TestAsyncMessage {
 public:
-    typedef std::tuple<WebKit::TestTwoStateEnum> Arguments;
+    using Arguments = std::tuple<WebKit::TestTwoStateEnum>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestAsyncMessage; }
     static const bool isSync = false;
@@ -100,7 +100,7 @@
 #if ENABLE(TEST_FEATURE)
 class TestAsyncMessageWithNoArguments {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestAsyncMessageWithNoArguments; }
     static const bool isSync = false;
@@ -125,7 +125,7 @@
 #if ENABLE(TEST_FEATURE)
 class TestAsyncMessageWithMultipleArguments {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestAsyncMessageWithMultipleArguments; }
     static const bool isSync = false;
@@ -150,7 +150,7 @@
 #if ENABLE(TEST_FEATURE)
 class TestAsyncMessageWithConnection {
 public:
-    typedef std::tuple<const int&> Arguments;
+    using Arguments = std::tuple<const int&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestAsyncMessageWithConnection; }
     static const bool isSync = false;
@@ -179,7 +179,7 @@
 
 class TestSyncMessage {
 public:
-    typedef std::tuple<uint32_t> Arguments;
+    using Arguments = std::tuple<uint32_t>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestSyncMessage; }
     static const bool isSync = true;
@@ -204,7 +204,7 @@
 
 class TestSynchronousMessage {
 public:
-    typedef std::tuple<bool> Arguments;
+    using Arguments = std::tuple<bool>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestSynchronousMessage; }
     static const bool isSync = true;

Modified: trunk/Source/WebKit/Scripts/testMessages.h (262485 => 262486)


--- trunk/Source/WebKit/Scripts/testMessages.h	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebKit/Scripts/testMessages.h	2020-06-03 14:29:10 UTC (rev 262486)
@@ -65,7 +65,7 @@
 
 class LoadURL {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadURL; }
     static const bool isSync = false;
@@ -87,7 +87,7 @@
 #if ENABLE(TOUCH_EVENTS)
 class LoadSomething {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadSomething; }
     static const bool isSync = false;
@@ -110,7 +110,7 @@
 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION))
 class TouchEvent {
 public:
-    typedef std::tuple<const WebKit::WebTouchEvent&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebTouchEvent&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TouchEvent; }
     static const bool isSync = false;
@@ -133,7 +133,7 @@
 #if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION))
 class AddEvent {
 public:
-    typedef std::tuple<const WebKit::WebTouchEvent&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebTouchEvent&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_AddEvent; }
     static const bool isSync = false;
@@ -156,7 +156,7 @@
 #if ENABLE(TOUCH_EVENTS)
 class LoadSomethingElse {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_LoadSomethingElse; }
     static const bool isSync = false;
@@ -178,7 +178,7 @@
 
 class DidReceivePolicyDecision {
 public:
-    typedef std::tuple<uint64_t, uint64_t, uint32_t> Arguments;
+    using Arguments = std::tuple<uint64_t, uint64_t, uint32_t>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DidReceivePolicyDecision; }
     static const bool isSync = false;
@@ -199,7 +199,7 @@
 
 class Close {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_Close; }
     static const bool isSync = false;
@@ -215,7 +215,7 @@
 
 class PreferencesDidChange {
 public:
-    typedef std::tuple<const WebKit::WebPreferencesStore&> Arguments;
+    using Arguments = std::tuple<const WebKit::WebPreferencesStore&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_PreferencesDidChange; }
     static const bool isSync = false;
@@ -236,7 +236,7 @@
 
 class SendDoubleAndFloat {
 public:
-    typedef std::tuple<double, float> Arguments;
+    using Arguments = std::tuple<double, float>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SendDoubleAndFloat; }
     static const bool isSync = false;
@@ -257,7 +257,7 @@
 
 class SendInts {
 public:
-    typedef std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&> Arguments;
+    using Arguments = std::tuple<const Vector<uint64_t>&, const Vector<Vector<uint64_t>>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SendInts; }
     static const bool isSync = false;
@@ -278,7 +278,7 @@
 
 class CreatePlugin {
 public:
-    typedef std::tuple<uint64_t, const WebKit::Plugin::Parameters&> Arguments;
+    using Arguments = std::tuple<uint64_t, const WebKit::Plugin::Parameters&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_CreatePlugin; }
     static const bool isSync = true;
@@ -301,7 +301,7 @@
 
 class RunJavaScriptAlert {
 public:
-    typedef std::tuple<uint64_t, const String&> Arguments;
+    using Arguments = std::tuple<uint64_t, const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_RunJavaScriptAlert; }
     static const bool isSync = true;
@@ -324,7 +324,7 @@
 
 class GetPlugins {
 public:
-    typedef std::tuple<bool> Arguments;
+    using Arguments = std::tuple<bool>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_GetPlugins; }
     static const bool isSync = true;
@@ -347,7 +347,7 @@
 
 class GetPluginProcessConnection {
 public:
-    typedef std::tuple<const String&> Arguments;
+    using Arguments = std::tuple<const String&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_GetPluginProcessConnection; }
     static const bool isSync = true;
@@ -372,7 +372,7 @@
 
 class TestMultipleAttributes {
 public:
-    typedef std::tuple<> Arguments;
+    using Arguments = std::tuple<>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestMultipleAttributes; }
     static const bool isSync = true;
@@ -392,7 +392,7 @@
 
 class TestParameterAttributes {
 public:
-    typedef std::tuple<uint64_t, double, double> Arguments;
+    using Arguments = std::tuple<uint64_t, double, double>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TestParameterAttributes; }
     static const bool isSync = false;
@@ -413,7 +413,7 @@
 
 class TemplateTest {
 public:
-    typedef std::tuple<const HashMap<String, std::pair<String, uint64_t>>&> Arguments;
+    using Arguments = std::tuple<const HashMap<String, std::pair<String, uint64_t>>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_TemplateTest; }
     static const bool isSync = false;
@@ -434,7 +434,7 @@
 
 class SetVideoLayerID {
 public:
-    typedef std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&> Arguments;
+    using Arguments = std::tuple<const WebCore::GraphicsLayer::PlatformLayerID&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_SetVideoLayerID; }
     static const bool isSync = false;
@@ -456,7 +456,7 @@
 #if PLATFORM(MAC)
 class DidCreateWebProcessConnection {
 public:
-    typedef std::tuple<const IPC::MachPort&, const OptionSet<WebKit::SelectionFlags>&> Arguments;
+    using Arguments = std::tuple<const IPC::MachPort&, const OptionSet<WebKit::SelectionFlags>&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DidCreateWebProcessConnection; }
     static const bool isSync = false;
@@ -479,7 +479,7 @@
 #if PLATFORM(MAC)
 class InterpretKeyEvent {
 public:
-    typedef std::tuple<uint32_t> Arguments;
+    using Arguments = std::tuple<uint32_t>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_InterpretKeyEvent; }
     static const bool isSync = true;
@@ -504,7 +504,7 @@
 #if ENABLE(DEPRECATED_FEATURE)
 class DeprecatedOperation {
 public:
-    typedef std::tuple<const IPC::DummyType&> Arguments;
+    using Arguments = std::tuple<const IPC::DummyType&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_DeprecatedOperation; }
     static const bool isSync = false;
@@ -527,7 +527,7 @@
 #if ENABLE(EXPERIMENTAL_FEATURE)
 class ExperimentalOperation {
 public:
-    typedef std::tuple<const IPC::DummyType&> Arguments;
+    using Arguments = std::tuple<const IPC::DummyType&>;
 
     static IPC::MessageName name() { return IPC::MessageName::WebPage_ExperimentalOperation; }
     static const bool isSync = false;

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (262485 => 262486)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2020-06-03 13:48:05 UTC (rev 262485)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2020-06-03 14:29:10 UTC (rev 262486)
@@ -140,7 +140,7 @@
 
     result.append('class %s {\n' % message.name)
     result.append('public:\n')
-    result.append('    typedef %s Arguments;\n' % arguments_type(message))
+    result.append('    using Arguments = %s;\n' % arguments_type(message))
     result.append('\n')
     result.append('    static IPC::MessageName name() { return IPC::MessageName::%s_%s; }\n' % (receiver.name, message.name))
     result.append('    static const bool isSync = %s;\n' % ('false', 'true')[message.reply_parameters != None and not message.has_attribute(ASYNC_ATTRIBUTE)])
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to