Fixed compilation warnings related to C++ template due to GCC 4.8. 65/13565/3
authorJoone Hur <joone.hur@intel.com>
Mon, 9 Dec 2013 23:32:20 +0000 (15:32 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 11 Dec 2013 00:45:17 +0000 (16:45 -0800)
The following warnings have been occurred since GCC was upgraded to 4.8.

/home/abuild/rpmbuild/BUILD/webkit2-efl-123997_0.11.49/Source/WTF/wtf/HashMap.h:137:42: warning: invalid use of incomplete type 'class WTF::HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>' [enabled by default]
         class HashMapKeysProxy : private HashMap {
                                       ^

/home/abuild/rpmbuild/BUILD/webkit2-efl-123997_0.11.49/Source/WTF/wtf/Vector.h:637:44: warning: invalid use of incomplete type ‘class WTF::Vector<T, inlineCapacity>’ [enabled by default]
         class VectorReverseProxy : private Vector {
                                            ^
This can be fixed by moving outside nested classes(HashMapKeyProxy and HashMapValuesProxy), and leave only declaration part inside HashMap. For more details, refer to http://trac.webkit.org/changeset/147345. In case of Vector, the template parameter(T) is added to the base class(Vector) in VectorReverseProxy class for fixing the second warning.

Change-Id: I5302077c1823d9c41650bff1f972ae246d6d6f06

Source/WTF/wtf/HashMap.h
Source/WTF/wtf/Vector.h

index 9010474..1e89aae 100644 (file)
@@ -134,29 +134,35 @@ namespace WTF {
     private:
         AddResult inlineAdd(const KeyType&, MappedPassInReferenceType);
 
-        class HashMapKeysProxy : private HashMap {
+        HashTableType m_impl;
+    };
+
+    template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg>
+    class HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::HashMapKeysProxy : 
+        private HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> {
         public:
-            typedef typename HashMap::iterator::Keys iterator;
-            typedef typename HashMap::const_iterator::Keys const_iterator;
-            
+            typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType;
+            typedef typename HashMapType::iterator::Keys iterator;
+            typedef typename HashMapType::const_iterator::Keys const_iterator;
+
             iterator begin()
             {
-                return HashMap::begin().keys();
+                return HashMapType::begin().keys();
             }
-            
+
             iterator end()
             {
-                return HashMap::end().keys();
+                return HashMapType::end().keys();
             }
 
             const_iterator begin() const
             {
-                return HashMap::begin().keys();
+                return HashMapType::begin().keys();
             }
-            
+
             const_iterator end() const
             {
-                return HashMap::end().keys();
+                return HashMapType::end().keys();
             }
 
         private:
@@ -167,31 +173,34 @@ namespace WTF {
             HashMapKeysProxy(const HashMapKeysProxy&);
             HashMapKeysProxy& operator=(const HashMapKeysProxy&);
             ~HashMapKeysProxy();
-        };
+    };
 
-        class HashMapValuesProxy : private HashMap {
+    template<typename KeyArg, typename MappedArg, typename HashArg,  typename KeyTraitsArg, typename MappedTraitsArg>
+    class HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::HashMapValuesProxy : 
+        private HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> {
         public:
-            typedef typename HashMap::iterator::Values iterator;
-            typedef typename HashMap::const_iterator::Values const_iterator;
-            
+            typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType;
+            typedef typename HashMapType::iterator::Values iterator;
+            typedef typename HashMapType::const_iterator::Values const_iterator;
+
             iterator begin()
             {
-                return HashMap::begin().values();
+                return HashMapType::begin().values();
             }
-            
+
             iterator end()
             {
-                return HashMap::end().values();
+                return HashMapType::end().values();
             }
 
             const_iterator begin() const
             {
-                return HashMap::begin().values();
+                return HashMapType::begin().values();
             }
-            
+
             const_iterator end() const
             {
-                return HashMap::end().values();
+                return HashMapType::end().values();
             }
 
         private:
@@ -202,9 +211,6 @@ namespace WTF {
             HashMapValuesProxy(const HashMapValuesProxy&);
             HashMapValuesProxy& operator=(const HashMapValuesProxy&);
             ~HashMapValuesProxy();
-        };
-
-        HashTableType m_impl;
     };
 
     template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits : KeyValuePairHashTraits<KeyTraits, MappedTraits> {
index a3b6a0e..9074e14 100644 (file)
@@ -634,7 +634,7 @@ namespace WTF {
         template<typename U> U* expandCapacity(size_t newMinCapacity, U*); 
         template<typename U> void appendSlowCase(const U&);
 
-        class VectorReverseProxy : private Vector {
+        class VectorReverseProxy : private Vector<T> {
         public:
             typedef typename Vector::reverse_iterator iterator;
             typedef typename Vector::const_reverse_iterator const_iterator;