clucene: Compile with clang's libc++
authorBradley T. Hughes <bradley.hughes@nokia.com>
Wed, 30 May 2012 09:41:06 +0000 (11:41 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 19 Jun 2012 05:02:04 +0000 (07:02 +0200)
When using clang's libc++, the 'using namespace std;' in CLucene's
StdHeader.h causes ambiguity between wcschr() from wchar.h and
std::wcschr() from cwchar (which is automatically included by libc++).

The only symbols used from the std namespace are std::min() and
std::max() so only pull these in, not the whole std namespace.

Change-Id: I5700f6a221ee0667d4a3bb85110f6fea17a121bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/assistant/3rdparty/clucene/src/CLucene/StdHeader.h

index fbb3fd9..224d400 100644 (file)
@@ -463,8 +463,16 @@ void CLDebugBreak(); //define a debugbreak function
 
 //use std namespace
 #ifndef LUCENE_NO_STDC_NAMESPACE
+#ifdef _LIBCPP_VERSION
+// clang's libc++ pulls in cwchar, clucene pulls in wchar.h and the entire std
+// namespace which causes ambiguity between ::wcschar() and std::wcschar(), but
+// clucene is only using std::min() and std::max()
+using std::min;
+using std::max;
+#else
 using namespace std;
 #endif
+#endif
 
 
 ////////////////////////////////////////////////////////