You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/03/02 14:13:20 UTC

[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #53: Smart pointer support

ams-tschoening commented on a change in pull request #53:
URL: https://github.com/apache/logging-log4cxx/pull/53#discussion_r585597348



##########
File path: src/cmake/boost-fallback/boost-std-configuration.h.cmake
##########
@@ -0,0 +1,94 @@
+#ifndef BOOST_STD_CONFIGURATION_H
+#define BOOST_STD_CONFIGURATION_H
+
+#cmakedefine01 STD_THREAD_FOUND
+#cmakedefine01 Boost_THREAD_FOUND
+#cmakedefine01 STD_MUTEX_FOUND
+#cmakedefine01 Boost_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_MUTEX_FOUND
+#cmakedefine01 Boost_SHARED_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_PTR_FOUND
+#cmakedefine01 Boost_SHARED_PTR_FOUND
+#cmakedefine01 STD_ATOMIC_FOUND
+#cmakedefine01 Boost_ATOMIC_FOUND
+
+#if STD_THREAD_FOUND
+#include <thread>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::thread thread;
+}
+#elif Boost_THREAD_FOUND
+#include <boost/thread.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::thread thread;
+}
+#endif
+
+#if STD_MUTEX_FOUND
+#include <mutex>
+#include <condition_variable>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::mutex mutex;
+    template <typename T>
+    using unique_lock = std::unique_lock<T>;
+    typedef std::condition_variable condition_variable;
+}
+#elif Boost_MUTEX_FOUND
+#include <boost/thread.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::mutex mutex;
+    template <typename T>
+    using unique_lock = boost::unique_lock<T>;
+    typedef boost::condition_variable condition_variable;
+}
+#endif
+
+#if STD_SHARED_MUTEX_FOUND
+#include <shared_mutex>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::shared_mutex shared_mutex;
+    template <typename T>
+    using shared_lock = std::shared_lock<T>;
+}
+#elif Boost_SHARED_MUTEX_FOUND
+#include <boost/thread/shared_mutex.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::shared_mutex shared_mutex;
+    template <typename T>
+    using shared_lock = boost::shared_lock<T>;
+}
+#endif
+
+#if STD_SHARED_PTR_FOUND
+#include <memory>
+namespace ${NAMESPACE_ALIAS} {
+    template <typename T>
+    using shared_ptr = std::shared_ptr<T>;
+    template <typename T>
+    using weak_ptr = std::weak_ptr<T>;
+}
+#elif Boost_SHARED_PTR_FOUND
+#include <boost/smart_ptr.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    template <typename T>
+    using shared_ptr = boost::shared_ptr<T>;
+    template <typename T>
+    using weak_ptr = boost::weak_ptr<T>;
+}
+#endif
+
+#if STD_ATOMIC_FOUND
+#include <atomic>
+namespace ${NAMESPACE_ALIAS} {
+    template <typename T>
+    using atomic = std::atomic<T>;
+}
+#elif Boost_ATOMIC_FOUND
+#include <boost/atomic.hpp>

Review comment:
       [Only at least C++11 will be supported](https://lists.apache.org/thread.html/re744feb89b0bf9a15b03d145a88fe0d0be48ad069d12a31b8ba5d461%40%3Cdev.logging.apache.org%3E) in future and especially `BCC32` is a dead-end for everyone still using it anyway. Embarcadero prefers its CLANG-based alternatives as well for some years now, people need to upgrade their projects.

##########
File path: src/cmake/boost-fallback/boost-std-configuration.h.cmake
##########
@@ -0,0 +1,94 @@
+#ifndef BOOST_STD_CONFIGURATION_H
+#define BOOST_STD_CONFIGURATION_H
+
+#cmakedefine01 STD_THREAD_FOUND
+#cmakedefine01 Boost_THREAD_FOUND
+#cmakedefine01 STD_MUTEX_FOUND
+#cmakedefine01 Boost_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_MUTEX_FOUND
+#cmakedefine01 Boost_SHARED_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_PTR_FOUND
+#cmakedefine01 Boost_SHARED_PTR_FOUND
+#cmakedefine01 STD_ATOMIC_FOUND
+#cmakedefine01 Boost_ATOMIC_FOUND
+
+#if STD_THREAD_FOUND
+#include <thread>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::thread thread;
+}
+#elif Boost_THREAD_FOUND
+#include <boost/thread.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::thread thread;
+}
+#endif
+
+#if STD_MUTEX_FOUND
+#include <mutex>
+#include <condition_variable>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::mutex mutex;
+    template <typename T>
+    using unique_lock = std::unique_lock<T>;

Review comment:
       [Only at least C++11 will be supported](https://lists.apache.org/thread.html/re744feb89b0bf9a15b03d145a88fe0d0be48ad069d12a31b8ba5d461%40%3Cdev.logging.apache.org%3E) in future and especially `BCC32` is a dead-end for everyone still using it anyway. Embarcadero prefers its CLANG-based alternatives as well for some years now, people need to upgrade their projects.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org