summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2011-10-12 06:13:37 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2011-10-12 06:13:37 +0000
commit69de3b14426c96725bbf19d4c828b193f0f175b2 (patch)
treec863e7c992fa355e45d1fe7258f56664bfdda4d5
parentd8257ec3e567f0f7509cd6dba11faea9c67c9cb5 (diff)
downloadcryptopp-69de3b14426c96725bbf19d4c828b193f0f175b2.tar.gz
fix compile with clang 2.9 (Jeff Walton)
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@532 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--GNUmakefile7
-rw-r--r--misc.h4
2 files changed, 8 insertions, 3 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 93e3d89..67896b5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -28,6 +28,7 @@ ifeq ($(ISX86),1)
GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "^gcc version (4.[2-9]|[5-9])")
INTEL_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)")
ICC111_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
+CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "^clang version")
GAS210_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
GAS217_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
GAS219_OR_LATER = $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
@@ -50,6 +51,10 @@ CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
endif
+ifneq ($(CLANG_COMPILER),0)
+CXXFLAGS += -Wno-tautological-compare
+endif
+
ifeq ($(GAS210_OR_LATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
else
@@ -141,7 +146,7 @@ test: cryptest.exe
clean:
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS)
-install: static dynamic cryptest.exe
+install:
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
-$(CP) *.h $(PREFIX)/include/cryptopp
-$(CP) *.a $(PREFIX)/lib
diff --git a/misc.h b/misc.h
index 8425c53..7f32b86 100644
--- a/misc.h
+++ b/misc.h
@@ -580,13 +580,13 @@ CRYPTOPP_DLL void CRYPTOPP_API UnalignedDeallocate(void *p);
template <class T> inline T rotlFixed(T x, unsigned int y)
{
assert(y < sizeof(T)*8);
- return T((x<<y) | (x>>(sizeof(T)*8-y)));
+ return y ? T((x<<y) | (x>>(sizeof(T)*8-y))) : x;
}
template <class T> inline T rotrFixed(T x, unsigned int y)
{
assert(y < sizeof(T)*8);
- return T((x>>y) | (x<<(sizeof(T)*8-y)));
+ return y ? T((x>>y) | (x<<(sizeof(T)*8-y))) : x;
}
template <class T> inline T rotlVariable(T x, unsigned int y)