Hi Everyone,
We checked in a number of changes to clear UBsan and Asan undefined
behavior. We also cleared a number of GCC warnings under -Wall.
Some warnings remain and they were suppressed with the following:
Now that we have a relatively clean slate, I think it would be wise to
enable -Wall for GCC/Clang for GCC 4.7 and above. GCC 4.7 is ideal because
of the diagnostic pragmas:
// Used to supress some warnings in some header and implementation files.
// Some platforms, like CentOS and OpenBSD, use old compilers that don't
understand -Wno-unknown-pragma.
#define GCC_DIAGNOSTIC_AWARE ((__GNUC__ > 4 || (__GNUC__ == 4 &&
__GNUC_MINOR__ >= 7)) || defined(__clang__))
...
#if GCC_DIAGNOSTIC_AWARE
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-value"
# pragma GCC diagnostic ignored "-Wunused-variable"
#endif
If we try to use just -Wno-unknown-pragmas, then older compilers light up
because they don't know the warning. The older compilers include GCC 4.1
(CentOS) and GCC 4.2 (OpenBSD). That's not helpful at all.
The elevated warning level has already alerted to a new set of potential
issues, like:
g++ -DNDEBUG -g2 -O3 -Wall -march=native -pipe -c zlib.cpp
In file included from simple.h:10:0,
from filters.h:6,
from zdeflate.h:4,
from zlib.h:5,
from zlib.cpp:9:
misc.h: In member function ‘virtual void
CryptoPP::ZlibCompressor::WritePrestreamHeader()’:
misc.h:396:2: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false [-Wstrict-overflow]
if (n+m-1 < n)
^
Are there any comments or objections to the patch below?
Jeff
**********
$ cat GNUmakefile.diff
diff --git a/GNUmakefile b/GNUmakefile
index 6cb318d..15a2d6e 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -25,6 +25,11 @@ ifeq ($(PREFIX),)
PREFIX = /usr
endif
+GCC45_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "^gcc version
(4\.[5-9]|[5-9])")
+ifneq ($(GCC45_OR_LATER),0)
+CXXFLAGS += -Wall
+endif
+
ifeq ($(IS_X86),1)
GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "^gcc version
(4.[2-9]|[5-9])")
@@ -159,7 +164,7 @@ CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
endif
endif
-SRCS = $(wildcard *.cpp)
+SRCS = $(filter-out pch.cpp cryptlib_bds.cpp winpipes.cpp, $(wildcard
*.cpp))
OBJS = $(SRCS:.cpp=.o)
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.