tanghong123 / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fails to build with sunpro compiler on Sun Solaris. #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?

svn revision 78
SunOS dev01-mel 5.10 Generic_118833-17 sun4u sparc SUNW,Sun-Fire-V440
CC: Sun C++ 5.8 Patch 121017-11 2007/05/02

Please provide any additional information below.

The following patch fixes it for me.

Index: test/gtest-filepath_test.cc
===================================================================
--- test/gtest-filepath_test.cc (revision 78)
+++ test/gtest-filepath_test.cc (working copy)
@@ -61,6 +61,11 @@
 #define PATH_SEP "/"
 #endif  // GTEST_OS_WINDOWS

+
+#ifdef GTEST_OS_SUN
+#include <unistd.h>
+#endif  // GTEST_OS_SUN
+
 namespace testing {
 namespace internal {
 namespace {
Index: test/gtest_break_on_failure_unittest.py
===================================================================
--- test/gtest_break_on_failure_unittest.py (revision 78)
+++ test/gtest_break_on_failure_unittest.py (working copy)
@@ -81,7 +81,7 @@
   # On Unix-like systems, the lowest 8 bits of the exit code is the
   # signal number that killed the process (or 0 if it wasn't killed by
   # a signal).
-  return (exit_code & 255) != 0
+  return (exit_code>>8) == (signal.SIGSEGV + 128)

 # The unit test.
Index: include/gtest/internal/gtest-port.h
===================================================================
--- include/gtest/internal/gtest-port.h (revision 78)
+++ include/gtest/internal/gtest-port.h (working copy)
@@ -145,6 +145,11 @@
 #define GTEST_OS_MAC
 #elif defined __linux__
 #define GTEST_OS_LINUX
+#elif defined __sun
+// TODO(johnsyweb@gmail.com): GTEST_OS_SUN is currently used to mean both "The
+// OS is Solaris" and "The compiler is Sunpro". These meanings should
really be
+// separated in order to better support Solaris compilers other than Sunpro.
+#define GTEST_OS_SUN
 #endif  // _MSC_VER

 // Determines whether ::std::string and ::string are available.
@@ -249,7 +254,7 @@
 //   struct Foo {
 //     Foo() { ... }
 //   } GTEST_ATTRIBUTE_UNUSED;
-#if defined(__GNUC__) && !defined(COMPILER_ICC)
+#if defined(__GNUC__) && !defined(COMPILER_ICC) || defined(GTEST_OS_SUN)
 #define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused))
 #else
 #define GTEST_ATTRIBUTE_UNUSED

Original issue reported on code.google.com by johnsy...@gmail.com on 8 Aug 2008 at 11:39

GoogleCodeExporter commented 9 years ago
Thanks for the patch.  We don't have access to a Solaris machine so this 
platform is
kinda unsupported.  We are relying on users like you to make Google Test work 
on Solaris.

Would you mind signing a CLA?  This is required before we are able to use the 
code
you sent.  The CLA protects both you and Google.  You can do it on-line and the
instructions are at 
http://code.google.com/p/googletest/wiki/GoogleTestDevGuide.  Thanks.

Original comment by shiq...@gmail.com on 8 Sep 2008 at 11:37

GoogleCodeExporter commented 9 years ago

Original comment by shiq...@gmail.com on 30 Sep 2008 at 10:05

GoogleCodeExporter commented 9 years ago
This should be fixed in 1.2.0.  Please re-open if you still see the problem 
after 
upgrading to 1.2.0.

Original comment by shiq...@gmail.com on 2 Dec 2008 at 4:59