diff --git a/src/factory/FieldCreateFactory.cpp b/src/factory/FieldCreateFactory.cpp index 7551315..374fdd3 100644 --- a/src/factory/FieldCreateFactory.cpp +++ b/src/factory/FieldCreateFactory.cpp @@ -8,7 +8,7 @@ * @author mrk */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/factory/PVDataCreateFactory.cpp b/src/factory/PVDataCreateFactory.cpp index a622384..0a9e4c0 100644 --- a/src/factory/PVDataCreateFactory.cpp +++ b/src/factory/PVDataCreateFactory.cpp @@ -8,7 +8,7 @@ * @author mrk */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/misc/epicsException.cpp b/src/misc/epicsException.cpp index 48f59b8..e29b649 100644 --- a/src/misc/epicsException.cpp +++ b/src/misc/epicsException.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #define epicsExportSharedSymbols @@ -50,7 +51,7 @@ ExceptionMixin::show() const out<= 1800) -# define WIN_NEEDS_OLL_FUNC 0 -# else -# define WIN_NEEDS_OLL_FUNC 1 -# endif +// Sometimes we have to provide our own copy of strtoll() +#if defined(_WIN32) && !defined(_MINGW) +# define NEED_OLL_FUNCS (EPICS_VERSION_INT < VERSION_INT(3,15,0,1)) +#elif defined(vxWorks) && !defined(_WRS_VXWORKS_MAJOR) +# define NEED_OLL_FUNCS 1 #else -# define WIN_NEEDS_OLL_FUNC 0 +# define NEED_OLL_FUNCS 0 #endif -#if defined(NEED_LONGLONG) && (defined(__vxworks) || WIN_NEEDS_OLL_FUNC) +#if defined(NEED_LONGLONG) && NEED_OLL_FUNCS static long long strtoll(const char *ptr, char ** endp, int base) { @@ -308,8 +306,10 @@ noconvert: return 0; } -#if defined(__vxworks) -/* vxworks version of std::istringstream >>uint64_t is buggy, we use out own implementation */ +#if defined(vxWorks) +/* The VxWorks version of std::istringstream >> uint64_t is buggy, + * provide our own implementation + */ static unsigned long long strtoull(const char *nptr, char **endptr, int base) { @@ -551,9 +551,10 @@ void parseToPOD(const string& in, float *out) { void parseToPOD(const string& in, double *out) { int err = epicsParseDouble(in.c_str(), out, NULL); if(err) handleParseError(err); -#if defined(__vxworks) - /* vxWorks strtod returns [-]epicsINF when it should return ERANGE error - * if [-]epicsINF is returned and first char is a digit then translate this into ERANGE error +#if defined(vxWorks) + /* vxWorks strtod returns [-]epicsINF when it should return ERANGE error. + * If [-]epicsINF is returned and the first char is a digit we translate + * this into an ERANGE error */ else if (*out == epicsINF || *out == -epicsINF) { const char* s = in.c_str(); diff --git a/src/misc/pv/byteBuffer.h b/src/misc/pv/byteBuffer.h index 945c80b..f20d475 100644 --- a/src/misc/pv/byteBuffer.h +++ b/src/misc/pv/byteBuffer.h @@ -11,7 +11,8 @@ #define BYTEBUFFER_H #include -#include +#include +#include #ifdef epicsExportSharedSymbols #define byteBufferepicsExportSharedSymbols @@ -224,7 +225,7 @@ public: * Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG. */ ByteBuffer(std::size_t size, int byteOrder = EPICS_BYTE_ORDER) : - _buffer((char*)malloc(size)), _size(size), + _buffer((char*)std::malloc(size)), _size(size), _reverseEndianess(byteOrder != EPICS_BYTE_ORDER), _reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER), _wrapped(false) @@ -257,7 +258,7 @@ public: */ ~ByteBuffer() { - if (_buffer && !_wrapped) free(_buffer); + if (_buffer && !_wrapped) std::free(_buffer); } /** * Set the byte order. diff --git a/src/misc/pv/epicsException.h b/src/misc/pv/epicsException.h index a25279e..e1ba44d 100644 --- a/src/misc/pv/epicsException.h +++ b/src/misc/pv/epicsException.h @@ -34,19 +34,14 @@ #ifndef EPICSEXCEPTION_H_ #define EPICSEXCEPTION_H_ -#ifdef _WIN32 -#pragma warning( push ) -#pragma warning(disable: 4275) // warning C4275: non dll-interface class used as base for dll-interface class (std::logic_error) +#if defined(_WIN32) && !defined(NOMINMAX) +#define NOMINMAX #endif #include #include - #include -#include -#include - #include // Users may redefine this for a large size if desired @@ -58,7 +53,7 @@ # include # include # define EXCEPT_USE_BACKTRACE -#elif defined(_WIN32) && !defined(__MINGW__) && !defined(SKIP_DBGHELP) +#elif defined(_WIN32) && !defined(_MINGW) && !defined(SKIP_DBGHELP) # define _WINSOCKAPI_ # include # include @@ -67,6 +62,12 @@ # define EXCEPT_USE_NONE #endif +#if defined(_WIN32) && !defined(_MINGW) +#pragma warning( push ) +#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class (std::logic_error) +#pragma warning(disable: 4251) // class std::string needs to have dll-interface to be used by clients +#endif + namespace epics { namespace pvData { @@ -228,7 +229,7 @@ private: mutable std::string base_msg; }; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(_MINGW) #pragma warning( pop ) #endif diff --git a/src/misc/pv/sharedPtr.h b/src/misc/pv/sharedPtr.h index 05bd3ca..b2d1007 100644 --- a/src/misc/pv/sharedPtr.h +++ b/src/misc/pv/sharedPtr.h @@ -26,7 +26,7 @@ // where should we look? -#if defined(__GNUC__) && __GNUC__>=4 && !defined(__vxworks) +#if defined(__GNUC__) && __GNUC__>=4 && !defined(vxWorks) // GCC >=4.0.0 # define SHARED_FROM_TR1 diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index b092d91..b6eccb2 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -7,7 +7,7 @@ #ifndef SHAREDVECTOR_H #define SHAREDVECTOR_H -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/misc/timer.cpp b/src/misc/timer.cpp index b10f22f..bdaafc1 100644 --- a/src/misc/timer.cpp +++ b/src/misc/timer.cpp @@ -8,7 +8,7 @@ * @author mrk */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/pv/pvData.h b/src/pv/pvData.h index 94e30ee..796abd6 100644 --- a/src/pv/pvData.h +++ b/src/pv/pvData.h @@ -10,7 +10,7 @@ #ifndef PVDATA_H #define PVDATA_H -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif @@ -29,15 +29,15 @@ #include #include -#if defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR) +#if defined(vxWorks) && !defined(_WRS_VXWORKS_MAJOR) typedef class std::ios std::ios_base; #endif -#if defined(__GNUC__) && !(defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR)) -#define USAGE_DEPRECATED __attribute__((deprecated)) +#define USAGE_DEPRECATED EPICS_DEPRECATED + +#if defined(__GNUC__) && !(defined(vxWorks) && !defined(_WRS_VXWORKS_MAJOR)) #define USAGE_ERROR(MSG) __attribute__((error(MSG))) #else -#define USAGE_DEPRECATED #define USAGE_ERROR(MSG) { throw std::runtime_error(MSG); } #endif @@ -436,6 +436,16 @@ private: friend class PVDataCreate; }; +/** + * @brief Some explicit specializations exist (defined in PVScalar.cpp) + */ +template<> + std::ostream& PVScalarValue::dumpValue(std::ostream& o) const; +template<> + std::ostream& PVScalarValue::dumpValue(std::ostream& o) const; +template<> + std::ostream& PVScalarValue::dumpValue(std::ostream& o) const; + /** * typedefs for the various possible scalar types. */ diff --git a/src/pv/pvType.h b/src/pv/pvType.h index 1a77ead..fe2d1ab 100644 --- a/src/pv/pvType.h +++ b/src/pv/pvType.h @@ -15,15 +15,19 @@ #ifndef PVTYPE_H #define PVTYPE_H -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX +#endif + +#if defined(_WIN32) && !defined(_MINGW) +#pragma warning( push ) #pragma warning(disable: 4251) #endif #include #include -#if defined(__vxworks) && \ +#if defined(vxWorks) && \ (_WRS_VXWORKS_MAJOR+0 <= 6) && (_WRS_VXWORKS_MINOR+0 < 9) typedef int intptr_t; typedef unsigned int uintptr_t; @@ -126,7 +130,9 @@ typedef std::vector::iterator StringArray_iterator; typedef std::vector::const_iterator StringArray_const_iterator; }} + +#if defined(_WIN32) && !defined(_MINGW) +#pragma warning( pop ) +#endif + #endif /* PVTYPE_H */ - - - diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index 0a342fe..67b4036 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -6,7 +6,7 @@ */ /* Author: Matej Sekoranja Date: 2010.10.18 */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/testApp/misc/testSerialization.cpp b/testApp/misc/testSerialization.cpp index 797a26f..8f96619 100644 --- a/testApp/misc/testSerialization.cpp +++ b/testApp/misc/testSerialization.cpp @@ -10,7 +10,7 @@ * Author: Miha Vitorovic */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/testApp/misc/testTypeCast.cpp b/testApp/misc/testTypeCast.cpp index cab5fb7..5c5014c 100644 --- a/testApp/misc/testTypeCast.cpp +++ b/testApp/misc/testTypeCast.cpp @@ -5,7 +5,7 @@ */ /* Author: Michael Davidsaver */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif