Skip to content

Commit

Permalink
Cleanup C++ compiler macros usage (#1609)
Browse files Browse the repository at this point in the history
This PR is a backport of 158c193
  • Loading branch information
externl authored Dec 19, 2023
1 parent 2c7c49b commit 2edd182
Show file tree
Hide file tree
Showing 49 changed files with 184 additions and 757 deletions.
2 changes: 1 addition & 1 deletion cpp/include/Ice/FactoryTableInit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
25 changes: 2 additions & 23 deletions cpp/include/Ice/Incoming.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/IncomingAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
18 changes: 2 additions & 16 deletions cpp/include/Ice/MetricsAdminI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <regex>
#else
# include <regex.h>
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions cpp/include/Ice/MetricsObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define ICEMX_METRICSOBSERVER_I_H

#include <IceUtil/StopWatch.h>
#include <IceUtil/Atomic.h>

#include <Ice/Instrumentation.h>
#include <Ice/Endpoint.h>
Expand Down Expand Up @@ -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<bool> when it becomes widely
// available.
//
IceUtilInternal::Atomic _enabled;
std::atomic<int> _enabled;
UpdaterPtr _updater;
};

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/OutgoingAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 0 additions & 19 deletions cpp/include/Ice/Proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{

Expand Down
179 changes: 0 additions & 179 deletions cpp/include/IceUtil/Atomic.h

This file was deleted.

Loading

0 comments on commit 2edd182

Please sign in to comment.