diff --git a/cryptest.sh b/cryptest.sh index e4508728..5e26aebf 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -172,14 +172,6 @@ if [[ (-z "$HAVE_CXX17") ]]; then fi fi -if [[ (-z "$HAVE_GNU17") ]]; then - HAVE_GNU17=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++17 adhoc.cpp -o "$TMP/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU17=1 - fi -fi - # Hit or miss, mostly miss. if [[ (-z "$HAVE_CXX14") ]]; then HAVE_CXX14=0 @@ -189,14 +181,6 @@ if [[ (-z "$HAVE_CXX14") ]]; then fi fi -if [[ (-z "$HAVE_GNU14") ]]; then - HAVE_GNU14=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++14 adhoc.cpp -o "$TMP/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU14=1 - fi -fi - # Hit or miss, mostly hit. if [[ (-z "$HAVE_CXX11") ]]; then HAVE_CXX11=0 @@ -206,14 +190,6 @@ if [[ (-z "$HAVE_CXX11") ]]; then fi fi -if [[ (-z "$HAVE_GNU11") ]]; then - HAVE_GNU11=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++11 adhoc.cpp -o "$TMP/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU11=1 - fi -fi - # OpenBSD 5.7 and OS X 10.5 cannot consume -std=c++03 if [[ (-z "$HAVE_CXX03") ]]; then HAVE_CXX03=0 @@ -452,9 +428,6 @@ elif [[ "$IS_DARWIN" -ne "0" ]]; then echo "IS_DARWIN: $IS_DARWIN" | tee -a "$TEST_RESULTS" fi -if [[ "$IS_PPC" -ne "0" ]]; then - echo "IS_PPC: $IS_PPC" | tee -a "$TEST_RESULTS" -fi if [[ "$IS_ARM64" -ne "0" ]]; then echo "IS_ARM64: $IS_ARM64" | tee -a "$TEST_RESULTS" elif [[ "$IS_ARM32" -ne "0" ]]; then @@ -491,12 +464,9 @@ fi echo | tee -a "$TEST_RESULTS" echo "HAVE_CXX03: $HAVE_CXX03" | tee -a "$TEST_RESULTS" echo "HAVE_CXX11: $HAVE_CXX11" | tee -a "$TEST_RESULTS" -echo "HAVE_GNU11: $HAVE_GNU11" | tee -a "$TEST_RESULTS" -if [[ ("$HAVE_CXX14" -ne "0" || "$HAVE_CXX17" -ne "0" || "$HAVE_GNU14" -ne "0" || "$HAVE_GNU17" -ne "0") ]]; then +if [[ ("$HAVE_CXX14" -ne "0" || "$HAVE_CXX17" -ne "0") ]]; then echo "HAVE_CXX14: $HAVE_CXX14" | tee -a "$TEST_RESULTS" - echo "HAVE_GNU14: $HAVE_GNU14" | tee -a "$TEST_RESULTS" echo "HAVE_CXX17: $HAVE_CXX17" | tee -a "$TEST_RESULTS" - echo "HAVE_GNU17: $HAVE_GNU17" | tee -a "$TEST_RESULTS" fi if [[ "$HAVE_LDGOLD" -ne "0" ]]; then echo "HAVE_LDGOLD: $HAVE_LDGOLD" | tee -a "$TEST_RESULTS" @@ -1008,65 +978,6 @@ if [[ "$HAVE_CXX11" -ne "0" ]]; then fi fi -############################################ -# gnu++11 debug and release build -if [[ "$HAVE_GNU11" -ne "0" ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: debug, gnu++11" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++11 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi - - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: release, gnu++11" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++11 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi -fi - ############################################ # c++14 debug and release build if [[ "$HAVE_CXX14" -ne "0" ]]; then @@ -1126,65 +1037,6 @@ if [[ "$HAVE_CXX14" -ne "0" ]]; then fi fi -############################################ -# gnu++14 debug and release build -if [[ "$HAVE_GNU14" -ne "0" ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: debug, gnu++14" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++14 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi - - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: release, gnu++14" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++14 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi -fi - ############################################ # c++17 debug and release build if [[ "$HAVE_CXX17" -ne "0" ]]; then @@ -1244,65 +1096,6 @@ if [[ "$HAVE_CXX17" -ne "0" ]]; then fi fi -############################################ -# gnu++17 debug and release build -if [[ "$HAVE_GNU17" -ne "0" ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: debug, gnu++17" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++17 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi - - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: release, gnu++17" | tee -a "$TEST_RESULTS" - echo - - unset CXXFLAGS - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - export CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++17 ${RETAINED_CXXFLAGS[@]}" - "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi -fi - ############################################ # X32 debug and release build if [[ "$HAVE_X32" -ne "0" ]]; then diff --git a/misc.h b/misc.h index 655100f6..63ed4e29 100644 --- a/misc.h +++ b/misc.h @@ -221,11 +221,10 @@ struct NewObject //! \brief A memory barrier //! \details MEMORY_BARRIER attempts to ensure reads and writes are completed //! in the absence of a language synchronization point. It is used by the -//! Singleton class if the compiler supports it. The barrier is provided at the -//! customary places in a double-checked initialization. -//! \details Internally, MEMORY_BARRIER uses std::atomic_thread_fence if -//! C++11 atomics are available. Otherwise, intrinsic(_ReadWriteBarrier), -//! _ReadWriteBarrier() or __asm__("" ::: "memory") is used. +//! Singleton class if the compiler supports it. The use is provided at the +//! customary check points in a double-checked initialization. +//! \details Internally, MEMORY_BARRIER uses intrinsic(_ReadWriteBarrier), +//! _ReadWriteBarrier() or __asm__("" ::: "memory"). #define MEMORY_BARRIER ... #else #if defined(CRYPTOPP_CXX11_ATOMICS) @@ -249,8 +248,8 @@ struct NewObject //! \details This class safely initializes a static object in a multithreaded environment. For C++03 //! and below it will do so without using locks for portability. If two threads call Ref() at the same //! time, they may get back different references, and one object may end up being memory leaked. This -//! is by design. For C++11 and above, a standard double-checked locking pattern with thread fences -//! are used. The locks and fences are standard and do not hinder portability. +//! is by design. For C++11 and above, a standard double-checked locking pattern with memory fences +//! is used. The locks and fences are standard and do not hinder portability. //! \sa Double-Checked Locking is Fixed In C++11 template , int instance=0> class Singleton diff --git a/socketft.cpp b/socketft.cpp index ff6e0d40..42a00182 100644 --- a/socketft.cpp +++ b/socketft.cpp @@ -109,12 +109,10 @@ void Socket::CloseSocket() BOOL result = CancelIoEx((HANDLE) m_s, NULL); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); CheckAndHandleError_int("closesocket", closesocket(m_s)); - CRYPTOPP_UNUSED(result); // Used by assert in debug builds # else BOOL result = CancelIo((HANDLE) m_s); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); CheckAndHandleError_int("closesocket", closesocket(m_s)); - CRYPTOPP_UNUSED(result); # endif #else CheckAndHandleError_int("close", close(m_s)); @@ -370,11 +368,9 @@ SocketReceiver::~SocketReceiver() # if defined(USE_WINDOWS8_API) BOOL result = CancelIoEx((HANDLE) m_s.GetSocket(), NULL); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); - CRYPTOPP_UNUSED(result); // Used by assert in debug builds # else BOOL result = CancelIo((HANDLE) m_s.GetSocket()); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); - CRYPTOPP_UNUSED(result); # endif #endif } @@ -460,11 +456,9 @@ SocketSender::~SocketSender() # if defined(USE_WINDOWS8_API) BOOL result = CancelIoEx((HANDLE) m_s.GetSocket(), NULL); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); - CRYPTOPP_UNUSED(result); // Used by assert in debug builds # else BOOL result = CancelIo((HANDLE) m_s.GetSocket()); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); - CRYPTOPP_UNUSED(result); # endif #endif }