You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/07/09 02:42:03 UTC

[logging-log4cxx] 03/03: Ensure that we can compile with GCC with standard C++11

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

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

commit 533f5b3ec3184fd09f032a79e5bab7729e98850b
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Thu Jul 8 22:40:53 2021 -0400

    Ensure that we can compile with GCC with standard C++11
---
 CMakeLists.txt             | 3 +++
 src/main/cpp/hierarchy.cpp | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5b44ef..bb5a5df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,9 @@ if( NOT "${CMAKE_CXX_STANDARD}")
     set(CMAKE_CXX_STANDARD 17)
 endif()
 
+# Don't allow for compiler-specific extensions
+set(CMAKE_CXX_EXTENSIONS OFF)
+
 # Building
 add_subdirectory(src)
 
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
index 4f51744..c70d39d 100644
--- a/src/main/cpp/hierarchy.cpp
+++ b/src/main/cpp/hierarchy.cpp
@@ -223,7 +223,7 @@ LoggerPtr Hierarchy::getLogger(const LogString& name,
 	else
 	{
 		LoggerPtr logger(factory->makeNewLoggerInstance(pool, name));
-		logger->setHierarchy(weak_from_this());
+		logger->setHierarchy(shared_from_this());
 		loggers->insert(LoggerMap::value_type(name, logger));
 
 		ProvisionNodeMap::iterator it2 = provisionNodes->find(name);
@@ -423,6 +423,6 @@ void Hierarchy::configureRoot(){
 	// LOGCXX-322 we need to turn the repositroy into a weak_ptr, and we
 	// can't use weak_from_this() in the constructor.
 	if( !root->getLoggerRepository().lock() ){
-		root->setHierarchy(weak_from_this());
+		root->setHierarchy(shared_from_this());
 	}
 }