From 63536a7bbf9d9766532bf60c3046abebd3dafceb Mon Sep 17 00:00:00 2001 From: Joone Hur Date: Mon, 9 Dec 2013 15:32:20 -0800 Subject: [PATCH] Fixed compilation warnings related to C++ template due to GCC 4.8. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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' [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’ [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 | 54 +++++++++++++++++++++++++++--------------------- Source/WTF/wtf/Vector.h | 2 +- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Source/WTF/wtf/HashMap.h b/Source/WTF/wtf/HashMap.h index 9010474..1e89aae 100644 --- a/Source/WTF/wtf/HashMap.h +++ b/Source/WTF/wtf/HashMap.h @@ -134,29 +134,35 @@ namespace WTF { private: AddResult inlineAdd(const KeyType&, MappedPassInReferenceType); - class HashMapKeysProxy : private HashMap { + HashTableType m_impl; + }; + + template + class HashMap::HashMapKeysProxy : + private HashMap { public: - typedef typename HashMap::iterator::Keys iterator; - typedef typename HashMap::const_iterator::Keys const_iterator; - + typedef HashMap 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 + class HashMap::HashMapValuesProxy : + private HashMap { public: - typedef typename HashMap::iterator::Values iterator; - typedef typename HashMap::const_iterator::Values const_iterator; - + typedef HashMap 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 struct HashMapValueTraits : KeyValuePairHashTraits { diff --git a/Source/WTF/wtf/Vector.h b/Source/WTF/wtf/Vector.h index a3b6a0e..9074e14 100644 --- a/Source/WTF/wtf/Vector.h +++ b/Source/WTF/wtf/Vector.h @@ -634,7 +634,7 @@ namespace WTF { template U* expandCapacity(size_t newMinCapacity, U*); template void appendSlowCase(const U&); - class VectorReverseProxy : private Vector { + class VectorReverseProxy : private Vector { public: typedef typename Vector::reverse_iterator iterator; typedef typename Vector::const_reverse_iterator const_iterator; -- 2.7.4