QPID-7306: Conditional compile mismatch in broker and common libs.

Removed _IN_QPID_BROKER compile definition:

Inconsistently set for libqpidcommon (compiled .cpp files) and libqpidbroker (uses .h) files
  - The broker has a binary incompatible notion of what is in the library.

It sort-of works by accident:
   - shared_ptr<T> only contains a T*, the mismatch is effectively doing reinterpret_cast<T*>
   - plain T* works for op->, but doesn't guarantee no concurrent deletes.
   - we create and destroy shared_ptr in libraries with _IN_QPID_BROKER set so
     we get cleanup, and no cores if we're lucky but there is limited protection from races.

Was only used by management:
  - I think exposing non-shared ptr GetObject was a feature that never materialized,
  - if not we need a separate function or class for non-shared-ptr users.

git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1749781 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt
index 3b9bc47..ef203e5 100644
--- a/qpid/cpp/src/CMakeLists.txt
+++ b/qpid/cpp/src/CMakeLists.txt
@@ -491,8 +491,7 @@
                qpid/xml/XmlExchangePlugin.cpp)
   target_link_libraries (xml xerces-c xqilla qpidbroker qpidcommon)
   set_target_properties (xml PROPERTIES
-                         PREFIX ""
-                         COMPILE_DEFINITIONS _IN_QPID_BROKER)
+                         PREFIX "")
   install (TARGETS xml
            DESTINATION ${QPIDD_MODULE_DIR}
            COMPONENT ${QPID_COMPONENT_BROKER})
@@ -576,8 +575,7 @@
                            qpidtypes qpidcommon qpidbroker qpidmessaging
                            ${Boost_PROGRAM_OPTIONS_LIBRARY})
     set_target_properties (ha PROPERTIES
-                           PREFIX ""
-                           COMPILE_DEFINITIONS _IN_QPID_BROKER)
+                           PREFIX "")
     install (TARGETS ha
              DESTINATION ${QPIDD_MODULE_DIR}
              COMPONENT ${QPID_COMPONENT_BROKER})
@@ -1139,8 +1137,8 @@
 
 set_target_properties (qpidbroker PROPERTIES
                        VERSION ${qpidbroker_version}
-                       SOVERSION ${qpidbroker_version_major}
-                       COMPILE_DEFINITIONS _IN_QPID_BROKER)
+                       SOVERSION ${qpidbroker_version_major})
+
 if (CMAKE_CXX_COMPILER_ID MATCHES XL)
   set_target_properties (qpidbroker PROPERTIES LINK_FLAGS -Wl,-bbigtoc)
 endif (CMAKE_CXX_COMPILER_ID MATCHES XL)
@@ -1163,7 +1161,6 @@
 add_msvc_version (qpidd application exe)
 add_executable (qpidd ${qpidd_SOURCES})
 target_link_libraries (qpidd qpidbroker qpidcommon)
-set_target_properties (qpidd PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
 install (TARGETS qpidd
          RUNTIME DESTINATION ${QPID_INSTALL_SBINDIR} COMPONENT ${QPID_COMPONENT_BROKER}
          LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_BROKER}
diff --git a/qpid/cpp/src/amqp.cmake b/qpid/cpp/src/amqp.cmake
index 9e2bf75..ea36a92 100644
--- a/qpid/cpp/src/amqp.cmake
+++ b/qpid/cpp/src/amqp.cmake
@@ -106,8 +106,7 @@
     add_library (amqp MODULE ${amqp_SOURCES})
     target_link_libraries (amqp qpidtypes qpidbroker qpidcommon ${Proton_LIBRARIES})
     set_target_properties (amqp PROPERTIES
-                           PREFIX ""
-                           COMPILE_DEFINITIONS _IN_QPID_BROKER)
+                           PREFIX "")
 
     install (TARGETS amqp
              DESTINATION ${QPIDD_MODULE_DIR}
diff --git a/qpid/cpp/src/legacystore.cmake b/qpid/cpp/src/legacystore.cmake
index 3cb1171..ef5df28 100644
--- a/qpid/cpp/src/legacystore.cmake
+++ b/qpid/cpp/src/legacystore.cmake
@@ -115,7 +115,7 @@
         qpid/legacystore/TxnCtxt.cpp
     )
 
-    set (legacystore_defines _IN_QPID_BROKER RHM_CLEAN)
+    set (legacystore_defines RHM_CLEAN)
 
     if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/db-inc.h)
       message(STATUS "Including BDB from ${DB_CXX_INCLUDE_DIR}/db_cxx.h")
diff --git a/qpid/cpp/src/linearstore.cmake b/qpid/cpp/src/linearstore.cmake
index e876ca7..8c90e8a 100644
--- a/qpid/cpp/src/linearstore.cmake
+++ b/qpid/cpp/src/linearstore.cmake
@@ -150,7 +150,6 @@
 
     set_target_properties (linearstore PROPERTIES
         PREFIX ""
-        COMPILE_DEFINITIONS _IN_QPID_BROKER
         OUTPUT_NAME linearstore
         INCLUDE_DIRECTORIES "${linear_include_DIRECTORIES}"
     )
diff --git a/qpid/cpp/src/qpid/management/Manageable.h b/qpid/cpp/src/qpid/management/Manageable.h
index ede5c29..70c9a5a 100644
--- a/qpid/cpp/src/qpid/management/Manageable.h
+++ b/qpid/cpp/src/qpid/management/Manageable.h
@@ -55,11 +55,7 @@
     //
     //  This accessor function returns a pointer to the management object.
     //
