Fix CLucene compile error with VS 2015.
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>
Wed, 3 Jun 2015 15:26:54 +0000 (17:26 +0200)
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>
Thu, 4 Jun 2015 10:23:19 +0000 (10:23 +0000)
Task-number: QTBUG-45961
Task-number: QTBUG-45976
Task-number: QTBUG-46344
Change-Id: Ic001298e96ae474a4939c445b7816a331135dd53
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h
src/assistant/3rdparty/clucene/src/CLucene/config/CompilerGcc.h
src/assistant/3rdparty/clucene/src/CLucene/config/CompilerMsvc.h
src/assistant/3rdparty/clucene/src/CLucene/debug/condition.cpp
src/assistant/3rdparty/clucene/src/CLucene/util/VoidList.h
src/assistant/3rdparty/clucene/src/CLucene/util/VoidMap.h

index 439bc94..9779914 100644 (file)
@@ -122,7 +122,10 @@ extern int _lucene_counter_break; //can set a watch on this
  #error "CLucene can't compile without the vector header"
 #endif
 
-#if !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
+#if !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_STD_UNORDERED_MAP) && defined(_CL_HAVE_STD_UNORDERED_SET)
+    #include <unordered_map>
+    #include <unordered_set>
+#elif !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
        //hashing is all or nothing!
        #include <hash_map>
        #include <hash_set>
index 3bf91b3..6aac690 100644 (file)
@@ -45,6 +45,8 @@
 
 #define CL_NS_HASHING(func) __gnu_cxx::func
 #define LUCENE_DISABLE_HASHING //we could enable this, but so far test show that the hashing is slower :(
+#define CL_HASH_MAP hash_map
+#define CL_HASH_SET hash_set
 
 //define the file functions
 #define fileSeek lseek
index 8578859..6b3f768 100644 (file)
        #if (_MSC_VER < 1310) || defined(_STLPORT_VERSION)
                #define CL_NS_HASHING(func) std::func //the namespace is different on VC 7.0
        #else
-               #define CL_NS_HASHING(func) stdext::func
+        #if _MSC_VER >= 1900
+            #undef _CL_HAVE_EXT_HASH_MAP
+            #undef _CL_HAVE_EXT_HASH_SET
+
+            #define CL_HASH_MAP unordered_map
+            #define CL_HASH_SET unordered_set
+            #define _CL_HAVE_STD_UNORDERED_MAP 1
+            #define _CL_HAVE_STD_UNORDERED_SET 1
+            #define CL_NS_HASHING(func) std::func
+        #else
+            #define CL_HASH_MAP hash_map
+            #define CL_HASH_SET hash_set
+            #define CL_NS_HASHING(func) stdext::func
+        #endif
        #endif
+
        #define LUCENE_STATIC_CONSTANT_SYNTAX 1
 
     #if _MSC_FULL_VER >= 140050320
index 8554194..7fab8d7 100644 (file)
@@ -37,7 +37,7 @@ void _Cnd_OutDebug( const char* FormattedMsg, const char* StrTitle, const char*
 
 void __cnd_FormatDebug( const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal ) {
        char M[512];
-    char* StrTitle = NULL;
+    const char* StrTitle = NULL;
 
        if( Mes2 )
                _snprintf(M,512,"file:%s line:%d\n%s",File,Line,Mes2);
index b31baba..5deb69d 100644 (file)
@@ -139,11 +139,11 @@ public:
 template<typename _kt,
        typename _Comparator=CL_NS(util)::Compare::TChar,
        typename _valueDeletor=CL_NS(util)::Deletor::Dummy> 
-class CLHashList:public __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor>
+class CLHashList:public __CLList<_kt, CL_NS_HASHING(CL_HASH_SET)<_kt,_Comparator> , _valueDeletor>
 {
 public:
        CLHashList ( const bool deleteValue=true ):
-         __CLList<_kt, CL_NS_HASHING(hash_set)<_kt,_Comparator> , _valueDeletor>(deleteValue)
+         __CLList<_kt, CL_NS_HASHING(CL_HASH_SET)<_kt,_Comparator> , _valueDeletor>(deleteValue)
        {
        }
 };
index 1153a01..2236702 100644 (file)
@@ -153,16 +153,16 @@ public:
 
  //a CLSet with CLHashMap traits
 template<typename _kt, typename _vt, 
-       typename _Compare,
+       typename CL_Compare,
        typename _EqualDummy,
        typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
        typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
 class CLHashMap:public __CLMap<_kt,_vt,
-       CL_NS_STD(map)<_kt,_vt, _Compare>,
+       CL_NS_STD(map)<_kt,_vt, CL_Compare>,
        _KeyDeletor,_ValueDeletor>
 {
-       typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base;
-       typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>,
+       typedef typename CL_NS_STD(map)<_kt,_vt,CL_Compare> _base;
+       typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, CL_Compare>,
                _KeyDeletor,_ValueDeletor> _this;
 public:
        CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
@@ -180,10 +180,10 @@ template<typename _kt, typename _vt,
        typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
        typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
 class CLHashMap:public __CLMap<_kt,_vt,
-       CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>,
+       CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>,
        _KeyDeletor,_ValueDeletor>
 {
-       typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher,_Equals>,
+       typedef __CLMap<_kt,_vt, CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher,_Equals>,
                _KeyDeletor,_ValueDeletor> _this;
 public:
        CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
@@ -201,10 +201,10 @@ template<typename _kt, typename _vt,
        typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
        typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
 class CLHashMap:public __CLMap<_kt,_vt,
-       CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>,
+       CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher>,
        _KeyDeletor,_ValueDeletor>
 {
-       typedef __CLMap<_kt,_vt, CL_NS_HASHING(hash_map)<_kt,_vt, _Hasher>,
+       typedef __CLMap<_kt,_vt, CL_NS_HASHING(CL_HASH_MAP)<_kt,_vt, _Hasher>,
                _KeyDeletor,_ValueDeletor> _this;
 public:
        CLHashMap ( const bool deleteKey=false, const bool deleteValue=false )
@@ -218,15 +218,15 @@ public:
 //A collection that contains no duplicates
 //does not guarantee that the order will remain constant over time
 template<typename _kt, typename _vt, 
-       typename _Compare,
+       typename CL_Compare,
        typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
        typename _ValueDeletor=CL_NS(util)::Deletor::Dummy>
 class CLSet:public __CLMap<_kt,_vt,
-       CL_NS_STD(map)<_kt,_vt, _Compare>,
+       CL_NS_STD(map)<_kt,_vt, CL_Compare>,
        _KeyDeletor,_ValueDeletor>
 {
-       typedef typename CL_NS_STD(map)<_kt,_vt,_Compare> _base;
-       typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, _Compare>,
+       typedef typename CL_NS_STD(map)<_kt,_vt,CL_Compare> _base;
+       typedef __CLMap<_kt, _vt, CL_NS_STD(map)<_kt,_vt, CL_Compare>,
                _KeyDeletor,_ValueDeletor> _this;
 public:
        CLSet ( const bool deleteKey=false, const bool deleteValue=false )