I'm compiling with xlC 7.0 on AIX 5.3.

I see fails like this:

"./gtest/gtest.h", line 631.10: 1540-0219 (S) The call to
"FormatForFailureMessage" has no best match.
"./gtest/gtest.h", line 631.34: 1540-1228 (I) Argument number 1 is an
lvalue of type "const char * const".
"./gtest/internal/gtest-internal.h", line 250.15: 1540-1202 (I) No
candidate is better than
"testing::internal::FormatForFailureMessage<const char>(const char
*)".
"./gtest/gtest.h", line 631.34: 1540-1231 (I) The conversion from
argument number 1 to "const char *" uses "an lvalue-to-rvalue
transformation".
"./gtest/internal/gtest-internal.h", line 243.15: 1540-1202 (I) No
candidate is better than
"testing::internal::FormatForFailureMessage<const char *>(const char *
const &)".
"./gtest/gtest.h", line 631.34: 1540-1231 (I) The conversion from
argument number 1 to "const char * const &" uses "the identity
conversion".
"./gtest/gtest.h", line 629.8: 1540-0700 (I) The previous message was
produced while processing
"testing::internal::FormatForComparisonFailureMessage<const char
*,const char *>(const char * const &, const char * const &)".
"./gtest/gtest.h", line 752.1: 1540-0700 (I) The previous message was
produced while processing "testing::internal::CmpHelperNE<const char
*,const char *>(const char *, const char *, const char * const &,
const char * const &)".
"google/protobuf/stubs/common_unittest.cc", line 317.3: 1540-0700 (I)
The previous message was produced while processing
"google::protobuf::<unnamed>::ClosureTest_TestPermanentClosureMethod2_Test::TestBody()".



Fortunately, it looks like this problem has already been tackled with
Nokia's Symbian compiler. (Yay!  It's a bit of a tricky fix.)

I'm attaching my draft of a patch (based on 2.0.1 release since I
don't see any Subversion repos of trunk) that fixed it up to compile
on AIX for me by playing with the defines in gtest and tweaking the
docs.

Would it be appropriate to create an Issue?

-Travis

%%%%
Index: src/gtest/gtest-message.h
===================================================================
--- src/gtest/gtest-message.h   (revision 1)
+++ src/gtest/gtest-message.h   (working copy)
@@ -114,7 +114,7 @@
   }

   ~Message() { delete ss_; }
-#ifdef __SYMBIAN32__
+#ifdef GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP
   // Streams a value (either a pointer or not) to this object.
   template <typename T>
   inline Message& operator <<(const T& value) {
@@ -151,7 +151,7 @@
     }
     return *this;
   }
-#endif  // __SYMBIAN32__
+#endif  // GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

   // Since the basic IO manipulators are overloaded for both narrow
   // and wide streams, we have to provide this specialized definition
@@ -199,11 +199,11 @@
   }

  private:
-#ifdef __SYMBIAN32__
-  // These are needed as the Nokia Symbian Compiler cannot decide
between
-  // const T& and const T* in a function template. The Nokia compiler
_can_
-  // decide between class template specializations for T and T*, so a
-  // tr1::type_traits-like is_pointer works, and we can overload on
that.
+#ifdef GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP
+  // These are needed as some compilers cannot decide between const
T& and
+  // const T* in a function template.  The compilers _can_ decide
between
+  // class template specializations for T and T*, so a
tr1::type_traits-like
+  // is_pointer works, and we can overload on that.
   template <typename T>
   inline void StreamHelper(internal::true_type dummy, T* pointer) {
     if (pointer == NULL) {
@@ -216,7 +216,7 @@
   inline void StreamHelper(internal::false_type dummy, const T&
value) {
     ::GTestStreamToHelper(ss_, value);
   }
-#endif  // __SYMBIAN32__
+#endif  // GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

   // We'll hold the text streamed to this object here.
   internal::StrStream* const ss_;
Index: src/gtest/internal/gtest-internal.h
===================================================================
--- src/gtest/internal/gtest-internal.h (revision 1)
+++ src/gtest/internal/gtest-internal.h (working copy)
@@ -210,10 +210,10 @@

 // Formats a value to be used in a failure message.

-#ifdef __SYMBIAN32__
+#ifdef GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

-// These are needed as the Nokia Symbian Compiler cannot decide
between
-// const T& and const T* in a function template. The Nokia compiler
_can_
+// These are needed as some compilers cannot decide between
+// const T& and const T* in a function template. The compilers _can_
 // decide between class template specializations for T and T*, so a
 // tr1::type_traits-like is_pointer works, and we can overload on
that.

@@ -251,7 +251,7 @@
   return StreamableToString(static_cast<const void*>(pointer));
 }

-#endif  // __SYMBIAN32__
+#endif  // GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

 // These overloaded versions handle narrow and wide characters.
 String FormatForFailureMessage(char ch);
Index: src/gtest/internal/gtest-port.h
===================================================================
--- src/gtest/internal/gtest-port.h     (revision 1)
+++ src/gtest/internal/gtest-port.h     (working copy)
@@ -199,6 +199,15 @@
 #include <sys/mman.h>
 #endif  // GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)

+// These are needed as the Nokia Symbian Compiler and IBM xlC
compiler
+// cannot decide between const T& and const T* in a function
template. The
+// compilers _can_ decide between class template specializations for
T
+// and T*, so a tr1::type_traits-like is_pointer works, and we can
overload
+// on that.
+#if defined(__SYMBIAN__) || defined(__xlC__)
+#define GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP
+#endif
+
 // Defines some utility macros.

 // The GNU compiler emits a warning if nested "if" statements are
followed by
@@ -438,10 +447,10 @@

 // Defines tr1::is_pointer (only needed for Symbian).

-#ifdef __SYMBIAN32__
+#ifdef GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

-// Symbian does not have tr1::type_traits, so we define our own
is_pointer
-// These are needed as the Nokia Symbian Compiler cannot decide
between
+// Some compiler do not have tr1::type_traits, so we define our own
+// is_pointer.  These are needed as the compilers cannot decide
between
 // const T& and const T* in a function template.

 template <bool bool_value>
@@ -460,7 +469,7 @@
 template <typename T>
 struct is_pointer<T*> : public true_type {};

-#endif  // __SYMBIAN32__
+#endif  // GTEST_COMPILER_NEEDS_POINTER_TEMPLETE_SELECTION_HELP

 // Defines BiggestInt as the biggest signed integer type the compiler
 // supports.
Index: src/gtest/gtest.h
===================================================================
--- src/gtest/gtest.h   (revision 1)
+++ src/gtest/gtest.h   (working copy)
@@ -59,6 +59,7 @@
 // The following platform macros are used throughout Google Test:
 //   _WIN32_WCE      Windows CE     (set in project files)
 //   __SYMBIAN32__   Symbian        (set by Symbian tool chain)
+//   __xlC__         IBM's xlC      (set by IBM's xlC C++ compilers)
 //
 // Note that even though _MSC_VER and _WIN32_WCE really indicate a
compiler
 // and a Win32 implementation, respectively, we use them to indicate
the
%%%%

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to