From b4cfe861d3856336f811b323f307cb8639be3508 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:23:31 -0500 Subject: [PATCH 01/15] MinGW provides popen() and pclose() --- pvtoolsSrc/eget.cpp | 2 +- pvtoolsSrc/pvlist.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pvtoolsSrc/eget.cpp b/pvtoolsSrc/eget.cpp index 85bd8c4..b43fdc5 100644 --- a/pvtoolsSrc/eget.cpp +++ b/pvtoolsSrc/eget.cpp @@ -45,7 +45,7 @@ bool transpose = false; bool dumpStructure = false; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(_MINGW) FILE *popen(const char *command, const char *mode) { return _popen(command, mode); } diff --git a/pvtoolsSrc/pvlist.cpp b/pvtoolsSrc/pvlist.cpp index 89064db..88258b9 100644 --- a/pvtoolsSrc/pvlist.cpp +++ b/pvtoolsSrc/pvlist.cpp @@ -25,7 +25,7 @@ #include #include -#ifdef _WIN32 +#if defined(_WIN32) && !defined(_MINGW) FILE *popen(const char *command, const char *mode) { return _popen(command, mode); } From 7ed5f8b4bfa63d6333d8ed52dafab573decba804 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:28:20 -0500 Subject: [PATCH 02/15] Wrong keyword, use epicsShareFunc --- src/client/pv/pvAccess.h | 6 +++--- src/pipelineService/pv/pipelineServer.h | 2 +- src/pva/pv/pvaVersion.h | 2 +- src/remote/pv/blockingUDP.h | 2 +- src/remoteClient/pv/clientContextImpl.h | 2 +- src/rpcService/pv/rpcServer.h | 2 +- src/server/pv/serverContext.h | 2 +- src/utils/pv/logger.h | 8 ++++---- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client/pv/pvAccess.h b/src/client/pv/pvAccess.h index 7ff9831..937c54a 100644 --- a/src/client/pv/pvAccess.h +++ b/src/client/pv/pvAccess.h @@ -990,9 +990,9 @@ public: virtual std::auto_ptr getProviderNames() = 0; }; -epicsShareExtern ChannelProviderRegistry::shared_pointer getChannelProviderRegistry(); -epicsShareExtern void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory); -epicsShareExtern void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory); +epicsShareFunc ChannelProviderRegistry::shared_pointer getChannelProviderRegistry(); +epicsShareFunc void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory); +epicsShareFunc void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory); /** diff --git a/src/pipelineService/pv/pipelineServer.h b/src/pipelineService/pv/pipelineServer.h index 4a50beb..968e9f0 100644 --- a/src/pipelineService/pv/pipelineServer.h +++ b/src/pipelineService/pv/pipelineServer.h @@ -65,7 +65,7 @@ public: }; -epicsShareExtern Channel::shared_pointer createPipelineChannel(ChannelProvider::shared_pointer const & provider, +epicsShareFunc Channel::shared_pointer createPipelineChannel(ChannelProvider::shared_pointer const & provider, std::string const & channelName, ChannelRequester::shared_pointer const & channelRequester, PipelineService::shared_pointer const & pipelineService); diff --git a/src/pva/pv/pvaVersion.h b/src/pva/pv/pvaVersion.h index a00a2a1..0781a42 100644 --- a/src/pva/pv/pvaVersion.h +++ b/src/pva/pv/pvaVersion.h @@ -111,7 +111,7 @@ private: bool _developmentFlag; }; -epicsShareExtern std::ostream& operator<<(std::ostream& o, const Version& v); +epicsShareFunc std::ostream& operator<<(std::ostream& o, const Version& v); } } diff --git a/src/remote/pv/blockingUDP.h b/src/remote/pv/blockingUDP.h index b49196e..606f092 100644 --- a/src/remote/pv/blockingUDP.h +++ b/src/remote/pv/blockingUDP.h @@ -505,7 +505,7 @@ private: typedef std::vector BlockingUDPTransportVector; -epicsShareExtern void initializeUDPTransports( +epicsShareFunc void initializeUDPTransports( bool serverFlag, BlockingUDPTransportVector& udpTransports, const IfaceNodeVector& ifaceList, diff --git a/src/remoteClient/pv/clientContextImpl.h b/src/remoteClient/pv/clientContextImpl.h index d74b987..5d5488b 100644 --- a/src/remoteClient/pv/clientContextImpl.h +++ b/src/remoteClient/pv/clientContextImpl.h @@ -131,7 +131,7 @@ public: virtual void destroy() = 0; }; -epicsShareExtern ChannelProvider::shared_pointer createClientProvider(const Configuration::shared_pointer& conf); +epicsShareFunc ChannelProvider::shared_pointer createClientProvider(const Configuration::shared_pointer& conf); } } diff --git a/src/rpcService/pv/rpcServer.h b/src/rpcService/pv/rpcServer.h index abc6c3c..b6ead62 100644 --- a/src/rpcService/pv/rpcServer.h +++ b/src/rpcService/pv/rpcServer.h @@ -67,7 +67,7 @@ public: }; -epicsShareExtern Channel::shared_pointer createRPCChannel(ChannelProvider::shared_pointer const & provider, +epicsShareFunc Channel::shared_pointer createRPCChannel(ChannelProvider::shared_pointer const & provider, std::string const & channelName, ChannelRequester::shared_pointer const & channelRequester, Service::shared_pointer const & rpcService); diff --git a/src/server/pv/serverContext.h b/src/server/pv/serverContext.h index dcae129..fde37e1 100644 --- a/src/server/pv/serverContext.h +++ b/src/server/pv/serverContext.h @@ -453,7 +453,7 @@ private: }; -epicsShareExtern ServerContext::shared_pointer startPVAServer( +epicsShareFunc ServerContext::shared_pointer startPVAServer( std::string const & providerNames = PVACCESS_ALL_PROVIDERS, int timeToRun = 0, bool runInSeparateThread = false, diff --git a/src/utils/pv/logger.h b/src/utils/pv/logger.h index 8d6ddc6..66456aa 100644 --- a/src/utils/pv/logger.h +++ b/src/utils/pv/logger.h @@ -48,9 +48,9 @@ OFF */ -epicsShareExtern void pvAccessLog(pvAccessLogLevel level, const char* format, ...); -epicsShareExtern void pvAccessSetLogLevel(pvAccessLogLevel level); -epicsShareExtern bool pvAccessIsLoggable(pvAccessLogLevel level); +epicsShareFunc void pvAccessLog(pvAccessLogLevel level, const char* format, ...); +epicsShareFunc void pvAccessSetLogLevel(pvAccessLogLevel level); +epicsShareFunc bool pvAccessIsLoggable(pvAccessLogLevel level); #if defined (__GNUC__) && __GNUC__ < 3 #define LOG(level, format, ARGS...) pvAccessLog(level, format, ##ARGS) @@ -76,7 +76,7 @@ epicsShareExtern bool pvAccessIsLoggable(pvAccessLogLevel level); * @param[in] fname The file to write to. If the file exists, it * is opened for append. */ -epicsShareExtern void createFileLogger( std::string const & fname ); +epicsShareFunc void createFileLogger( std::string const & fname ); } } From 8fdf0d74111a4f058c0eff4327e75998b60f2023 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:29:13 -0500 Subject: [PATCH 03/15] Use lower-case header filenames for MinGW cross-compilation --- testApp/remote/testGetPerformance.cpp | 2 +- testApp/remote/testMonitorPerformance.cpp | 2 +- testApp/utils/testInetAddressUtils.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testApp/remote/testGetPerformance.cpp b/testApp/remote/testGetPerformance.cpp index 6f5735f..ae12502 100644 --- a/testApp/remote/testGetPerformance.cpp +++ b/testApp/remote/testGetPerformance.cpp @@ -17,7 +17,7 @@ #include #ifdef _WIN32 -#include +#include #else #include #endif diff --git a/testApp/remote/testMonitorPerformance.cpp b/testApp/remote/testMonitorPerformance.cpp index 5b66f21..58b1970 100644 --- a/testApp/remote/testMonitorPerformance.cpp +++ b/testApp/remote/testMonitorPerformance.cpp @@ -17,7 +17,7 @@ #include #ifdef _WIN32 -#include +#include #else #include #endif diff --git a/testApp/utils/testInetAddressUtils.cpp b/testApp/utils/testInetAddressUtils.cpp index 7c2e0a3..1d84e73 100644 --- a/testApp/utils/testInetAddressUtils.cpp +++ b/testApp/utils/testInetAddressUtils.cpp @@ -217,7 +217,7 @@ void test_getLoopbackNIF() #ifdef _WIN32 // needed for ip_mreq -#include +#include #endif void test_multicastLoopback() From 12d68fe20958a45e15462d24e2ed907ab607f52f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:40:48 -0500 Subject: [PATCH 04/15] Add epicsExportSharedSymbols, move some includes --- src/ca/caChannel.cpp | 3 ++- src/remote/abstractResponseHandler.cpp | 11 +++++----- src/remote/beaconHandler.cpp | 1 + src/remote/blockingTCPAcceptor.cpp | 15 ++++++------- src/remote/blockingTCPConnector.cpp | 13 ++++++------ src/remote/blockingUDPConnector.cpp | 9 ++++---- src/remote/blockingUDPTransport.cpp | 21 ++++++++++--------- src/remote/simpleChannelSearchManagerImpl.cpp | 12 ++++++----- src/remote/transportRegistry.cpp | 1 + src/remoteClient/clientContextImpl.cpp | 3 ++- src/server/baseChannelRequester.cpp | 1 + src/server/beaconEmitter.cpp | 8 +++---- src/server/responseHandlers.cpp | 13 ++++++------ src/server/serverChannelImpl.cpp | 1 + src/utils/introspectionRegistry.cpp | 1 + src/utils/referenceCountingLock.cpp | 1 + 16 files changed, 65 insertions(+), 49 deletions(-) diff --git a/src/ca/caChannel.cpp b/src/ca/caChannel.cpp index 2d6a492..9ea13fa 100644 --- a/src/ca/caChannel.cpp +++ b/src/ca/caChannel.cpp @@ -6,9 +6,10 @@ #include -#include #include +#define epicsExportSharedSymbols +#include #include #include diff --git a/src/remote/abstractResponseHandler.cpp b/src/remote/abstractResponseHandler.cpp index 76b6262..14d349e 100644 --- a/src/remote/abstractResponseHandler.cpp +++ b/src/remote/abstractResponseHandler.cpp @@ -4,14 +4,15 @@ * in file LICENSE that is included with this distribution. */ -#include -#include - -#include +#include #include -#include +#include + +#define epicsExportSharedSymbols +#include +#include using std::ostringstream; using std::hex; diff --git a/src/remote/beaconHandler.cpp b/src/remote/beaconHandler.cpp index 21ca28b..2fd41d7 100644 --- a/src/remote/beaconHandler.cpp +++ b/src/remote/beaconHandler.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include #include diff --git a/src/remote/blockingTCPAcceptor.cpp b/src/remote/blockingTCPAcceptor.cpp index 63fbb28..9938419 100644 --- a/src/remote/blockingTCPAcceptor.cpp +++ b/src/remote/blockingTCPAcceptor.cpp @@ -4,18 +4,19 @@ * in file LICENSE that is included with this distribution. */ +#include + +#include +#include + +#include + +#define epicsExportSharedSymbols #include #include #include #include -#include - -#include -#include - -#include - using std::ostringstream; using namespace epics::pvData; diff --git a/src/remote/blockingTCPConnector.cpp b/src/remote/blockingTCPConnector.cpp index a1a4de6..fb08e78 100644 --- a/src/remote/blockingTCPConnector.cpp +++ b/src/remote/blockingTCPConnector.cpp @@ -4,18 +4,19 @@ * in file LICENSE that is included with this distribution. */ +#include +#include + +#include +#include + +#define epicsExportSharedSymbols #include #include #include #include #include -#include -#include - -#include -#include - using namespace epics::pvData; namespace epics { diff --git a/src/remote/blockingUDPConnector.cpp b/src/remote/blockingUDPConnector.cpp index ada3cd9..44a447c 100644 --- a/src/remote/blockingUDPConnector.cpp +++ b/src/remote/blockingUDPConnector.cpp @@ -4,13 +4,14 @@ * in file LICENSE that is included with this distribution. */ -#include -#include -#include +#include #include -#include +#define epicsExportSharedSymbols +#include +#include +#include using namespace std; using namespace epics::pvData; diff --git a/src/remote/blockingUDPTransport.cpp b/src/remote/blockingUDPTransport.cpp index 4ec1456..46c7f90 100644 --- a/src/remote/blockingUDPTransport.cpp +++ b/src/remote/blockingUDPTransport.cpp @@ -9,22 +9,23 @@ #include #endif +#include +#include + +#include +#include +#include + +#include +#include + +#define epicsExportSharedSymbols #include #include #include #include #include -#include -#include - -#include -#include -#include - -#include -#include - using namespace epics::pvData; using namespace std; using std::tr1::static_pointer_cast; diff --git a/src/remote/simpleChannelSearchManagerImpl.cpp b/src/remote/simpleChannelSearchManagerImpl.cpp index 459aade..b889839 100644 --- a/src/remote/simpleChannelSearchManagerImpl.cpp +++ b/src/remote/simpleChannelSearchManagerImpl.cpp @@ -4,16 +4,18 @@ * in file LICENSE that is included with this distribution. */ +#include +#include +#include + +#include + +#define epicsExportSharedSymbols #include #include #include #include -#include -#include -#include -#include - using namespace std; using namespace epics::pvData; diff --git a/src/remote/transportRegistry.cpp b/src/remote/transportRegistry.cpp index b7d73b6..69225c3 100644 --- a/src/remote/transportRegistry.cpp +++ b/src/remote/transportRegistry.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include using namespace epics::pvData; diff --git a/src/remoteClient/clientContextImpl.cpp b/src/remoteClient/clientContextImpl.cpp index d6e0910..11587a8 100644 --- a/src/remoteClient/clientContextImpl.cpp +++ b/src/remoteClient/clientContextImpl.cpp @@ -13,10 +13,10 @@ #include #include #include -#include #include #include +#define epicsExportSharedSymbols #include #include #include @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/server/baseChannelRequester.cpp b/src/server/baseChannelRequester.cpp index 8418c66..a77945c 100644 --- a/src/server/baseChannelRequester.cpp +++ b/src/server/baseChannelRequester.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include using namespace epics::pvData; diff --git a/src/server/beaconEmitter.cpp b/src/server/beaconEmitter.cpp index eca25b7..4b33299 100644 --- a/src/server/beaconEmitter.cpp +++ b/src/server/beaconEmitter.cpp @@ -8,12 +8,12 @@ #define NOMINMAX #endif -#include -#include - -#include #include +#define epicsExportSharedSymbols +#include +#include +#include #include using namespace std; diff --git a/src/server/responseHandlers.cpp b/src/server/responseHandlers.cpp index f2c1258..5dfd2d6 100644 --- a/src/server/responseHandlers.cpp +++ b/src/server/responseHandlers.cpp @@ -17,17 +17,18 @@ #include #include +#include +#include + +#include +#include + +#define epicsExportSharedSymbols #include #include #include #include - -#include - -#include -#include #include - #include #include #include diff --git a/src/server/serverChannelImpl.cpp b/src/server/serverChannelImpl.cpp index a8204d7..db08f83 100644 --- a/src/server/serverChannelImpl.cpp +++ b/src/server/serverChannelImpl.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include using namespace epics::pvData; diff --git a/src/utils/introspectionRegistry.cpp b/src/utils/introspectionRegistry.cpp index 87917e0..0d25665 100644 --- a/src/utils/introspectionRegistry.cpp +++ b/src/utils/introspectionRegistry.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include #include diff --git a/src/utils/referenceCountingLock.cpp b/src/utils/referenceCountingLock.cpp index a4c4149..e2c1e74 100644 --- a/src/utils/referenceCountingLock.cpp +++ b/src/utils/referenceCountingLock.cpp @@ -4,6 +4,7 @@ * in file LICENSE that is included with this distribution. */ +#define epicsExportSharedSymbols #include namespace epics { From 7ccb64eea671c62ec2716ef0e1dbe784157fa93b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:47:47 -0500 Subject: [PATCH 05/15] Fix includes on wrong side of epicsExportSharedSymbols --- src/ca/caProvider.cpp | 4 +--- src/pva/clientFactory.cpp | 6 ++++-- src/remote/pv/channelSearchManager.h | 4 ++-- src/remote/pv/transportRegistry.h | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ca/caProvider.cpp b/src/ca/caProvider.cpp index a515e04..0ec6d3c 100644 --- a/src/ca/caProvider.cpp +++ b/src/ca/caProvider.cpp @@ -10,10 +10,8 @@ #include #include -#include - #define epicsExportSharedSymbols - +#include #include #include diff --git a/src/pva/clientFactory.cpp b/src/pva/clientFactory.cpp index 2e8cec8..9075e70 100644 --- a/src/pva/clientFactory.cpp +++ b/src/pva/clientFactory.cpp @@ -4,12 +4,14 @@ * in file LICENSE that is included with this distribution. */ -#include -#include +#include #include +#include + #define epicsExportSharedSymbols +#include #include #include diff --git a/src/remote/pv/channelSearchManager.h b/src/remote/pv/channelSearchManager.h index 0544d9e..18bb5de 100644 --- a/src/remote/pv/channelSearchManager.h +++ b/src/remote/pv/channelSearchManager.h @@ -14,13 +14,13 @@ #include -#include - #ifdef channelSearchManagerEpicsExportSharedSymbols # define epicsExportSharedSymbols # undef channelSearchManagerEpicsExportSharedSymbols #endif +#include + namespace epics { namespace pvAccess { diff --git a/src/remote/pv/transportRegistry.h b/src/remote/pv/transportRegistry.h index 128006f..652597e 100644 --- a/src/remote/pv/transportRegistry.h +++ b/src/remote/pv/transportRegistry.h @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #ifdef transportRegistryEpicsExportSharedSymbols @@ -30,6 +28,9 @@ # undef transportRegistryEpicsExportSharedSymbols #endif +#include +#include + namespace epics { namespace pvAccess { From 01dce98a6c4f3c13b2da9daea0af3793a9522dbe Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:48:47 -0500 Subject: [PATCH 06/15] Add copyright notice --- src/mb/pv/pvAccessMB.h | 6 ++++++ src/mb/pvAccessMB.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/mb/pv/pvAccessMB.h b/src/mb/pv/pvAccessMB.h index 9bc5a1a..693e436 100644 --- a/src/mb/pv/pvAccessMB.h +++ b/src/mb/pv/pvAccessMB.h @@ -1,3 +1,9 @@ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * pvAccessCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ + #ifndef _PVACCESSMB_H_ #define _PVACCESSMB_H_ diff --git a/src/mb/pvAccessMB.cpp b/src/mb/pvAccessMB.cpp index fb33716..b5a8fbc 100644 --- a/src/mb/pvAccessMB.cpp +++ b/src/mb/pvAccessMB.cpp @@ -1,3 +1,9 @@ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * pvAccessCPP is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ + #include "pv/pvAccessMB.h" MB_DECLARE(channelGet, 100000); From 1e031bf39357005104ece6b5e2640de688cd8256 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:52:04 -0500 Subject: [PATCH 07/15] Reorder some include lines Order should be Compiler, OS, Base, pvData, pvAccess This makes it much easier to get the epicsExport stuff right. --- src/utils/inetAddressUtil.cpp | 6 ++++-- src/utils/logger.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/utils/inetAddressUtil.cpp b/src/utils/inetAddressUtil.cpp index ad95000..c1b17b0 100644 --- a/src/utils/inetAddressUtil.cpp +++ b/src/utils/inetAddressUtil.cpp @@ -9,11 +9,13 @@ #include #include -#include -#include #include #include +#include +#include +#include + #define epicsExportSharedSymbols #include diff --git a/src/utils/logger.cpp b/src/utils/logger.cpp index bf48568..0efaf59 100644 --- a/src/utils/logger.cpp +++ b/src/utils/logger.cpp @@ -10,15 +10,14 @@ #include #include +#include +#include +#include + #include #include #include -#include -#include - -#include - #define epicsExportSharedSymbols #include From e28fd6129e346c7a95ea4d6cb6b4373083ef8716 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:57:56 -0500 Subject: [PATCH 08/15] Remove need to undef epicsExportSharedSymbols This approach works OK, but makes it much harder to find files that have mistakes in them since they can cause other functions to get the wrong import/export setting. --- src/mb/pv/pvAccessMB.h | 11 ----------- src/mb/pvAccessMB.cpp | 4 ++++ src/remote/codec.cpp | 28 +++++++++++++++++++--------- src/remote/pv/codec.h | 12 ------------ src/remote/pv/serializationHelper.h | 10 ---------- src/remote/serializationHelper.cpp | 6 ++++++ src/server/pv/responseHandlers.h | 10 ---------- src/utils/pv/inetAddressUtil.h | 15 ++------------- src/utils/pv/logger.h | 13 +------------ 9 files changed, 32 insertions(+), 77 deletions(-) diff --git a/src/mb/pv/pvAccessMB.h b/src/mb/pv/pvAccessMB.h index 693e436..6a09bac 100644 --- a/src/mb/pv/pvAccessMB.h +++ b/src/mb/pv/pvAccessMB.h @@ -7,11 +7,6 @@ #ifndef _PVACCESSMB_H_ #define _PVACCESSMB_H_ -#ifdef epicsExportSharedSymbols -# define pvAccessMBEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #ifdef WITH_MICROBENCH #include @@ -44,12 +39,6 @@ #endif - -#ifdef pvAccessMBEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# undef pvAccessMBEpicsExportSharedSymbols -#endif - MB_DECLARE_EXTERN(channelGet); #endif diff --git a/src/mb/pvAccessMB.cpp b/src/mb/pvAccessMB.cpp index b5a8fbc..3b9bf55 100644 --- a/src/mb/pvAccessMB.cpp +++ b/src/mb/pvAccessMB.cpp @@ -4,6 +4,10 @@ * in file LICENSE that is included with this distribution. */ +#include + +#define epicsExportSharedSymbols + #include "pv/pvAccessMB.h" MB_DECLARE(channelGet, 100000); diff --git a/src/remote/codec.cpp b/src/remote/codec.cpp index b62c71c..fb58723 100644 --- a/src/remote/codec.cpp +++ b/src/remote/codec.cpp @@ -8,23 +8,33 @@ #endif -#include -#include - -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include #define epicsExportSharedSymbols #include #include +#include #include #include #include +#include #include #include diff --git a/src/remote/pv/codec.h b/src/remote/pv/codec.h index 14d7a8b..3257f7c 100644 --- a/src/remote/pv/codec.h +++ b/src/remote/pv/codec.h @@ -11,13 +11,7 @@ #include #include -#ifdef epicsExportSharedSymbols -# define abstractCodecEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include -#include #include #include #include @@ -37,11 +31,6 @@ #include #include -#ifdef abstractCodecEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# undef abstractCodecEpicsExportSharedSymbols -#endif - #include #include #include @@ -50,7 +39,6 @@ #include #include -#include namespace epics { namespace pvAccess { diff --git a/src/remote/pv/serializationHelper.h b/src/remote/pv/serializationHelper.h index 2669990..43ce206 100644 --- a/src/remote/pv/serializationHelper.h +++ b/src/remote/pv/serializationHelper.h @@ -8,22 +8,12 @@ #ifndef SERIALIZATIONHELPER_H_ #define SERIALIZATIONHELPER_H_ -#ifdef epicsExportSharedSymbols -# define serializationHelperEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include #include #include #include #include -#ifdef serializationHelperEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# undef serializationHelperEpicsExportSharedSymbols -#endif - #include #include diff --git a/src/remote/serializationHelper.cpp b/src/remote/serializationHelper.cpp index 647d56a..94d94f4 100644 --- a/src/remote/serializationHelper.cpp +++ b/src/remote/serializationHelper.cpp @@ -4,6 +4,12 @@ * in file LICENSE that is included with this distribution. */ +#include +#include +#include +#include +#include + #define epicsExportSharedSymbols #include #include diff --git a/src/server/pv/responseHandlers.h b/src/server/pv/responseHandlers.h index 44447ed..8fedbad 100644 --- a/src/server/pv/responseHandlers.h +++ b/src/server/pv/responseHandlers.h @@ -7,18 +7,8 @@ #ifndef RESPONSEHANDLERS_H_ #define RESPONSEHANDLERS_H_ -#ifdef epicsExportSharedSymbols -# define responseHandlersEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - #include -#ifdef responseHandlersEpicsExportSharedSymbols -# define epicsExportSharedSymbols -# undef responseHandlersEpicsExportSharedSymbols -#endif - #include #include #include diff --git a/src/utils/pv/inetAddressUtil.h b/src/utils/pv/inetAddressUtil.h index 196a14e..33db442 100644 --- a/src/utils/pv/inetAddressUtil.h +++ b/src/utils/pv/inetAddressUtil.h @@ -9,23 +9,12 @@ #include -#ifdef epicsExportSharedSymbols -# define inetAddressUtilExportSharedSymbols -# undef epicsExportSharedSymbols -#endif +#include +#include #include #include -#include - -#ifdef inetAddressUtilExportSharedSymbols -# define epicsExportSharedSymbols -# undef inetAddressUtilExportSharedSymbols -#endif - -#include - // TODO implement using smart pointers diff --git a/src/utils/pv/logger.h b/src/utils/pv/logger.h index 66456aa..cfdbdbb 100644 --- a/src/utils/pv/logger.h +++ b/src/utils/pv/logger.h @@ -7,18 +7,7 @@ #ifndef LOGGER_H_ #define LOGGER_H_ -#ifdef epicsExportSharedSymbols -# define loggerEpicsExportSharedSymbols -# undef epicsExportSharedSymbols -#endif - -#include -#include - -#ifdef loggerEpicsExportSharedSymbols -# define epicsExportSharedSymbols -#undef loggerEpicsExportSharedSymbols -#endif +#include #include From f2f14dc5a70232ef54f4a7789506dc0af8e004cd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 5 Apr 2016 18:58:35 -0500 Subject: [PATCH 09/15] Link with pvMB when requested --- src/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Makefile b/src/Makefile index 7a304f4..57c162b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,6 +36,9 @@ LIBRARY = pvAccess SHRLIB_VERSION = $(EPICS_PVA_MAJOR_VERSION).$(EPICS_PVA_MINOR_VERSION).$(EPICS_PVA_MAINTENANCE_VERSION) pvAccess_LIBS += pvData +ifdef WITH_MICROBENCH + pvAccess_LIBS += pvMB +endif pvAccess_LIBS += ca pvAccess_LIBS += Com From d76d7faab66de3316ff227c1bfaf4d79a523adb4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 11:33:59 -0500 Subject: [PATCH 10/15] Prevent redefinition warning on MinGW --- testApp/remote/testServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testApp/remote/testServer.cpp b/testApp/remote/testServer.cpp index 7f9314e..7c7dce1 100644 --- a/testApp/remote/testServer.cpp +++ b/testApp/remote/testServer.cpp @@ -2,7 +2,7 @@ * testServer.cpp */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif From 962e139c1a6e288984d5a379c880ee07a1d02b48 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 11:40:16 -0500 Subject: [PATCH 11/15] Don't use %z modifier, not portable. --- testApp/remote/channelAccessIFTest.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/testApp/remote/channelAccessIFTest.cpp b/testApp/remote/channelAccessIFTest.cpp index 953b826..c849b2a 100644 --- a/testApp/remote/channelAccessIFTest.cpp +++ b/testApp/remote/channelAccessIFTest.cpp @@ -1987,7 +1987,7 @@ void ChannelAccessIFTest::test_channelArray() { PVDoubleArrayPtr array3 = TR1::static_pointer_cast(arrayReq->getArray()); PVDoubleArray::const_svector data3(array3->view()); testOk(data3.size() == newLength, - "%s: data size after calling setLength should be %zu", CURRENT_FUNCTION, newLength); + "%s: data size after calling setLength should be %lu", CURRENT_FUNCTION, (unsigned long) newLength); testOk(data3[0] == 1.1 , "%s: 3.check 0: %f", CURRENT_FUNCTION, data3[0]); testOk(data3[1] == 2.2 , "%s: 3.check 1: %f", CURRENT_FUNCTION, data3[1]); @@ -2007,8 +2007,8 @@ void ChannelAccessIFTest::test_channelArray() { PVDoubleArrayPtr array4 = TR1::static_pointer_cast(arrayReq->getArray()); PVDoubleArray::const_svector data4(array4->view()); - testOk(data4.size() == bigCapacity, "%s: data size after calling setLength should be %zu", - CURRENT_FUNCTION, bigCapacity); + testOk(data4.size() == bigCapacity, "%s: data size after calling setLength should be %lu", + CURRENT_FUNCTION, (unsigned long) bigCapacity); testOk(data4[0] == 1.1 , "%s: 4.check 0: %f", CURRENT_FUNCTION, data4[0]); testOk(data4[1] == 2.2 , "%s: 4.check 1: %f", CURRENT_FUNCTION, data4[1]); /* @@ -2022,7 +2022,7 @@ void ChannelAccessIFTest::test_channelArray() { if (i == bigCapacity) testOk("%s: 4.check: all data 0.0", CURRENT_FUNCTION); else - testFail("%s: 4.check: data at %zu should be 0.0 but was %f", CURRENT_FUNCTION, i, data4[i]); + testFail("%s: 4.check: data at %lu should be 0.0 but was %f", CURRENT_FUNCTION, (unsigned long) i, data4[i]); } else { testFail("%s: will not check the rest of the array if the size is not correct", CURRENT_FUNCTION); @@ -2040,7 +2040,7 @@ void ChannelAccessIFTest::test_channelArray() { testFail("%s: an array getLength failed", CURRENT_FUNCTION); return; } - testOk(arrayReq->getLength() == newLen, "%s: retrieved length should be %zu", CURRENT_FUNCTION, newLen); + testOk(arrayReq->getLength() == newLen, "%s: retrieved length should be %lu", CURRENT_FUNCTION, (unsigned long) newLen); channel->destroy(); @@ -2180,7 +2180,7 @@ void ChannelAccessIFTest::test_stressPutAndGetLargeArray() { for (size_t len = minSize; len <= maxSize; len+=step) { - //testDiag("%s: array size %zd", CURRENT_FUNCTION, len); + //testDiag("%s: array size %lu", CURRENT_FUNCTION, (unsigned long) len); // prepare data newdata.resize(len); @@ -2192,19 +2192,19 @@ void ChannelAccessIFTest::test_stressPutAndGetLargeArray() { bool succStatus = putReq->syncPut(false, getTimeoutSec()); if (!succStatus) { - testFail("%s: sync put failed at array size %zd", CURRENT_FUNCTION, len); + testFail("%s: sync put failed at array size %lu", CURRENT_FUNCTION, (unsigned long) len); return; } succStatus = putReq->syncGet(getTimeoutSec()); if (!succStatus) { - testFail("%s: sync get failed at array size %zd", CURRENT_FUNCTION, len); + testFail("%s: sync get failed at array size %lu", CURRENT_FUNCTION, (unsigned long) len); return; } // length check if (value->getLength() != len) { - testFail("%s: length does not math %zd != %zd", CURRENT_FUNCTION, len, value->getLength()); + testFail("%s: length does not match %lu != %lu", CURRENT_FUNCTION, (unsigned long) len, (unsigned long) value->getLength()); return; } @@ -2212,7 +2212,7 @@ void ChannelAccessIFTest::test_stressPutAndGetLargeArray() { PVDoubleArray::const_svector data(value->view()); for (size_t i = 0; i < len; i++) { if (i != data[i]) // NOTE: floating-point value comparison without delta - testFail("%s: data slot %zd does not match %f != %f at array size %zd", CURRENT_FUNCTION, i, (double)i, data[i], len); + testFail("%s: data slot %lu does not match %f != %f at array size %lu", CURRENT_FUNCTION, (unsigned long) i, (double)i, data[i], (unsigned long) len); } } From 0ad8ece84016667b456098d94e8f92903de1305e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 15:19:35 -0500 Subject: [PATCH 12/15] Define and use GETPID() macro --- src/server/responseHandlers.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/server/responseHandlers.cpp b/src/server/responseHandlers.cpp index 5dfd2d6..7463a0c 100644 --- a/src/server/responseHandlers.cpp +++ b/src/server/responseHandlers.cpp @@ -4,19 +4,27 @@ * in file LICENSE that is included with this distribution. */ -#ifdef __vxworks -#include -#endif - -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX -#include #endif #include #include #include +#ifdef _WIN32 +#define GETPID() GetCurrentProcessId() +#endif + +#ifdef vxWorks +#include +#define GETPID() taskIdSelf() +#endif + +#ifndef GETPID +#define GETPID() getpid() +#endif + #include #include @@ -619,13 +627,7 @@ public: result->getSubFieldT("host")->put(hostName); std::stringstream sspid; -#ifdef __vxworks - sspid << taskIdSelf(); -#elif defined(_WIN32) - sspid << _getpid(); -#else - sspid << getpid(); -#endif + sspid << GETPID(); result->getSubFieldT("process")->put(sspid.str()); char timeText[64]; From 9a8644033df7a641393a4842f6855726ca649723 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 15:22:11 -0500 Subject: [PATCH 13/15] Prevent redefinition of NOMINMAX While this protection is not strictly necessary here, if someone does a cut-and-paste into a header file it should be included. --- pvtoolsSrc/eget.cpp | 2 +- src/remote/codec.cpp | 3 ++- src/server/beaconEmitter.cpp | 2 +- testApp/remote/testCodec.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pvtoolsSrc/eget.cpp b/pvtoolsSrc/eget.cpp index b43fdc5..00508c6 100644 --- a/pvtoolsSrc/eget.cpp +++ b/pvtoolsSrc/eget.cpp @@ -1,4 +1,4 @@ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/remote/codec.cpp b/src/remote/codec.cpp index fb58723..15f6c2e 100644 --- a/src/remote/codec.cpp +++ b/src/remote/codec.cpp @@ -3,7 +3,8 @@ * pvAccessCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ -#ifdef _WIN32 + +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/src/server/beaconEmitter.cpp b/src/server/beaconEmitter.cpp index 4b33299..bdce554 100644 --- a/src/server/beaconEmitter.cpp +++ b/src/server/beaconEmitter.cpp @@ -4,7 +4,7 @@ * in file LICENSE that is included with this distribution. */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif diff --git a/testApp/remote/testCodec.cpp b/testApp/remote/testCodec.cpp index 89a9fb0..73fbabb 100644 --- a/testApp/remote/testCodec.cpp +++ b/testApp/remote/testCodec.cpp @@ -2,7 +2,7 @@ * testCodec.cpp */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(NOMINMAX) #define NOMINMAX #endif From b928ea4aab4cc1514e2b0a9e241b9a637d6d8b48 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 16:21:06 -0500 Subject: [PATCH 14/15] Fix oops when MB turned off. --- src/mb/pvAccessMB.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mb/pvAccessMB.cpp b/src/mb/pvAccessMB.cpp index 3b9bf55..cb4286d 100644 --- a/src/mb/pvAccessMB.cpp +++ b/src/mb/pvAccessMB.cpp @@ -4,7 +4,9 @@ * in file LICENSE that is included with this distribution. */ +#ifdef WITH_MICROBENCH #include +#endif #define epicsExportSharedSymbols From 6698bb86fb81848cd200f2aa4e11ba7d32fe5327 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Apr 2016 17:02:03 -0500 Subject: [PATCH 15/15] Additional includes needed for MSVC --- src/server/serverContext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/serverContext.cpp b/src/server/serverContext.cpp index 14f7cf1..012128d 100644 --- a/src/server/serverContext.cpp +++ b/src/server/serverContext.cpp @@ -6,6 +6,10 @@ #include +#include +#include +#include + #define epicsExportSharedSymbols #include #include