diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake index 5ce589d4f..1aab15b0d 100644 --- a/cmake/FindLibUSB.cmake +++ b/cmake/FindLibUSB.cmake @@ -56,17 +56,11 @@ else ( PKGCONFIG_LIBUSB_FOUND ) if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" ) # LibUSB-Win32 binary distribution contains several libs. # Use the lib that got compiled with the same compiler. - if ( MSVC ) - if ( WIN32 ) - set ( LibUSB_LIBRARY_PATH_SUFFIX lib/msvc ) - else ( WIN32 ) - set ( LibUSB_LIBRARY_PATH_SUFFIX lib/msvc_x64 ) - endif ( WIN32 ) - elseif ( BORLAND ) + if ( BORLAND ) set ( LibUSB_LIBRARY_PATH_SUFFIX lib/bcc ) elseif ( CMAKE_COMPILER_IS_GNUCC ) set ( LibUSB_LIBRARY_PATH_SUFFIX lib/gcc ) - endif ( MSVC ) + endif () endif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" ) find_library ( usb_LIBRARY diff --git a/cmake/FindSodium.cmake b/cmake/FindSodium.cmake index 3c3f1245c..3655036ed 100644 --- a/cmake/FindSodium.cmake +++ b/cmake/FindSodium.cmake @@ -99,70 +99,7 @@ elseif (WIN32) PATH_SUFFIXES include ) - if (MSVC) - # detect target architecture - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" [=[ - #if defined _M_IX86 - #error ARCH_VALUE x86_32 - #elif defined _M_X64 - #error ARCH_VALUE x86_64 - #endif - #error ARCH_VALUE unknown - ]=]) - try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" - OUTPUT_VARIABLE _COMPILATION_LOG - ) - string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}") - - # construct library path - if (_TARGET_ARCH STREQUAL "x86_32") - string(APPEND _PLATFORM_PATH "Win32") - elseif(_TARGET_ARCH STREQUAL "x86_64") - string(APPEND _PLATFORM_PATH "x64") - else() - message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.") - endif() - string(APPEND _PLATFORM_PATH "/$$CONFIG$$") - - if (MSVC_VERSION LESS 1900) - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") - else() - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") - endif() - string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") - - if (sodium_USE_STATIC_LIBS) - string(APPEND _PLATFORM_PATH "/static") - else() - string(APPEND _PLATFORM_PATH "/dynamic") - endif() - - string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}") - string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}") - - find_library(sodium_LIBRARY_DEBUG libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_LIBRARY_RELEASE libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - if (NOT sodium_USE_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") - find_library(sodium_DLL_DEBUG libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_DLL_RELEASE libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) - endif() - - elseif(_GCC_COMPATIBLE) + if(_GCC_COMPATIBLE) if (sodium_USE_STATIC_LIBS) find_library(sodium_LIBRARY_DEBUG libsodium.a HINTS ${sodium_DIR} diff --git a/contrib/epee/include/int-util.h b/contrib/epee/include/int-util.h index 9593882e8..bf1bb47f2 100644 --- a/contrib/epee/include/int-util.h +++ b/contrib/epee/include/int-util.h @@ -34,10 +34,7 @@ #include #include #include - -#ifndef _MSC_VER #include -#endif #if defined(__ANDROID__) #include @@ -47,20 +44,6 @@ #include #endif -#if defined(_MSC_VER) -#include - -static inline uint32_t rol32(uint32_t x, int r) { - static_assert(sizeof(uint32_t) == sizeof(unsigned int), "this code assumes 32-bit integers"); - return _rotl(x, r); -} - -static inline uint64_t rol64(uint64_t x, int r) { - return _rotl64(x, r); -} - -#else - static inline uint32_t rol32(uint32_t x, int r) { return (x << (r & 31)) | (x >> (-r & 31)); } @@ -69,8 +52,6 @@ static inline uint64_t rol64(uint64_t x, int r) { return (x << (r & 63)) | (x >> (-r & 63)); } -#endif - static inline uint64_t hi_dword(uint64_t val) { return val >> 32; } @@ -255,12 +236,6 @@ static inline void memcpy_swap64(void *dst, const void *src, size_t n) { } } -#ifdef _MSC_VER -# define LITTLE_ENDIAN 1234 -# define BIG_ENDIAN 4321 -# define BYTE_ORDER LITTLE_ENDIAN -#endif - #if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) static_assert(false, "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled"); #endif diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index a8f50554d..2a138c77f 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -40,10 +40,6 @@ #define OUT #endif -#ifdef WINDOWS_PLATFORM -#pragma comment (lib, "Rpcrt4.lib") -#endif - namespace epee { namespace string_tools diff --git a/contrib/epee/include/warnings.h b/contrib/epee/include/warnings.h index df5c7d1db..213f3b7c0 100644 --- a/contrib/epee/include/warnings.h +++ b/contrib/epee/include/warnings.h @@ -1,16 +1,5 @@ #pragma once -#if defined(_MSC_VER) - -#define PUSH_WARNINGS __pragma(warning(push)) -#define POP_WARNINGS __pragma(warning(pop)) -#define DISABLE_VS_WARNINGS(w) __pragma(warning(disable: w)) -#define DISABLE_GCC_WARNING(w) -#define DISABLE_CLANG_WARNING(w) -#define DISABLE_GCC_AND_CLANG_WARNING(w) - -#else - #include #define PUSH_WARNINGS _Pragma("GCC diagnostic push") @@ -26,5 +15,3 @@ #endif #define DISABLE_GCC_AND_CLANG_WARNING(w) _Pragma(BOOST_PP_STRINGIZE(GCC diagnostic ignored BOOST_PP_STRINGIZE(-W##w))) - -#endif diff --git a/contrib/epee/src/memwipe.c b/contrib/epee/src/memwipe.c index d5d9ae1aa..d259f3ec4 100644 --- a/contrib/epee/src/memwipe.c +++ b/contrib/epee/src/memwipe.c @@ -38,13 +38,8 @@ #endif #include "memwipe.h" -#if defined(_MSC_VER) -#define SCARECROW \ - __asm; -#else #define SCARECROW \ __asm__ __volatile__("" : : "r"(ptr) : "memory"); -#endif #ifdef HAVE_MEMSET_S diff --git a/src/common/scoped_message_writer.h b/src/common/scoped_message_writer.h index fbaf47c54..6b95ffe37 100644 --- a/src/common/scoped_message_writer.h +++ b/src/common/scoped_message_writer.h @@ -70,12 +70,8 @@ public: scoped_message_writer(scoped_message_writer&& rhs) : m_flush(std::move(rhs.m_flush)) -#if defined(_MSC_VER) - , m_oss(std::move(rhs.m_oss)) -#else // GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54316 , m_oss(rhs.m_oss.str(), std::ios_base::out | std::ios_base::ate) -#endif , m_color(std::move(rhs.m_color)) , m_log_level(std::move(rhs.m_log_level)) { diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index ca078827d..ef9466629 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -162,12 +162,6 @@ namespace cryptonote { return (low + time_span - 1) / time_span; } -#if defined(_MSC_VER) -#ifdef max -#undef max -#endif -#endif - const difficulty_type max64bit(std::numeric_limits::max()); const boost::multiprecision::uint256_t max128bit(std::numeric_limits::max()); const boost::multiprecision::uint512_t max256bit(std::numeric_limits::max()); diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h index 1ca1b21e4..a451a69a3 100644 --- a/src/wallet/wallet_errors.h +++ b/src/wallet/wallet_errors.h @@ -990,8 +990,6 @@ namespace tools }; //---------------------------------------------------------------------------------------------------- -#if !defined(_MSC_VER) - template [[noreturn]] void throw_wallet_ex(std::string&& loc, const TArgs&... args) { @@ -999,31 +997,6 @@ namespace tools LOG_PRINT_L0(e.to_string()); throw e; } - -#else - #include - #include - #include - - template - [[noreturn]] void throw_wallet_ex(std::string&& loc) - { - TException e(std::move(loc)); - LOG_PRINT_L0(e.to_string()); - throw e; - } - -#define GEN_throw_wallet_ex(z, n, data) \ - template \ - [[noreturn]] void throw_wallet_ex(std::string&& loc, BOOST_PP_ENUM_BINARY_PARAMS(n, const TArg, &arg)) \ - { \ - TException e(std::move(loc), BOOST_PP_ENUM_PARAMS(n, arg)); \ - LOG_PRINT_L0(e.to_string()); \ - throw e; \ - } - - BOOST_PP_REPEAT_FROM_TO(1, 6, GEN_throw_wallet_ex, ~) -#endif } } diff --git a/tests/core_tests/chaingen_serialization.h b/tests/core_tests/chaingen_serialization.h index 8fc3b4100..5591b4bd4 100644 --- a/tests/core_tests/chaingen_serialization.h +++ b/tests/core_tests/chaingen_serialization.h @@ -43,40 +43,10 @@ namespace tools bool serialize_obj_to_file(t_object& obj, const std::string& file_path) { TRY_ENTRY(); -#if defined(_MSC_VER) - // Need to know HANDLE of file to call FlushFileBuffers - HANDLE data_file_handle = ::CreateFile(file_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == data_file_handle) - return false; - - int data_file_descriptor = _open_osfhandle((intptr_t)data_file_handle, 0); - if (-1 == data_file_descriptor) - { - ::CloseHandle(data_file_handle); - return false; - } - - const std::unique_ptr data_file_file{_fdopen(data_file_descriptor, "wb")}; - if (nullptr == data_file_file) - { - // Call CloseHandle is not necessary - _close(data_file_descriptor); - return false; - } - - // HACK: undocumented constructor, this code may not compile - std::ofstream data_file(data_file_file.get()); - if (data_file.fail()) - { - // Call CloseHandle and _close are not necessary - return false; - } -#else std::ofstream data_file; data_file.open(file_path , std::ios_base::binary | std::ios_base::out| std::ios::trunc); if (data_file.fail()) return false; -#endif boost::archive::portable_binary_oarchive a(data_file); a << obj; @@ -84,10 +54,6 @@ namespace tools return false; data_file.flush(); -#if defined(_MSC_VER) - // To make sure the file is fully stored on disk - ::FlushFileBuffers(data_file_handle); -#endif return true; CATCH_ENTRY_L0("serialize_obj_to_file", false); diff --git a/tests/hash/main.cpp b/tests/hash/main.cpp index f44aba2f6..9840be875 100644 --- a/tests/hash/main.cpp +++ b/tests/hash/main.cpp @@ -267,11 +267,11 @@ int main(int argc, char *argv[]) { CATCH_ENTRY_L0("main", 1); } -#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_WIN64)) +#if defined(__x86_64__) #include -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(__MINGW32__) #include #else #include @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) { static inline bool test_variant2_int_sqrt_sse(const uint64_t sqrt_input, const uint64_t correct_result) { -#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_WIN64)) +#if defined(__x86_64__) uint64_t sqrt_result; VARIANT2_INTEGER_MATH_SQRT_STEP_SSE2(); VARIANT2_INTEGER_MATH_SQRT_FIXUP(sqrt_result); diff --git a/tests/io.h b/tests/io.h index 8a0137ab4..254fbdb58 100644 --- a/tests/io.h +++ b/tests/io.h @@ -106,28 +106,9 @@ inline void get(std::istream &input, std::vector &res) { } } -#if !defined(_MSC_VER) || _MSC_VER >= 1800 - template typename std::enable_if<(sizeof...(TT) > 0), void>::type get(std::istream &input, T &res, TT &... resres) { get(input, res); get(input, resres...); } - -#else -#include -#include -#include -#include -#include - -#define NESTED_GET(z, n, data) get(input, BOOST_PP_CAT(res, n)); -#define GET(z, n, data) \ -template \ -void get(std::istream &input, BOOST_PP_ENUM_BINARY_PARAMS(n, T, &res)) { \ - BOOST_PP_REPEAT(n, NESTED_GET, ~) \ -} -BOOST_PP_REPEAT_FROM_TO(2, 5, GET, ~) - -#endif