-#ifdef _IN_QPID_BROKER
     virtual ManagementObject::shared_ptr GetManagementObject() const = 0;
-#else
-    virtual ManagementObject* GetManagementObject() const = 0;
-#endif
 
     //  Every "Manageable" object must implement ManagementMethod.  This
     //  function is called when a remote management client invokes a method
diff --git a/qpid/cpp/src/qpid/management/ManagementObject.h b/qpid/cpp/src/qpid/management/ManagementObject.h
index 93fbec7..5719c23 100644
--- a/qpid/cpp/src/qpid/management/ManagementObject.h
+++ b/qpid/cpp/src/qpid/management/ManagementObject.h
@@ -28,9 +28,7 @@
 #include <map>
 #include <vector>
 
-#ifdef _IN_QPID_BROKER
 #include <boost/shared_ptr.hpp>
-#endif
 
 namespace qpid {
 namespace management {
@@ -158,9 +156,7 @@
     QPID_COMMON_EXTERN uint32_t writeTimestampsSize() const;
 
   public:
-#ifdef _IN_QPID_BROKER
     typedef boost::shared_ptr<ManagementObject> shared_ptr;
-#endif
 
     QPID_COMMON_EXTERN static const uint8_t MD5_LEN = 16;
     QPID_COMMON_EXTERN static int maxThreads;
@@ -234,10 +230,8 @@
     //QPID_COMMON_EXTERN void mapDecode(const types::Variant::Map& map);
 };
 
-#ifdef _IN_QPID_BROKER
 typedef std::map<ObjectId, ManagementObject::shared_ptr> ManagementObjectMap;
 typedef std::vector<ManagementObject::shared_ptr> ManagementObjectVector;
-#endif
 
 }}
 
diff --git a/qpid/cpp/src/qpid/store/CMakeLists.txt b/qpid/cpp/src/qpid/store/CMakeLists.txt
index ee78947..ec1fa16 100644
--- a/qpid/cpp/src/qpid/store/CMakeLists.txt
+++ b/qpid/cpp/src/qpid/store/CMakeLists.txt
@@ -40,7 +40,6 @@
 
   set_target_properties (store PROPERTIES
                          PREFIX ""
-                         COMPILE_DEFINITIONS _IN_QPID_BROKER
                          LINK_FLAGS "${GCC_CATCH_UNDEFINED}")
 endif (CMAKE_COMPILER_IS_GNUCXX)
 
@@ -54,7 +53,6 @@
 endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
 
 set_target_properties (store PROPERTIES
-                       COMPILE_DEFINITIONS _IN_QPID_BROKER
                        VERSION ${qpidc_version})
 install (TARGETS store # RUNTIME
          DESTINATION ${QPIDD_MODULE_DIR}
@@ -82,7 +80,6 @@
                ms-sql/State.cpp
                ms-sql/TplRecordset.cpp
                ms-sql/VariantHelper.cpp)
-  set_target_properties (mssql_store PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
   target_link_libraries (mssql_store qpidbroker qpidcommon)
   install (TARGETS mssql_store # RUNTIME
            DESTINATION ${QPIDD_MODULE_DIR}
@@ -112,7 +109,6 @@
                ms-sql/State.cpp
                ms-sql/VariantHelper.cpp)
   include_directories(ms-sql)
-  set_target_properties (msclfs_store PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
   target_link_libraries (msclfs_store qpidbroker qpidcommon clfsw32.lib)
   install (TARGETS msclfs_store # RUNTIME
            DESTINATION ${QPIDD_MODULE_DIR}
diff --git a/qpid/cpp/src/rdma.cmake b/qpid/cpp/src/rdma.cmake
index 9db0626..07fac5c 100644
--- a/qpid/cpp/src/rdma.cmake
+++ b/qpid/cpp/src/rdma.cmake
@@ -79,7 +79,6 @@
   add_library (rdma MODULE qpid/sys/RdmaIOPlugin.cpp)
   target_link_libraries (rdma qpidbroker qpidcommon rdmawrap)
   set_target_properties (rdma PROPERTIES
-                         COMPILE_DEFINITIONS _IN_QPID_BROKER
                          PREFIX "")
 
   if (CMAKE_COMPILER_IS_GNUCXX)
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt
index 930d8b7..d69d287 100644
--- a/qpid/cpp/src/tests/CMakeLists.txt
+++ b/qpid/cpp/src/tests/CMakeLists.txt
@@ -214,7 +214,6 @@
 target_link_libraries (unit_test
                        ${qpid_test_boost_libs}
                        qpidmessaging qpidtypes qpidbroker qpidclient qpidcommon)
-set_target_properties (unit_test PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
 
 endif (BUILD_TESTING_UNITTESTS)
 
@@ -306,7 +305,6 @@
     # Posix-only tests
 
     add_test(NAME ha_tests COMMAND ${PYTHON_EXECUTABLE} run_ha_tests)
-    
     add_test(NAME ipv6_tests COMMAND run_ipv6_tests) # Also pretty simple to convert
     add_test(NAME logging_tests COMMAND run_logging_tests) # Pretty simple to convert
     add_test(NAME paged_queue_tests COMMAND run_paged_queue_tests)