From d965ca66d99df9fde5a8f7162f2b3e0fea830f13 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 8 Jun 2016 21:41:45 -0400 Subject: [PATCH] Fixed broken Sun Studio compile (Issue 179) --- GNUmakefile | 32 +++++++++++++------------------- ida.cpp | 4 ++-- zdeflate.cpp | 2 +- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index a7a26efb..745ff020 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -146,15 +146,6 @@ endif endif endif -ifneq ($(IS_SUN),0) -IS_64 := $(shell isainfo -b 2>/dev/null | grep -i -c "64") -ifeq ($(SUN_COMPILER)$(IS_64),11) -CXXFLAGS := -DNDEBUG -g3 -xO2 -native -template=no%extdef -m64 -Kpic -else ifeq ($(SUN_COMPILER)$(IS_64),10) -CXXFLAGS := -DNDEBUG -g3 -xO2 -native -template=no%extdef -m32 -endif -endif # SunOS - # Allow use of "/" operator for GNU Assembler ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) ifeq ($(IS_GAS),1) @@ -198,6 +189,10 @@ ifneq ($(IS_MINGW),0) LDLIBS += -lws2_32 endif +ifneq ($(IS_SUN),0) +LDLIBS += -lnsl -lsocket +endif + ifeq ($(IS_LINUX),1) LDFLAGS += -pthread ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp) @@ -218,23 +213,22 @@ LDFLAGS += -flat_namespace -undefined suppress -m endif endif -ifneq ($(IS_SUN),0) -LDLIBS += -lnsl -lsocket -M32OR64 = -m$(shell isainfo -b) -endif - ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler -CXXFLAGS ?= -DNDEBUG -O -g0 -native -template=no%extdef $(M32OR64) -LDFLAGS = -AR = $(CXX) -ARFLAGS = -xar -o -RANLIB = true +IS_64 := $(shell isainfo -b 2>/dev/null | grep -i -c "64") +ifeq ($(SUN_COMPILER)$(IS_64),11) +CXXFLAGS := -DNDEBUG -g3 -xO2 -native -template=no%extdef -m64 -Kpic +else ifeq ($(SUN_COMPILER)$(IS_64),10) +CXXFLAGS := -DNDEBUG -g3 -xO2 -native -template=no%extdef -m32 +endif SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])") ifneq ($(SUN_CC10_BUGGY),0) # -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 and was fixed in May 2010 # remove it if you get "already had a body defined" errors in vector.cc CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC endif +AR = $(CXX) +ARFLAGS = -xar -o +RANLIB = true endif # Undefined Behavior Sanitizer (UBsan) testing. There's no sense in diff --git a/ida.cpp b/ida.cpp index 363fe98a..04f8850d 100644 --- a/ida.cpp +++ b/ida.cpp @@ -394,11 +394,11 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo m_possiblePadding = false; } -#if defined(_MSC_VER) && !defined(__MWERKS__) && (_MSC_VER <= 1300) +#if defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__MWERKS__) // VC60 and VC7 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one typedef std::reverse_bidirectional_iterator RevIt; #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) - typedef std::reverse_iterator RevIt; + typedef std::reverse_iterator RevIt; #else typedef std::reverse_iterator RevIt; #endif diff --git a/zdeflate.cpp b/zdeflate.cpp index 5adfa5b8..494e2836 100644 --- a/zdeflate.cpp +++ b/zdeflate.cpp @@ -665,7 +665,7 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType) // VC60 and VC7 workaround: built-in std::reverse_iterator has two template parameters, Dinkumware only has one typedef std::reverse_bidirectional_iterator RevIt; #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) - typedef std::reverse_iterator RevIt; + typedef std::reverse_iterator RevIt; #else typedef std::reverse_iterator RevIt; #endif