You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2022/12/30 23:52:02 UTC

[logging-log4cxx] 01/01: Prevent compilation error using a C++11 standard compiler

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch move_boost_std_configuration
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit a5db3310824f81a4978178b32dcdc756e139a953
Author: Stephen Webb <st...@sabreautonomous.com.au>
AuthorDate: Sat Dec 31 10:51:41 2022 +1100

    Prevent compilation error using a C++11 standard compiler
---
 src/cmake/boost-fallback/makeunique.h.cmake      | 16 ++++++++++++++++
 src/main/cpp/multiprocessrollingfileappender.cpp |  2 +-
 src/main/cpp/timebasedrollingpolicy.cpp          |  2 +-
 src/main/include/CMakeLists.txt                  |  7 +++++--
 src/main/include/log4cxx/log4cxx.h.in            |  1 +
 5 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/cmake/boost-fallback/makeunique.h.cmake b/src/cmake/boost-fallback/makeunique.h.cmake
new file mode 100644
index 00000000..77a1a545
--- /dev/null
+++ b/src/cmake/boost-fallback/makeunique.h.cmake
@@ -0,0 +1,16 @@
+#ifndef LOG4CXX_MAKE_UNIQUE_H
+#define LOG4CXX_MAKE_UNIQUE_H
+
+#cmakedefine01 STD_MAKE_UNIQUE_FOUND
+
+#if !STD_MAKE_UNIQUE_FOUND
+namespace std{
+template<typename T, typename ...Args>
+std::unique_ptr<T> make_unique( Args&& ...args )
+{
+    return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
+}
+}
+#endif
+
+#endif /* LOG4CXX_MAKE_UNIQUE_H */
diff --git a/src/main/cpp/multiprocessrollingfileappender.cpp b/src/main/cpp/multiprocessrollingfileappender.cpp
index f54e8cb6..29b02592 100644
--- a/src/main/cpp/multiprocessrollingfileappender.cpp
+++ b/src/main/cpp/multiprocessrollingfileappender.cpp
@@ -35,7 +35,7 @@
 #include <log4cxx/helpers/transcoder.h>
 #include <log4cxx/private/fileappender_priv.h>
 #include <log4cxx/rolling/timebasedrollingpolicy.h>
-#include <log4cxx/boost-std-configuration.h>
+#include <log4cxx/private/boost-std-configuration.h>
 #include <mutex>
 
 using namespace log4cxx;
diff --git a/src/main/cpp/timebasedrollingpolicy.cpp b/src/main/cpp/timebasedrollingpolicy.cpp
index eb1cbc91..26798677 100644
--- a/src/main/cpp/timebasedrollingpolicy.cpp
+++ b/src/main/cpp/timebasedrollingpolicy.cpp
@@ -28,7 +28,7 @@
 #include <log4cxx/helpers/stringhelper.h>
 #include <log4cxx/helpers/optionconverter.h>
 #include <log4cxx/fileappender.h>
-#include <log4cxx/boost-std-configuration.h>
+#include <log4cxx/private/boost-std-configuration.h>
 #include <iostream>
 #include <apr_mmap.h>
 
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index 3b235249..47eb8646 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -239,6 +239,9 @@ else()
     set(STD_MAKE_UNIQUE_IMPL "log4cxx std::make_unique")
     set(STD_MAKE_UNIQUE_FOUND 0)
 endif()
+configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/makeunique.h.cmake
+                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/helpers/makeunique.h
+)
 
 # Configure both our private header and our public header
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.h.in
@@ -249,8 +252,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
 	       @ONLY
 )
-configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/boost-std-configuration.h.cmake
-                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/boost-std-configuration.h
+configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/private/boost-std-configuration.h.cmake
+                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/boost-std-configuration.h
 )
 
 # Provide the dependencies
diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index 20a6a91f..5872d6f4 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -54,6 +54,7 @@
 #define LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE 0
 #define LOG4CXX_LOGSTREAM_ADD_NOP 0
 
+#include <log4cxx/helpers/makeunique.h>
 #include <memory>
 #include <cstdint>