From 2edd182aba6bf4482949ef68f6b69a13f738810a Mon Sep 17 00:00:00 2001 From: Joe George Date: Tue, 19 Dec 2023 11:07:03 -0500 Subject: [PATCH] Cleanup C++ compiler macros usage (#1609) This PR is a backport of 158c193 --- cpp/include/Ice/FactoryTableInit.h | 2 +- cpp/include/Ice/Incoming.h | 25 +- cpp/include/Ice/IncomingAsync.h | 4 +- cpp/include/Ice/MetricsAdminI.h | 18 +- cpp/include/Ice/MetricsObserverI.h | 7 +- cpp/include/Ice/OutgoingAsync.h | 2 +- cpp/include/Ice/Proxy.h | 19 -- cpp/include/IceUtil/Atomic.h | 179 -------------- cpp/include/IceUtil/Config.h | 35 +-- cpp/include/IceUtil/ConsoleUtil.h | 8 +- cpp/include/IceUtil/DisableWarnings.h | 4 - cpp/include/IceUtil/FileUtil.h | 6 +- cpp/include/IceUtil/OutputUtil.h | 22 +- cpp/include/IceUtil/ScannerConfig.h | 4 +- cpp/include/IceUtil/Shared.h | 3 +- cpp/src/Glacier2/Blobject.cpp | 2 +- cpp/src/Glacier2/RequestQueue.cpp | 2 +- cpp/src/Ice/DynamicLibrary.cpp | 2 +- cpp/src/Ice/Instance.cpp | 7 +- cpp/src/Ice/LoggerI.cpp | 6 - cpp/src/Ice/MetricsAdminI.cpp | 30 +-- cpp/src/Ice/Network.cpp | 17 -- cpp/src/Ice/Network.h | 17 -- cpp/src/Ice/OutgoingAsync.cpp | 10 - cpp/src/Ice/PluginManagerI.cpp | 5 - cpp/src/Ice/Proxy.cpp | 18 -- cpp/src/Ice/WSTransceiver.cpp | 6 - cpp/src/IceBox/ServiceManagerI.cpp | 4 - cpp/src/IceGrid/IceGridNode.cpp | 9 - cpp/src/IceGrid/PlatformInfo.cpp | 4 +- cpp/src/IceSSL/SChannelEngine.cpp | 44 ---- cpp/src/IceSSL/SChannelEngine.h | 40 --- cpp/src/IceSSL/Util.cpp | 6 - cpp/src/IceUtil/FileUtil.cpp | 11 +- cpp/src/IceUtil/StringConverter.cpp | 18 -- cpp/src/IceUtil/Time.cpp | 10 - cpp/src/IceUtil/UtilException.cpp | 19 +- .../IceUtil/msbuild/iceutil/iceutil.vcxproj | 6 +- .../msbuild/iceutil/iceutil.vcxproj.filters | 234 +++++++++--------- cpp/src/Slice/Parser.cpp | 2 +- cpp/src/Slice/Parser.h | 2 +- cpp/src/Slice/Python.cpp | 8 +- cpp/src/slice2cpp/Gen.cpp | 20 +- cpp/test/Ice/invoke/BlobjectI.cpp | 4 +- cpp/test/Ice/operations/BatchOnewaysAMI.cpp | 9 - cpp/test/Ice/operations/OnewaysAMI.cpp | 9 - cpp/test/IceGrid/session/AllTests.cpp | 2 +- cpp/test/IceUtil/unicode/Client.cpp | 13 +- python/modules/IcePy/Types.cpp | 7 +- 49 files changed, 184 insertions(+), 757 deletions(-) delete mode 100644 cpp/include/IceUtil/Atomic.h diff --git a/cpp/include/Ice/FactoryTableInit.h b/cpp/include/Ice/FactoryTableInit.h index 9aca1831eb8..5c50d71b66f 100644 --- a/cpp/include/Ice/FactoryTableInit.h +++ b/cpp/include/Ice/FactoryTableInit.h @@ -21,7 +21,7 @@ class ICE_API FactoryTableInit static FactoryTableInit factoryTableInitializer; // Dummy variable to force initialization of factoryTable -extern ICE_API FactoryTable* factoryTable ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API FactoryTable* factoryTable; class ICE_API CompactIdInit { diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h index e7e78d6993c..d7ec5be0e81 100644 --- a/cpp/include/Ice/Incoming.h +++ b/cpp/include/Ice/Incoming.h @@ -76,16 +76,6 @@ class ICE_API IncomingBase : private IceUtil::noncopyable void response(bool); void exception(const std::exception&, bool); void exception(const std::string&, bool); -#if defined(_MSC_VER) && (_MSC_VER == 1500) - // - // COMPILERFIX v90 get confused with overloads above - // when passing a const char* as first argument. - // - void exception(const char* msg, bool amd) - { - exception(std::string(msg), amd); - } -#endif protected: @@ -100,17 +90,6 @@ class ICE_API IncomingBase : private IceUtil::noncopyable void handleException(const std::exception&, bool); void handleException(const std::string&, bool); -#if defined(_MSC_VER) && (_MSC_VER == 1500) - // - // COMPILERFIX v90 get confused with overloads above - // when passing a const char* as first argument. - // - void handleException(const char* msg, bool amd) - { - handleException(std::string(msg), amd); - } -#endif - Ice::Current _current; Ice::ObjectPtr _servant; Ice::ServantLocatorPtr _locator; @@ -141,7 +120,7 @@ class ICE_API IncomingBase : private IceUtil::noncopyable }; // TODO: fix this warning -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable:4239) #endif @@ -216,7 +195,7 @@ class ICE_API Incoming : public IncomingBase IncomingAsyncPtr _inAsync; }; -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) # pragma warning(pop) #endif diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h index 451cc139ea5..269f31a1696 100644 --- a/cpp/include/Ice/IncomingAsync.h +++ b/cpp/include/Ice/IncomingAsync.h @@ -41,7 +41,7 @@ namespace IceInternal { // TODO: fix this warning -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable:4239) #endif @@ -119,7 +119,7 @@ class ICE_API IncomingAsync : public IncomingBase, const ResponseHandlerPtr _responseHandlerCopy; }; -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) # pragma warning(pop) #endif diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index d4c0585effd..ddcdaac2b65 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -15,12 +15,7 @@ # define ICE_CPP11_COMPILER_REGEXP #endif -#ifdef __MINGW32__ - // - // No regexp support with MinGW, when MinGW C++11 mode is not experimental - // we can use std::regex. - // -#elif defined(ICE_CPP11_COMPILER_REGEXP) +#if defined(ICE_CPP11_COMPILER_REGEXP) # include #else # include @@ -81,17 +76,8 @@ class ICE_API MetricsMapI : const std::string _attribute; -#ifdef __MINGW32__ - // - // No regexp support with MinGW, when MinGW C++11 mode is not experimental - // we can use std::regex. - // -#elif defined(ICE_CPP11_COMPILER_REGEXP) -# if _MSC_VER < 1600 - std::tr1::regex _regex; -# else +#if defined(ICE_CPP11_COMPILER_REGEXP) std::regex _regex; -# endif #else regex_t _preg; #endif diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h index 65424d51510..d102f16fd41 100644 --- a/cpp/include/Ice/MetricsObserverI.h +++ b/cpp/include/Ice/MetricsObserverI.h @@ -6,7 +6,6 @@ #define ICEMX_METRICSOBSERVER_I_H #include -#include #include #include @@ -653,11 +652,7 @@ class ObserverFactoryT : public Updater, private IceUtil::Mutex IceInternal::MetricsAdminIPtr _metrics; const std::string _name; MetricsMapSeqType _maps; - // - // TODO: Replace by std::atomic when it becomes widely - // available. - // - IceUtilInternal::Atomic _enabled; + std::atomic _enabled; UpdaterPtr _updater; }; diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index 29a51926bf8..f262a2ac12f 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -679,7 +679,7 @@ class ICE_API GenericCallbackBase : public virtual CallbackBase // // See comments in OutgoingAsync.cpp // -extern ICE_API CallbackBasePtr dummyCallback ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API CallbackBasePtr dummyCallback; // // Generic callback template that requires the caller to down-cast the diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index cc951c7b614..2cf74989a80 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -34,25 +34,6 @@ ICE_API extern const Context noExplicitContext; } -#if defined(_MSC_VER) && (_MSC_VER <= 1600) -// -// COMPILERFIX v90 and v100 get confused with namespaces and complains that -// ::Ice::noExplicitContext isn't defined in IceProxy namespace. -// -namespace IceProxy -{ - -namespace Ice -{ - -/** Marker value used to indicate that no explicit context was passed to a proxy invocation. */ -ICE_API extern const ::Ice::Context noExplicitContext; - -} - -} -#endif - namespace IceInternal { diff --git a/cpp/include/IceUtil/Atomic.h b/cpp/include/IceUtil/Atomic.h deleted file mode 100644 index 244b67cf684..00000000000 --- a/cpp/include/IceUtil/Atomic.h +++ /dev/null @@ -1,179 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#ifndef ICE_UTIL_ATOMIC_H -#define ICE_UTIL_ATOMIC_H - -#if ((defined(ICE_CPP11_COMPILER) && defined(_MSC_VER) && (_MSC_VER > 1600)) || \ - (defined(ICE_CPP11_COMPILER) && !defined(_MSC_VER))) -# define ICE_CPP11_COMPILER_HAS_ATOMIC -#endif - -#if defined(ICE_CPP11_COMPILER_HAS_ATOMIC) -# include -#elif defined(ICE_USE_MUTEX_SHARED) - -# include - -// Using the gcc builtins requires gcc 4.1 or better. For Linux, i386 -// doesn't work. Apple is supported for all architectures. Sun only -// supports sparc (32 and 64 bit). - -#elif ((defined(__GNUC__) && (((__GNUC__* 100) + __GNUC_MINOR__) >= 401)) || __clang__) && \ - ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \ - defined(__APPLE__) || \ - (defined(__linux__) && \ - (defined(__i486) || defined(__i586) || \ - defined(__i686) || defined(__x86_64)))) - -# define ICE_HAS_GCC_BUILTINS - -#elif defined(_WIN32) -// Nothing to include -#else -// Use a simple mutex -# include -#endif - -namespace IceUtilInternal -{ - -#ifdef ICE_CPP11_COMPILER_HAS_ATOMIC -typedef std::atomic Atomic; -#else - -#if defined(_WIN32) -// -// volatile here is required by InterlockedExchangeXXX -// family functions. -// -# if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) -typedef volatile LONG ATOMIC_T; -# else -typedef unsigned int ATOMIC_T; -# endif -#else -typedef int ATOMIC_T; -#endif - -// -// This is temporary and very partial placeholder for std::atomic, -// which is not yet widely available. -// -class ICE_API Atomic : public IceUtil::noncopyable -{ -public: - - Atomic() : - _ref(0) - { - } - - Atomic(int desired) : - _ref(desired) - { - } - - inline int fetch_add(int value) - { -#if defined(_WIN32) - return InterlockedExchangeAdd(&_ref, value); -#elif defined(ICE_HAS_GCC_BUILTINS) - return __sync_fetch_and_add(&_ref, value); -#else - IceUtil::Mutex::Lock sync(_mutex); - int tmp = _ref; - _ref += value; - return tmp; -#endif - } - - inline int fetch_sub(int value) - { -#if defined(_WIN32) -# if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) - return InterlockedExchangeAdd(&_ref, -value); -# else - return InterlockedExchangeSubtract(&_ref, value); -#endif -#elif defined(ICE_HAS_GCC_BUILTINS) - return __sync_fetch_and_sub(&_ref, value); -#else - IceUtil::Mutex::Lock sync(_mutex); - ATOMIC_T tmp = _ref; - _ref -= value; - return tmp; -#endif - } - - inline int load() const - { -#if defined(_WIN32) - return InterlockedExchangeAdd(const_cast(&_ref), 0); -#elif defined(ICE_HAS_GCC_BUILTINS) - return __sync_fetch_and_add(const_cast(&_ref), 0); -#else - IceUtil::Mutex::Lock sync(_mutex); - return _ref; -#endif - } - - inline int exchange(int value) - { -#if defined(_WIN32) - return InterlockedExchange(&_ref, value); -#elif defined(ICE_HAS_GCC_BUILTINS) - __sync_synchronize(); - return __sync_lock_test_and_set(&_ref, value); -#else - IceUtil::Mutex::Lock sync(_mutex); - int tmp = _ref; - _ref = value; - return tmp; -#endif - } - - inline int operator++() - { - return fetch_add(1) + 1; - } - - inline int operator--() - { - return fetch_sub(1) - 1; - } - - inline int operator++(int) - { - return fetch_add(1); - } - - inline int operator--(int) - { - return fetch_sub(1); - } - - inline operator int() - { - return load(); - } - - inline operator int() const - { - return load(); - } - -private: - - ATOMIC_T _ref; -#if !defined(_WIN32) && !defined(ICE_HAS_GCC_BUILTINS) - IceUtil::Mutex _mutex; -#endif -}; - -#endif - -} - -#endif diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 74b56d6cbda..e8d4d1a2d3a 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -109,7 +109,7 @@ // #if (ICE_CPLUSPLUS >= 201103) || \ ((defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) && ((__GNUC__* 100) + __GNUC_MINOR__) >= 405)) || \ - (defined(_MSC_VER) && (_MSC_VER >= 1900)) + (defined(_MSC_VER)) # define ICE_CPP11_COMPILER #endif @@ -134,19 +134,8 @@ // Does the C++ compiler library provide std::codecvt_utf8 and // std::codecvt_utf8_utf16? // -#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \ - defined(__clang__) || \ - (defined(ICE_CPP11_COMPILER) && defined(__GNUC__) && (__GNUC__ >= 5)) -# define ICE_HAS_CODECVT_UTF8 -#endif - -// -// Support for thread-safe function local static initialization -// (a.k.a. "magic statics") -// -#if defined(ICE_CPP11_MAPPING) || defined(__GNUC__) || defined(__clang__) || (defined(_MSC_VER) && (_MSC_VER >= 1900)) -# define ICE_HAS_THREAD_SAFE_LOCAL_STATIC -#endif +// TODO: remove this macro entirely as we require a C++11 compiler +#define ICE_HAS_CODECVT_UTF8 // // Compiler extensions to export and import symbols: see the documentation @@ -158,12 +147,9 @@ // With Visual Studio, we can import/export member functions without importing/ // exporting the whole class # define ICE_MEMBER_IMPORT_EXPORT -#elif (defined(__GNUC__) || defined(__clang__) || defined(__IBMCPP__)) && !defined(__ibmxl__) +#elif defined(__GNUC__) || defined(__clang__) # define ICE_DECLSPEC_EXPORT __attribute__((visibility ("default"))) # define ICE_DECLSPEC_IMPORT __attribute__((visibility ("default"))) -#elif defined(__SUNPRO_CC) -# define ICE_DECLSPEC_EXPORT __global -# define ICE_DECLSPEC_IMPORT /**/ #else # define ICE_DECLSPEC_EXPORT /**/ # define ICE_DECLSPEC_IMPORT /**/ @@ -177,14 +163,6 @@ # define ICE_MEMBER(API) /**/ #endif -// With IBM xlC, the visibility attribute must be at the end of the -// declaration of global variables. -#if defined(__IBMCPP__) && !defined(ICE_STATIC_LIBS) -# define ICE_GLOBAL_VAR_SUFFIX __attribute__((visibility ("default"))) -#else -# define ICE_GLOBAL_VAR_SUFFIX /**/ -#endif - // // Let's use these extensions with Ice: // @@ -260,11 +238,6 @@ # include #endif -#ifdef __IBMCPP__ - // TODO: better fix for this warning -# pragma report(disable, "1540-0198") // private inheritance without private keyword -#endif - // // The Ice version. // diff --git a/cpp/include/IceUtil/ConsoleUtil.h b/cpp/include/IceUtil/ConsoleUtil.h index 735d2661383..3b5d9165aa3 100644 --- a/cpp/include/IceUtil/ConsoleUtil.h +++ b/cpp/include/IceUtil/ConsoleUtil.h @@ -77,13 +77,13 @@ operator<<(ConsoleErr& err, const T& val) ICE_API ConsoleErr& endl(ConsoleErr&); ICE_API ConsoleErr& flush(ConsoleErr&); -extern ICE_API ConsoleOut consoleOut ICE_GLOBAL_VAR_SUFFIX; -extern ICE_API ConsoleErr consoleErr ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API ConsoleOut consoleOut; +extern ICE_API ConsoleErr consoleErr; #else -extern ICE_API std::ostream& consoleOut ICE_GLOBAL_VAR_SUFFIX; -extern ICE_API std::ostream& consoleErr ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API std::ostream& consoleOut; +extern ICE_API std::ostream& consoleErr; #endif diff --git a/cpp/include/IceUtil/DisableWarnings.h b/cpp/include/IceUtil/DisableWarnings.h index e12ac380a4d..4e75df17e60 100644 --- a/cpp/include/IceUtil/DisableWarnings.h +++ b/cpp/include/IceUtil/DisableWarnings.h @@ -21,10 +21,6 @@ # define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '' was declared deprecated # pragma warning(disable:4996) // C4996 '' was declared deprecated # pragma warning(disable:4800) // C4800 forcing value to bool 'true' or 'false' (performance warning) - -# if (_MSC_VER < 1700) -# pragma warning(disable:4355) // C4355 'this' : used in base member initializer list -# endif #endif // diff --git a/cpp/include/IceUtil/FileUtil.h b/cpp/include/IceUtil/FileUtil.h index dbde8d3f1e6..92be8c2f915 100644 --- a/cpp/include/IceUtil/FileUtil.h +++ b/cpp/include/IceUtil/FileUtil.h @@ -41,11 +41,7 @@ ICE_API bool isEmptyDirectory(const std::string&); #ifdef _WIN32 -#if defined(__MINGW32__) -typedef struct _stat structstat; -#else typedef struct _stat64i32 structstat; -#endif #ifdef _MSC_VER #ifndef O_RDONLY @@ -127,7 +123,7 @@ typedef IceUtil::Handle FileLockPtr; // Use streamFilename to construct the filename given to std stream classes // like ifstream and ofstream. // -#if defined(_WIN32) && !defined(__MINGW32__) +#if defined(_WIN32) ICE_API std::wstring streamFilename(const std::string&); #else inline std::string streamFilename(const std::string& filename) diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h index 00f714662f3..c9786071b8c 100644 --- a/cpp/include/IceUtil/OutputUtil.h +++ b/cpp/include/IceUtil/OutputUtil.h @@ -72,12 +72,12 @@ class ICE_API OutputBase : private ::IceUtil::noncopyable class ICE_API NextLine { }; -extern ICE_API NextLine nl ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API NextLine nl; class ICE_API Separator { }; -extern ICE_API Separator sp ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API Separator sp; // ---------------------------------------------------------------------- // Output @@ -149,7 +149,7 @@ operator<<(Output& o, const Separator&) class ICE_API StartBlock { }; -extern ICE_API StartBlock sb ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API StartBlock sb; template<> inline Output& @@ -162,7 +162,7 @@ operator<<(Output& o, const StartBlock&) class ICE_API EndBlock { }; -extern ICE_API EndBlock eb ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API EndBlock eb; template<> inline Output& @@ -175,7 +175,7 @@ operator<<(Output& o, const EndBlock&) class ICE_API StartPar { }; -extern ICE_API StartPar spar ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API StartPar spar; template<> inline Output& @@ -188,7 +188,7 @@ operator<<(Output& o, const StartPar&) class ICE_API EndPar { }; -extern ICE_API EndPar epar ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API EndPar epar; template<> inline Output& @@ -201,7 +201,7 @@ operator<<(Output& o, const EndPar&) class ICE_API StartAbrk { }; -extern ICE_API StartAbrk sabrk ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API StartAbrk sabrk; template<> inline Output& @@ -214,7 +214,7 @@ operator<<(Output& o, const StartAbrk&) class ICE_API EndAbrk { }; -extern ICE_API EndAbrk eabrk ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API EndAbrk eabrk; template<> inline Output& @@ -292,7 +292,7 @@ operator<<(XMLOutput& o, const Separator&) class ICE_API EndElement { }; -extern ICE_API EndElement ee ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API EndElement ee; template<> inline XMLOutput& @@ -353,12 +353,12 @@ operator<<(XMLOutput& o, const Attribute& e) class ICE_API StartEscapes { }; -extern ICE_API StartEscapes startEscapes ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API StartEscapes startEscapes; class ICE_API EndEscapes { }; -extern ICE_API EndEscapes endEscapes ICE_GLOBAL_VAR_SUFFIX; +extern ICE_API EndEscapes endEscapes; template<> inline XMLOutput& diff --git a/cpp/include/IceUtil/ScannerConfig.h b/cpp/include/IceUtil/ScannerConfig.h index d0fa04985f4..f3e02b02bdb 100644 --- a/cpp/include/IceUtil/ScannerConfig.h +++ b/cpp/include/IceUtil/ScannerConfig.h @@ -16,7 +16,7 @@ // header is included by inttypes.h, that is included by the generated // Scanners. // -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(_MSC_VER) # include #endif @@ -26,7 +26,7 @@ // #if defined(__clang__) # pragma clang diagnostic ignored "-Wdeprecated-register" -#elif defined(_MSC_VER) && (_MSC_VER >= 1900) +#elif defined(_MSC_VER) # pragma warning(disable:5033) #endif diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 67272f157d5..8cefadd9bf3 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -6,7 +6,6 @@ #define ICE_UTIL_SHARED_H #include -#include // // Base classes for reference counted types. The IceUtil::Handle @@ -118,7 +117,7 @@ class ICE_API Shared protected: - IceUtilInternal::Atomic _ref; + std::atomic _ref; unsigned char _flags; }; diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index 3ee669ff860..f68e040ad02 100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp @@ -83,7 +83,7 @@ Glacier2::Blobject::invokeResponse(bool ok, const pair void Glacier2::Blobject::invokeSent(bool, const AMD_Object_ice_invokePtr& amdCB) { -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) +#if defined(_MSC_VER) amdCB->ice_response(true, pair(static_cast(nullptr), static_cast(nullptr))); #else diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index 51dc1387289..7eb87074e4a 100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp @@ -175,7 +175,7 @@ Glacier2::Request::queued() { if(!_proxy->ice_isTwoway()) { -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) +#if defined(_MSC_VER) _amdCB->ice_response(true, pair(static_cast(nullptr), static_cast(nullptr))); #else diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp index 286ef39c6d5..359ac35eb20 100644 --- a/cpp/src/Ice/DynamicLibrary.cpp +++ b/cpp/src/Ice/DynamicLibrary.cpp @@ -133,7 +133,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc lib += "++11"; # endif -# if defined(_DEBUG) && !defined(__MINGW32__) +# if defined(_DEBUG) lib += 'd'; # endif diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index c69f7340878..07249842397 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -213,11 +212,7 @@ class Timer : public IceUtil::Timer virtual void runTimerTask(const IceUtil::TimerTaskPtr&); IceUtil::Mutex _mutex; - // - // TODO: Replace by std::atomic when it becomes widely - // available. - // - IceUtilInternal::Atomic _hasObserver; + std::atomic _hasObserver; ObserverHelperT _observer; }; diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp index 75d46233014..81c1c6222c1 100644 --- a/cpp/src/Ice/LoggerI.cpp +++ b/cpp/src/Ice/LoggerI.cpp @@ -11,12 +11,6 @@ #include #include -#ifdef __IBMCPP__ -// Work-around for xlC visibility bug -// See "ifstream::tellg visibility error" thread on IBM xlC forum -extern template class std::fpos; -#endif - using namespace std; using namespace Ice; using namespace IceInternal; diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index bc99ff922d9..23758bf98da 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -89,33 +89,19 @@ parseRule(const PropertiesPtr& properties, const string& name) MetricsMapI::RegExp::RegExp(const string& attribute, const string& regexp) : _attribute(attribute) { -#ifdef __MINGW32__ - // - // No regexp support with MinGW, when MinGW C++11 mode is not experimental - // we can use std::regex. - // -#elif !defined(ICE_CPP11_COMPILER_REGEXP) +#if !defined(ICE_CPP11_COMPILER_REGEXP) if(regcomp(&_preg, regexp.c_str(), REG_EXTENDED | REG_NOSUB) != 0) { throw SyscallException(__FILE__, __LINE__); } #else -# if _MSC_VER < 1600 - _regex = std::tr1::regex(regexp, std::tr1::regex_constants::extended | std::tr1::regex_constants::nosubs); -# else _regex = regex(regexp, std::regex_constants::extended | std::regex_constants::nosubs); -# endif #endif } MetricsMapI::RegExp::~RegExp() { -#ifdef __MINGW32__ - // - // No regexp support with MinGW, when MinGW C++11 mode is not experimental - // we can use std::regex. - // -#elif !defined(ICE_CPP11_COMPILER_REGEXP) +#if !defined(ICE_CPP11_COMPILER_REGEXP) regfree(&_preg); #endif } @@ -123,20 +109,10 @@ MetricsMapI::RegExp::~RegExp() bool MetricsMapI::RegExp::match(const string& value) { -#ifdef __MINGW32__ - // - // No regexp support with MinGW, when MinGW C++11 mode is not experimental - // we can use std::regex. - // - return false; -#elif !defined(ICE_CPP11_COMPILER_REGEXP) +#if !defined(ICE_CPP11_COMPILER_REGEXP) return regexec(&_preg, value.c_str(), 0, 0, 0) == 0; #else -# if _MSC_VER < 1600 - return std::tr1::regex_match(value, _regex); -# else return regex_match(value, _regex); -# endif #endif } diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index f411bc17a43..50931feba97 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -33,9 +33,6 @@ #if defined(_WIN32) # include # include -# ifdef __MINGW32__ -# include -# endif # include # include # include @@ -54,20 +51,6 @@ # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif -#if defined(__MINGW32__) -// -// Work-around for missing definitions in MinGW Windows headers -// -# ifndef IPV6_V6ONLY -# define IPV6_V6ONLY 27 -# endif - -extern "C" -{ - WINSOCK_API_LINKAGE int WSAAPI inet_pton(INT, PCTSTR, PVOID); -} -#endif - using namespace std; using namespace Ice; using namespace IceInternal; diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h index 866fa148e48..b96bb058f74 100644 --- a/cpp/src/Ice/Network.h +++ b/cpp/src/Ice/Network.h @@ -22,9 +22,7 @@ #if defined(_WIN32) # include # include -# if !defined(__MINGW32__) typedef int ssize_t; -# endif #else # include # include @@ -82,21 +80,6 @@ typedef int socklen_t; # define NETDB_SUCCESS 0 #endif -#if defined(__MINGW32__) && !defined WSAID_CONNECTEX -# define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} -# define WSAID_ACCEPTEX {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} -# define SO_UPDATE_ACCEPT_CONTEXT 0x700B -# define SO_UPDATE_CONNECT_CONTEXT 0x7010 - typedef BOOL (PASCAL FAR * LPFN_CONNECTEX) (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen, - IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength, - OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped); - - typedef BOOL (PASCAL FAR * LPFN_ACCEPTEX)(IN SOCKET sListenSocket, IN SOCKET sAcceptSocket, - IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, - IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, - OUT LPDWORD lpdwBytesReceived, IN LPOVERLAPPED lpOverlapped); -#endif - namespace IceInternal { diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 37872aba7ec..58ce51ceeaa 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -900,17 +900,7 @@ OutgoingAsync::prepare(const string& operation, OperationMode mode, const Contex _os.write(static_cast(_mode)); -#if defined(_MSC_VER) && (_MSC_VER <= 1600) - // - // COMPILERFIX v90 and v100 get confused with namespaces and we need to - // defined both Ice::noExplicitContext and IceProxy::Ice::noExplicitContext - // see comments in Ice/Proxy.h. - // - if(&context != &Ice::noExplicitContext && - &context != &IceProxy::Ice::noExplicitContext) -#else if(&context != &Ice::noExplicitContext) -#endif { // // Explicit context diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index b8d57f1cce3..bb8c6e78a17 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -460,11 +460,6 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St throw PluginInitializationException(__FILE__, __LINE__, os.str()); } -#ifdef __IBMCPP__ - // xlC warns when casting a void* to function pointer -# pragma report(disable, "1540-0216") -#endif - factory = reinterpret_cast(sym); } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 76b03fa86ff..7d5c2e83149 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -31,24 +31,6 @@ const Context noExplicitContext; } -#if defined(_MSC_VER) && (_MSC_VER <= 1600) -// -// COMPILERFIX v90 and v100 get confused with namespaces and complains that -// ::Ice::noExplicitContext isn't defined in IceProxy namespace. -// -namespace IceProxy -{ - -namespace Ice -{ - -const Context noExplicitContext; - -} - -} -#endif - namespace { diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp index 2f239af6c11..2f134b5ff0c 100644 --- a/cpp/src/Ice/WSTransceiver.cpp +++ b/cpp/src/Ice/WSTransceiver.cpp @@ -16,13 +16,7 @@ #include #include -// Python 2.7 under Windows. -#if _MSC_VER == 1500 -typedef unsigned short uint16_t; -#else #include -#endif - #include using namespace std; diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 41990589519..2ca5bea9ff7 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -646,10 +646,6 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // // Invoke the factory function. // -#ifdef __IBMCPP__ - // xlC warns when casting a void* to function pointer -# pragma report(disable, "1540-0216") -#endif ServiceFactory factory = reinterpret_cast(sym); try diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 389f2fc8516..bbbc33ed72e 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -32,12 +32,7 @@ using namespace Ice; using namespace IceInternal; using namespace IceGrid; -// Work-around for anonymous namspace bug in xlclang++ -#ifdef __ibmxl__ -namespace IceGridNodeNamespace -#else namespace -#endif { class ProcessI : public Process @@ -115,10 +110,6 @@ setNoIndexingAttribute(const string& path) } -#ifdef __ibmxl__ -using namespace IceGridNodeNamespace; -#endif - CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com, const ActivatorPtr& activator, bool nowarn, diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index 5b953d0ebb1..e3e8479d8c4 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -253,11 +253,11 @@ PlatformInfo::PlatformInfo(const string& prefix, // // GetVersionEx deprecated in Windows 8.1 // -# if defined(_MSC_VER) && _MSC_VER >= 1800 +# if defined(_MSC_VER) # pragma warning (disable : 4996) # endif GetVersionEx(&osInfo); -# if defined(_MSC_VER) && _MSC_VER >= 1800 +# if defined(_MSC_VER) # pragma warning (default : 4996) # endif diff --git a/cpp/src/IceSSL/SChannelEngine.cpp b/cpp/src/IceSSL/SChannelEngine.cpp index 420a83966a7..a4125e00118 100644 --- a/cpp/src/IceSSL/SChannelEngine.cpp +++ b/cpp/src/IceSSL/SChannelEngine.cpp @@ -36,15 +36,6 @@ const int ICESSL_CALG_ECDH_EPHEM = 0x0000AE06; -// -// COMPILERFIX SCH_USE_STRONG_CRYPTO not defined with v90 -// -#if defined(_MSC_VER) && (_MSC_VER <= 1600) -# ifndef SCH_USE_STRONG_CRYPTO -# define SCH_USE_STRONG_CRYPTO 0x00400000 -# endif -#endif - using namespace std; using namespace Ice; using namespace IceUtil; @@ -331,31 +322,6 @@ findCertificates(const string& location, const string& storeName, const string& return certs; } -#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) -// -// CERT_CHAIN_ENGINE_CONFIG struct in mingw headers doesn't include -// new members added in Windows 7, we add our ouwn definition and -// then cast it to CERT_CHAIN_ENGINE_CONFIG this works because the -// linked libraries include the new version. -// -struct CertChainEngineConfig -{ - DWORD cbSize; - HCERTSTORE hRestrictedRoot; - HCERTSTORE hRestrictedTrust; - HCERTSTORE hRestrictedOther; - DWORD cAdditionalStore; - HCERTSTORE *rghAdditionalStore; - DWORD dwFlags; - DWORD dwUrlRetrievalTimeout; - DWORD MaximumCachedCertificates; - DWORD CycleDetectionModulus; - HCERTSTORE hExclusiveRoot; - HCERTSTORE hExclusiveTrustedPeople; -}; - -#endif - void addCertificatesToStore(const string& file, HCERTSTORE store, PCCERT_CONTEXT* cert = 0) { @@ -720,15 +686,9 @@ SChannel::SSLEngine::initialize() // // Create a chain engine that uses our Trusted Root Store // -#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) - CertChainEngineConfig config; - memset(&config, 0, sizeof(CertChainEngineConfig)); - config.cbSize = sizeof(CertChainEngineConfig); -#else CERT_CHAIN_ENGINE_CONFIG config; memset(&config, 0, sizeof(CERT_CHAIN_ENGINE_CONFIG)); config.cbSize = sizeof(CERT_CHAIN_ENGINE_CONFIG); -#endif config.hExclusiveRoot = _rootStore; // @@ -740,11 +700,7 @@ SChannel::SSLEngine::initialize() config.dwFlags = CERT_CHAIN_USE_LOCAL_MACHINE_STORE; } -#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) - if(!CertCreateCertificateChainEngine(reinterpret_cast(&config), &_chainEngine)) -#else if(!CertCreateCertificateChainEngine(&config, &_chainEngine)) -#endif { throw PluginInitializationException(__FILE__, __LINE__, "IceSSL: error creating certificate chain engine:\n" + diff --git a/cpp/src/IceSSL/SChannelEngine.h b/cpp/src/IceSSL/SChannelEngine.h index c40af674e61..2ffe93e4371 100644 --- a/cpp/src/IceSSL/SChannelEngine.h +++ b/cpp/src/IceSSL/SChannelEngine.h @@ -26,46 +26,6 @@ # include # undef SECURITY_WIN32 -#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER <= 1500)) - -// -// Add some definitions missing from MinGW headers. -// - -# ifndef CERT_TRUST_IS_EXPLICIT_DISTRUST -# define CERT_TRUST_IS_EXPLICIT_DISTRUST 0x04000000 -# endif - -# ifndef CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT -# define CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT 0x08000000 -# endif - -# ifndef SECBUFFER_ALERT -# define SECBUFFER_ALERT 17 -# endif - -# ifndef SCH_SEND_ROOT_CERT -# define SCH_SEND_ROOT_CERT 0x00040000 -# endif - -# ifndef SP_PROT_TLS1_1_SERVER -# define SP_PROT_TLS1_1_SERVER 0x00000100 -# endif - -# ifndef SP_PROT_TLS1_1_CLIENT -# define SP_PROT_TLS1_1_CLIENT 0x00000200 -# endif - -# ifndef SP_PROT_TLS1_2_SERVER -# define SP_PROT_TLS1_2_SERVER 0x00000400 -# endif - -# ifndef SP_PROT_TLS1_2_CLIENT -# define SP_PROT_TLS1_2_CLIENT 0x00000800 -# endif - -#endif - namespace IceSSL { diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp index 95f02bdd17a..2494517dec4 100644 --- a/cpp/src/IceSSL/Util.cpp +++ b/cpp/src/IceSSL/Util.cpp @@ -20,12 +20,6 @@ #include -#ifdef __IBMCPP__ -// Work-around for xlC visibility bug -// See "ifstream::tellg visibility error" thread on IBM xlC forum -extern template class std::fpos; -#endif - using namespace std; using namespace Ice; using namespace IceInternal; diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp index 2275d1b0b1b..80ff404f9c1 100644 --- a/cpp/src/IceUtil/FileUtil.cpp +++ b/cpp/src/IceUtil/FileUtil.cpp @@ -289,19 +289,13 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); } -#ifdef __MINGW32__ - if(::LockFile(_fd, 0, 0, 0, 0) == 0) - { - throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); - } -#else OVERLAPPED overlaped; overlaped.Internal = 0; overlaped.InternalHigh = 0; overlaped.Offset = 0; overlaped.OffsetHigh = 0; -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(_MSC_VER) overlaped.hEvent = nullptr; #else overlaped.hEvent = 0; @@ -312,7 +306,6 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : ::CloseHandle(_fd); throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path); } -#endif // // In Windows implementation we don't write the process pid to the file, as it is // not possible to read the file from other process while it is locked here. @@ -326,13 +319,11 @@ IceUtilInternal::FileLock::~FileLock() unlink(_path); } -#ifndef __MINGW32__ wstring IceUtilInternal::streamFilename(const string& filename) { return stringToWstring(filename, IceUtil::getProcessStringConverter()); } -#endif #else diff --git a/cpp/src/IceUtil/StringConverter.cpp b/cpp/src/IceUtil/StringConverter.cpp index ec5668a4e75..6d41f1ec833 100644 --- a/cpp/src/IceUtil/StringConverter.cpp +++ b/cpp/src/IceUtil/StringConverter.cpp @@ -33,10 +33,6 @@ IceUtil::Mutex* processStringConverterMutex = 0; IceUtil::StringConverterPtr processStringConverter; IceUtil::WstringConverterPtr processWstringConverter; -#ifndef ICE_HAS_THREAD_SAFE_LOCAL_STATIC -IceUtil::WstringConverterPtr unicodeWstringConverter; -#endif - #ifdef ICE_HAS_CODECVT_UTF8 template @@ -248,9 +244,6 @@ class Init Init() { processStringConverterMutex = new IceUtil::Mutex; -#ifndef ICE_HAS_THREAD_SAFE_LOCAL_STATIC - unicodeWstringConverter = ICE_MAKE_SHARED(UnicodeWstringConverter); -#endif } ~Init() @@ -265,9 +258,7 @@ Init init; const WstringConverterPtr& getUnicodeWstringConverter() { -#ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC static const WstringConverterPtr unicodeWstringConverter = ICE_MAKE_SHARED(UnicodeWstringConverter); -#endif return unicodeWstringConverter; } @@ -446,17 +437,8 @@ IceUtil::UTF8ToNative(const string& str, const IceUtil::StringConverterPtr& conv #ifdef ICE_HAS_CODECVT_UTF8 -#if defined(_MSC_VER) && (_MSC_VER >= 1900) -// -// Workaround for compiler bug - see http://stackoverflow.com/questions/32055357 -// -typedef unsigned short Char16T; -typedef unsigned int Char32T; - -#else typedef char16_t Char16T; typedef char32_t Char32T; -#endif #endif diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp index 1c9a111e668..c3f0adb6e0e 100644 --- a/cpp/src/IceUtil/Time.cpp +++ b/cpp/src/IceUtil/Time.cpp @@ -90,13 +90,8 @@ IceUtil::Time::now(Clock clock) if(clock == Realtime) { #ifdef _WIN32 -# if defined(_MSC_VER) struct _timeb tb; _ftime(&tb); -# elif defined(__MINGW32__) - struct timeb tb; - ftime(&tb); -# endif return Time(static_cast(tb.time) * ICE_INT64(1000000) + Int64(tb.millitm) * 1000); #else struct timeval tv; @@ -123,13 +118,8 @@ IceUtil::Time::now(Clock clock) } else { -# if defined(_MSC_VER) struct _timeb tb; _ftime(&tb); -# elif defined(__MINGW32__) - struct timeb tb; - ftime(&tb); -# endif return Time(static_cast(tb.time) * ICE_INT64(1000000) + Int64(tb.millitm) * 1000); } #elif defined(__hppa) diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index c8c2ba0d34d..edb368f2b46 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -2,7 +2,7 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#if defined(_MSC_VER) && _MSC_VER >= 1700 +#if defined(_MSC_VER) // // DbgHelp.dll on Windows XP does not contain Unicode functions, so we // "switch on" Unicode only with VS2012 and up @@ -43,7 +43,7 @@ # endif # endif -# if !defined(_AIX) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS) +# if !defined(_AIX) && !defined(__FreeBSD__) && !defined(ICE_STATIC_LIBS) # include # include # include @@ -54,15 +54,12 @@ // // The Slice compilers don't retrieve the exception stack traces so we don't need the DbgHelp calls. // -#if defined(_WIN32) && !defined(__MINGW32__) && !defined(ICE_BUILDING_SLICE_COMPILERS) +#if defined(_WIN32) && !defined(ICE_BUILDING_SLICE_COMPILERS) # define ICE_DBGHELP -# if defined(_MSC_VER) && (_MSC_VER >= 1700) -# define DBGHELP_TRANSLATE_TCHAR -# include -# if _MSC_VER >= 1900 -# pragma warning(disable:4091) // VS 2015 RC issues this warning for code in DbgHelp.h -# endif -# endif +# define DBGHELP_TRANSLATE_TCHAR +# include +// TODO: check if this is still needed for VS2022 +# pragma warning(disable:4091) // VS 2015 RC issues this warning for code in DbgHelp.h # include # include #endif @@ -391,7 +388,7 @@ getStackTrace(const vector& stackFrames) } lock.release(); -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(_MSC_VER) # if defined(DBGHELP_TRANSLATE_TCHAR) static_assert(sizeof(TCHAR) == sizeof(wchar_t), "Bad TCHAR - should be wchar_t"); # else diff --git a/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj b/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj index e08c9a318f4..ce677291e44 100644 --- a/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj +++ b/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj @@ -1,5 +1,6 @@  - + Debug @@ -112,7 +113,6 @@ - @@ -154,4 +154,4 @@ - \ No newline at end of file + diff --git a/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj.filters b/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj.filters index 56c31da12c9..bfc2ee981ae 100644 --- a/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj.filters +++ b/cpp/src/IceUtil/msbuild/iceutil/iceutil.vcxproj.filters @@ -1,5 +1,6 @@  - + {ED03E3E4-C50D-4FE0-9F5A-53834B8A5FBE} @@ -68,119 +69,118 @@ - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index d4d449e6f34..ad80870b734 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -12,7 +12,7 @@ #include // TODO: fix this warning once we no longer support VS2013 and earlier -#if defined(_MSC_VER) && (_MSC_VER >= 1900) +#if defined(_MSC_VER) # pragma warning(disable:4589) // Constructor of abstract class 'Slice::Type' ignores initializer... #endif diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index fde53d997f8..9bfebbaf6d2 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -42,7 +42,7 @@ class CompilerException : public ::IceUtil::Exception const std::string _reason; }; -#if defined(_WIN32) && !defined(__MINGW32__) +#if defined(_WIN32) const IceUtil::Int64 Int32Max = 0x7fffffffi64; const IceUtil::Int64 Int32Min = -Int32Max - 1i64; diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index ae18777520f..cc5322925a2 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -23,11 +23,9 @@ #include #ifdef _WIN32 -#include -#endif - -#ifndef _WIN32 -#include +# include +#else +# include #endif using namespace std; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index de70223a6a5..24c3149af9c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3000,7 +3000,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) { C.zeroIndent(); C << sp; - C << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)"; + C << nl << "#if defined(_MSC_VER)"; C << nl << "# pragma warning(push)"; C << nl << "# pragma warning(disable:4589)"; C << nl << "#endif"; @@ -3026,7 +3026,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) if(hasGCObjectBaseClass) { C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)"; + C << nl << "#if defined(_MSC_VER)"; C << nl << "# pragma warning(pop)"; C << nl << "#endif"; C.restoreIndent(); @@ -3046,10 +3046,8 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) other.sort(); ids.merge(other); ids.unique(); - StringList::const_iterator firstIter = ids.begin(); StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped()); assert(scopedIter != ids.end()); - StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter); H << sp; H << nl << "/**"; @@ -3126,18 +3124,8 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << sp; C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()"; C << sb; - C.zeroIndent(); - C << nl << "#ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC"; - C.restoreIndent(); C << nl << "static const ::std::string typeId = \"" << *scopedIter << "\";"; C << nl << "return typeId;"; - C.zeroIndent(); - C << nl << "#else"; - C.restoreIndent(); - C << nl << "return " << flatName << '[' << scopedPos << "];"; - C.zeroIndent(); - C << nl << "#endif"; - C.restoreIndent(); C << eb; emitGCFunctions(p); @@ -5167,7 +5155,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) H.zeroIndent(); H << sp; - H << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)"; + H << nl << "#if defined(_MSC_VER)"; H << nl << "# pragma warning(push)"; H << nl << "# pragma warning(disable:4239)"; H << nl << "#endif"; @@ -5189,7 +5177,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) H.zeroIndent(); H << sp; - H << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)"; + H << nl << "#if defined(_MSC_VER)"; H << nl << "# pragma warning(pop)"; H << nl << "#endif"; H.restoreIndent(); diff --git a/cpp/test/Ice/invoke/BlobjectI.cpp b/cpp/test/Ice/invoke/BlobjectI.cpp index a12601f8175..903984aefa1 100644 --- a/cpp/test/Ice/invoke/BlobjectI.cpp +++ b/cpp/test/Ice/invoke/BlobjectI.cpp @@ -115,7 +115,7 @@ BlobjectArrayAsyncI::ice_invokeAsync(pair in Ice::InputStream in(current.adapter->getCommunicator(), inEncaps); vector outEncaps; bool ok = invokeInternal(in, outEncaps, current); -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) +#if defined(_MSC_VER) pair outPair(static_cast(nullptr), static_cast(nullptr)); #else pair outPair(0, 0); @@ -146,7 +146,7 @@ BlobjectArrayAsyncI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& cb, Ice::InputStream in(current.adapter->getCommunicator(), current.encoding, inEncaps); vector outEncaps; bool ok = invokeInternal(in, outEncaps, current); -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) +#if defined(_MSC_VER) pair outPair(static_cast(nullptr), static_cast(nullptr)); #else pair outPair(0, 0); diff --git a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp index 59de2c74fc3..9684545a6ac 100644 --- a/cpp/test/Ice/operations/BatchOnewaysAMI.cpp +++ b/cpp/test/Ice/operations/BatchOnewaysAMI.cpp @@ -8,12 +8,7 @@ using namespace std; -// Work-around for anonymous namspace bug in xlclang++ -#ifdef __ibmxl__ -namespace BatchOnewaysAMINamespace -#else namespace -#endif { class Callback : public IceUtil::Monitor, public IceUtil::Shared @@ -90,10 +85,6 @@ class Callback_ping : public IceUtil::Shared }; } -#ifdef __ibmxl__ -using namespace BatchOnewaysAMINamespace; -#endif - void batchOnewaysAMI(const Test::MyClassPrxPtr& p) { diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp index 2b73c141ee4..bd3fc9241f7 100644 --- a/cpp/test/Ice/operations/OnewaysAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysAMI.cpp @@ -8,12 +8,7 @@ using namespace std; -// Work-around for anonymous namspace bug in xlclang++ -#ifdef __ibmxl__ -namespace OnewaysAMINamespace -#else namespace -#endif { class CallbackBase @@ -80,10 +75,6 @@ ICE_DEFINE_PTR(CallbackPtr, Callback); } -#ifdef __ibmxl__ -using namespace OnewaysAMINamespace; -#endif - void onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy) { diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index de1ba3c2267..52324845f15 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -480,7 +480,7 @@ testFailedAndPrintObservers(const char* expr, const char* file, unsigned int lin #undef test #define test(ex) ((ex) ? ((void)0) : testFailedAndPrintObservers(#ex, __FILE__, __LINE__)) -#if defined(_AIX) && defined(__GNUC__) && !defined(__ibmxl__) +#if defined(_AIX) && defined(__GNUC__) // Strange optimization bug with catching ExtendedPermissionDeniedException with GCC 8.1 on AIX __attribute__((optimize("O0"))) #endif diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index e40ad062532..3a89c4c7af9 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -27,8 +27,7 @@ using namespace std; // converts these BOMs back and forth. // -//COMPILERFIX: MINGW doesn't support wmain for console applications. -#if defined(_WIN32) && !defined(__MINGW32__) +#if defined(_WIN32) int wmain(int argc, wchar_t* argv[]) @@ -46,11 +45,7 @@ main(int argc, char* argv[]) { #ifdef _WIN32 -# ifdef __MINGW32__ - dir = argv[1]; -# else dir = wstringToString(argv[1]); -# endif dir += "\\"; #else dir = argv[1]; @@ -184,15 +179,10 @@ main(int argc, char* argv[]) { cout << "testing wstring with surrogates... "; - // // Euro sign (U+20AC) is encoded with 1 UTF-16 code unit, and 3 UTF-8 code units // U+10437 is a Deseret character, encoded with 2 UTF-16 code units, and 4 UTF-8 code units // xlC in 32-bit mode truncates U+10437 into a single UTF-16 character -#if defined(__IBMCPP__) && !defined(__64BIT__) - wstring ws = L"\u20ac\u20ac\ud801\udc37"; -#else wstring ws = L"\u20ac\u20ac\U00010437"; -#endif if(sizeof(wchar_t) == 2) { @@ -204,7 +194,6 @@ main(int argc, char* argv[]) test(ws.length() == 3); } - // // The Unicode string converter implementation allocates an initial buffer // of size max(2 * (sourceEnd - sourceStart), 4). // With UTF-16 encoding, that's 8 and the first 2 euros will use the first 6 diff --git a/python/modules/IcePy/Types.cpp b/python/modules/IcePy/Types.cpp index 9c70796cf2b..502c14e3c4d 100644 --- a/python/modules/IcePy/Types.cpp +++ b/python/modules/IcePy/Types.cpp @@ -843,12 +843,7 @@ IcePy::PrimitiveInfo::validate(PyObject* p) { // Ensure double does not exceed maximum float value before casting double val = PyFloat_AsDouble(p); - return (val <= numeric_limits::max() && val >= -numeric_limits::max()) || -#if defined(_MSC_VER) && (_MSC_VER <= 1700) - !_finite(val); -#else - !isfinite(val); -#endif + return (val <= numeric_limits::max() && val >= -numeric_limits::max()) || !isfinite(val); } break;