From 2052dd56f788a2ecbe60696d4cf2250b42ca013d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 24 Mar 2016 01:48:44 -0400 Subject: [PATCH] Added additional warnings for elevated warning test and GCC 5.1 and above --- cryptest.sh | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/cryptest.sh b/cryptest.sh index a0b2f008..af0888ab 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -61,6 +61,11 @@ if [ -z "$CXX" ]; then fi fi +# Now that the compiler is fixed, see if its GCC 5.1 or above with -Wabi, -Wabi-tag and -Wodr +GCC_51_OR_ABOVE=$(g++ -v 2>&1 | egrep -i -c 'gcc version (5\.[1-9]|[6-9])') +echo "GCC_51_OR_ABOVE: $GCC_51_OR_ABOVE" +echo + # Fixup if [ "$CXX" == "gcc" ]; then CXX=g++ @@ -1604,11 +1609,15 @@ if [ "$HAVE_CXX03" -ne "0" ]; then rm -f adhoc.cpp > /dev/null 2>&1 if [ "$CXX" == "g++" ]; then - export CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then + CXXFLAGS+="-Wabi -Wabi-tag -Wodr" + fi else - export CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" + CXXFLAGS="-DDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" fi + export CXXFLAGS "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" if [ "${PIPESTATUS[0]}" -ne "0" ]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" @@ -1626,11 +1635,15 @@ if [ "$HAVE_CXX03" -ne "0" ]; then rm -f adhoc.cpp > /dev/null 2>&1 if [ "$CXX" == "g++" ]; then - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then + CXXFLAGS+="-Wabi -Wabi-tag -Wodr" + fi else - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" + CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" fi + export CXXFLAGS "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" if [ "$?" -ne "0" ]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" @@ -1653,11 +1666,15 @@ if [ "$HAVE_CXX11" -ne "0" ]; then rm -f adhoc.cpp > /dev/null 2>&1 if [ "$CXX" == "g++" ]; then - export CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then + CXXFLAGS+="-Wabi -Wabi-tag -Wodr" + fi else - export CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" + CXXFLAGS="-DDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" fi + export CXXFLAGS "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" if [ "${PIPESTATUS[0]}" -ne "0" ]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" @@ -1675,11 +1692,15 @@ if [ "$HAVE_CXX11" -ne "0" ]; then rm -f adhoc.cpp > /dev/null 2>&1 if [ "$CXX" == "g++" ]; then - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security -Wtrampolines" + if [ "$GCC_51_OR_ABOVE" -ne "0" ]; then + CXXFLAGS+="-Wabi -Wabi-tag -Wodr" + fi else - export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" + CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -Wall -Wextra -Wno-unknown-pragmas -Wstrict-overflow -Wcast-align -Wwrite-strings -Wformat=2 -Wformat-security" fi + export CXXFLAGS "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" if [ "$?" -ne "0" ]; then echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS"