This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 40d26baf Generate fewer virtual base table pointers in the next ABI
version (#637)
40d26baf is described below
commit 40d26baf152260ff8a5a8f3a08443883b05e2537
Author: Stephen Webb <[email protected]>
AuthorDate: Tue Apr 28 09:26:59 2026 +1000
Generate fewer virtual base table pointers in the next ABI version (#637)
* Ensure the unargumented activateOptions can be used in ABI 15 code
---
src/main/cpp/fmtlayout.cpp | 3 +--
src/main/cpp/smtpappender.cpp | 10 +++++---
src/main/include/log4cxx/appender.h | 8 +++++--
src/main/include/log4cxx/appenderskeleton.h | 10 +++++---
.../include/log4cxx/helpers/onlyonceerrorhandler.h | 10 +++++---
src/main/include/log4cxx/helpers/xml.h | 28 ++++++++++++++++++----
src/main/include/log4cxx/layout.h | 10 +++++---
.../include/log4cxx/rolling/rollingpolicybase.h | 10 +++++---
.../log4cxx/rolling/timebasedrollingpolicy.h | 10 ++++++--
.../include/log4cxx/rolling/triggeringpolicy.h | 10 +++++---
.../log4cxx/spi/defaultrepositoryselector.h | 10 +++++---
src/main/include/log4cxx/spi/errorhandler.h | 7 +++++-
src/main/include/log4cxx/spi/filter.h | 7 +++++-
.../include/log4cxx/varia/fallbackerrorhandler.h | 8 +++++--
src/test/cpp/customlogger/xlogger.h | 5 ++--
src/test/cpp/net/smtpappendertestcase.cpp | 2 +-
src/test/cpp/optionhandlertest.cpp | 19 +++++++++++++--
17 files changed, 126 insertions(+), 41 deletions(-)
diff --git a/src/main/cpp/fmtlayout.cpp b/src/main/cpp/fmtlayout.cpp
index 410a1dd1..3b17e8b3 100644
--- a/src/main/cpp/fmtlayout.cpp
+++ b/src/main/cpp/fmtlayout.cpp
@@ -61,8 +61,7 @@ FMTLayout::~FMTLayout(){}
void FMTLayout::setConversionPattern(const LogString& pattern)
{
m_priv->conversionPattern = pattern;
- helpers::Pool pool;
- activateOptions(pool);
+ activateOptions();
}
LogString FMTLayout::getConversionPattern() const
diff --git a/src/main/cpp/smtpappender.cpp b/src/main/cpp/smtpappender.cpp
index 552e51a9..00be169c 100644
--- a/src/main/cpp/smtpappender.cpp
+++ b/src/main/cpp/smtpappender.cpp
@@ -342,9 +342,13 @@ class SMTPMessage
};
#endif
-class LOG4CXX_EXPORT DefaultEvaluator :
- public virtual spi::TriggeringEventEvaluator,
- public virtual helpers::Object
+class LOG4CXX_EXPORT DefaultEvaluator
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::TriggeringEventEvaluator
+ , public virtual helpers::Object
+#else
+ : public spi::TriggeringEventEvaluator
+#endif
{
public:
DECLARE_LOG4CXX_OBJECT(DefaultEvaluator)
diff --git a/src/main/include/log4cxx/appender.h
b/src/main/include/log4cxx/appender.h
index 8e74552e..1289cea0 100644
--- a/src/main/include/log4cxx/appender.h
+++ b/src/main/include/log4cxx/appender.h
@@ -46,8 +46,12 @@ typedef std::shared_ptr<Layout> LayoutPtr;
Implement this interface for your own strategies for outputting log
statements.
*/
-class LOG4CXX_EXPORT Appender :
- public virtual spi::OptionHandler
+class LOG4CXX_EXPORT Appender
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::OptionHandler
+#else
+ : public spi::OptionHandler
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(Appender)
diff --git a/src/main/include/log4cxx/appenderskeleton.h
b/src/main/include/log4cxx/appenderskeleton.h
index 585532c3..a9557a67 100644
--- a/src/main/include/log4cxx/appenderskeleton.h
+++ b/src/main/include/log4cxx/appenderskeleton.h
@@ -35,9 +35,13 @@ namespace LOG4CXX_NS
* This class provides the code for common functionality, such as
* support for threshold filtering and support for general filters.
* */
-class LOG4CXX_EXPORT AppenderSkeleton :
- public virtual Appender,
- public virtual helpers::Object
+class LOG4CXX_EXPORT AppenderSkeleton
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual Appender
+ , public virtual helpers::Object
+#else
+ : public Appender
+#endif
{
protected:
LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(AppenderSkeletonPrivate,
m_priv)
diff --git a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
index 7725f21e..2a5c7aef 100644
--- a/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
+++ b/src/main/include/log4cxx/helpers/onlyonceerrorhandler.h
@@ -35,9 +35,13 @@ first error in an appender and ignoring all following errors.
<p>This policy aims at protecting an otherwise working application
from being flooded with error messages when logging fails
*/
-class LOG4CXX_EXPORT OnlyOnceErrorHandler :
- public virtual spi::ErrorHandler,
- public virtual Object
+class LOG4CXX_EXPORT OnlyOnceErrorHandler
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::ErrorHandler
+ , public virtual helpers::Object
+#else
+ : public spi::ErrorHandler
+#endif
{
private:
LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(OnlyOnceErrorHandlerPrivate,
m_priv)
diff --git a/src/main/include/log4cxx/helpers/xml.h
b/src/main/include/log4cxx/helpers/xml.h
index f2437e9a..5137d3f2 100644
--- a/src/main/include/log4cxx/helpers/xml.h
+++ b/src/main/include/log4cxx/helpers/xml.h
@@ -47,7 +47,12 @@ class LOG4CXX_EXPORT DOMException : public RuntimeException
The XMLDOMNode interface is the primary datatype for the entire Document
Object Model.
*/
-class LOG4CXX_EXPORT XMLDOMNode : virtual public Object
+class LOG4CXX_EXPORT XMLDOMNode
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual Object
+#else
+ : public Object
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNode)
@@ -68,7 +73,12 @@ LOG4CXX_PTR_DEF(XMLDOMNode);
/**
The XMLDOMElement interface represents an element in an XML document
*/
-class LOG4CXX_EXPORT XMLDOMElement : virtual public XMLDOMNode
+class LOG4CXX_EXPORT XMLDOMElement
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual XMLDOMNode
+#else
+ : public XMLDOMNode
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMElement)
@@ -83,7 +93,12 @@ The XMLDOMDocument interface represents an entire XML
document.
Conceptually, it is the root of the document tree, and provides the
primary access to the document's data.
*/
-class LOG4CXX_EXPORT XMLDOMDocument : virtual public XMLDOMNode
+class LOG4CXX_EXPORT XMLDOMDocument
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual XMLDOMNode
+#else
+ : public XMLDOMNode
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMDocument)
@@ -104,7 +119,12 @@ XMLDOMNodeList objects in the DOM are live.
The items in the XMLDOMNodeList are accessible via an integral index,
starting from 0.
*/
-class LOG4CXX_EXPORT XMLDOMNodeList : virtual public Object
+class LOG4CXX_EXPORT XMLDOMNodeList
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual Object
+#else
+ : public Object
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNodeList)
diff --git a/src/main/include/log4cxx/layout.h
b/src/main/include/log4cxx/layout.h
index 1ede02c4..a83759b8 100644
--- a/src/main/include/log4cxx/layout.h
+++ b/src/main/include/log4cxx/layout.h
@@ -28,9 +28,13 @@ namespace LOG4CXX_NS
/**
Extend this abstract class to create your own log layout format.
*/
-class LOG4CXX_EXPORT Layout :
- public virtual spi::OptionHandler,
- public virtual helpers::Object
+class LOG4CXX_EXPORT Layout
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::OptionHandler
+ , public virtual helpers::Object
+#else
+ : public spi::OptionHandler
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(Layout)
diff --git a/src/main/include/log4cxx/rolling/rollingpolicybase.h
b/src/main/include/log4cxx/rolling/rollingpolicybase.h
index d81ae3c6..f2814e04 100644
--- a/src/main/include/log4cxx/rolling/rollingpolicybase.h
+++ b/src/main/include/log4cxx/rolling/rollingpolicybase.h
@@ -39,9 +39,13 @@ LOG4CXX_LIST_DEF(PatternConverterList,
LOG4CXX_NS::pattern::PatternConverterPtr)
*
*
*/
-class LOG4CXX_EXPORT RollingPolicyBase :
- public virtual RollingPolicy,
- public virtual helpers::Object
+class LOG4CXX_EXPORT RollingPolicyBase
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual RollingPolicy
+ , public virtual helpers::Object
+#else
+ : public RollingPolicy
+#endif
{
protected:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(RollingPolicyBase)
diff --git a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
index 9a5578a1..5d806f08 100755
--- a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
+++ b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
@@ -137,8 +137,14 @@ namespace rolling
* the {@link #activateOptions} method of the owning
* <code>RollingFileAppender</code>.
*/
-class LOG4CXX_EXPORT TimeBasedRollingPolicy : public virtual RollingPolicyBase,
- public virtual TriggeringPolicy
+class LOG4CXX_EXPORT TimeBasedRollingPolicy
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual RollingPolicyBase
+ , public virtual TriggeringPolicy
+#else
+ : public RollingPolicyBase
+ , public virtual TriggeringPolicy
+#endif
{
DECLARE_LOG4CXX_OBJECT(TimeBasedRollingPolicy)
BEGIN_LOG4CXX_CAST_MAP()
diff --git a/src/main/include/log4cxx/rolling/triggeringpolicy.h
b/src/main/include/log4cxx/rolling/triggeringpolicy.h
index ac6b2dba..15ce1f20 100644
--- a/src/main/include/log4cxx/rolling/triggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/triggeringpolicy.h
@@ -41,9 +41,13 @@ namespace rolling
*
* */
-class LOG4CXX_EXPORT TriggeringPolicy :
- public virtual spi::OptionHandler,
- public virtual helpers::Object
+class LOG4CXX_EXPORT TriggeringPolicy
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::OptionHandler
+ , public virtual helpers::Object
+#else
+ : public spi::OptionHandler
+#endif
{
DECLARE_ABSTRACT_LOG4CXX_OBJECT(TriggeringPolicy)
BEGIN_LOG4CXX_CAST_MAP()
diff --git a/src/main/include/log4cxx/spi/defaultrepositoryselector.h
b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
index 0246c89b..82a31a4b 100644
--- a/src/main/include/log4cxx/spi/defaultrepositoryselector.h
+++ b/src/main/include/log4cxx/spi/defaultrepositoryselector.h
@@ -27,9 +27,13 @@ namespace LOG4CXX_NS
{
namespace spi
{
-class LOG4CXX_EXPORT DefaultRepositorySelector :
- public virtual RepositorySelector,
- public virtual helpers::Object
+class LOG4CXX_EXPORT DefaultRepositorySelector
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual RepositorySelector
+ , public virtual helpers::Object
+#else
+ : public RepositorySelector
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(DefaultRepositorySelector)
diff --git a/src/main/include/log4cxx/spi/errorhandler.h
b/src/main/include/log4cxx/spi/errorhandler.h
index a48a6d03..dd11f293 100644
--- a/src/main/include/log4cxx/spi/errorhandler.h
+++ b/src/main/include/log4cxx/spi/errorhandler.h
@@ -55,7 +55,12 @@ definition errors are hard to predict and to reproduce.
that errors are not properly handled. You are most welcome to
suggest new error handling policies or criticize existing policies.
*/
-class LOG4CXX_EXPORT ErrorHandler : public virtual OptionHandler
+class LOG4CXX_EXPORT ErrorHandler
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual OptionHandler
+#else
+ : public OptionHandler
+#endif
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(ErrorHandler)
diff --git a/src/main/include/log4cxx/spi/filter.h
b/src/main/include/log4cxx/spi/filter.h
index 7049b268..a2d822c4 100644
--- a/src/main/include/log4cxx/spi/filter.h
+++ b/src/main/include/log4cxx/spi/filter.h
@@ -64,7 +64,12 @@ Linux ipchains.
<p>Note that filtering is only supported by the DOMConfigurator.
*/
-class LOG4CXX_EXPORT Filter : public virtual OptionHandler
+class LOG4CXX_EXPORT Filter
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual OptionHandler
+#else
+ : public OptionHandler
+#endif
{
protected:
LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FilterPrivate, m_priv)
diff --git a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
index a4599b83..0bcc3d78 100644
--- a/src/main/include/log4cxx/varia/fallbackerrorhandler.h
+++ b/src/main/include/log4cxx/varia/fallbackerrorhandler.h
@@ -40,8 +40,12 @@ Here is a sample configuration file that installs this error
handler:
\anchor fallback-ref-example
\include async-fall-back-example.xml
*/
-class LOG4CXX_EXPORT FallbackErrorHandler :
- public virtual spi::ErrorHandler
+class LOG4CXX_EXPORT FallbackErrorHandler
+#if LOG4CXX_ABI_VERSION <= 15
+ : public virtual spi::ErrorHandler
+#else
+ : public spi::ErrorHandler
+#endif
{
private:
LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(FallbackErrorHandlerPrivate,
m_priv)
diff --git a/src/test/cpp/customlogger/xlogger.h
b/src/test/cpp/customlogger/xlogger.h
index dca1de40..da32270a 100644
--- a/src/test/cpp/customlogger/xlogger.h
+++ b/src/test/cpp/customlogger/xlogger.h
@@ -31,9 +31,8 @@ class LocationInfo;
}
// Any sub-class of Logger must also have its own implementation of
// LoggerFactory.
-class XFactory :
- public virtual spi::LoggerFactory,
- public virtual helpers::Object
+class XFactory
+ : public spi::LoggerFactory
{
public:
DECLARE_ABSTRACT_LOG4CXX_OBJECT(XFactory)
diff --git a/src/test/cpp/net/smtpappendertestcase.cpp
b/src/test/cpp/net/smtpappendertestcase.cpp
index d3036239..c2934897 100644
--- a/src/test/cpp/net/smtpappendertestcase.cpp
+++ b/src/test/cpp/net/smtpappendertestcase.cpp
@@ -31,7 +31,7 @@ namespace net
{
class MockTriggeringEventEvaluator :
- public virtual spi::TriggeringEventEvaluator
+ public spi::TriggeringEventEvaluator
{
public:
DECLARE_LOG4CXX_OBJECT(MockTriggeringEventEvaluator)
diff --git a/src/test/cpp/optionhandlertest.cpp
b/src/test/cpp/optionhandlertest.cpp
index 959a8104..c4483ff4 100644
--- a/src/test/cpp/optionhandlertest.cpp
+++ b/src/test/cpp/optionhandlertest.cpp
@@ -95,6 +95,7 @@ private:
class ABI_15_Specialized_Appender : public BaseAppender
{
public:
+ using spi::OptionHandler::activateOptions;
// void activateOptions(helpers::Pool& p) override --> compiler error:
'ABI_15_Specialized_Appender::activateOptions': method with override specifier
'override' did not override any base class methods
//
'log4cxx::spi::OptionHandler::activateOptions': Use activateOptions() without
parameters instead
void activateOptions(helpers::Pool& p)
@@ -138,7 +139,9 @@ LOGUNIT_CLASS(OptionHandlerTest)
LOGUNIT_TEST_SUITE(OptionHandlerTest);
LOGUNIT_TEST(ABI_15_AppenderTest);
LOGUNIT_TEST(ABI_15_Specialized_AppenderTest);
-#if 15 < LOG4CXX_ABI_VERSION
+#if LOG4CXX_ABI_VERSION <= 15
+ LOGUNIT_TEST(ABI_15_Specialized_Appender_unagumented_activate_Test);
+#else
LOGUNIT_TEST(ABI_16_AppenderTest);
#endif
LOGUNIT_TEST_SUITE_END();
@@ -166,7 +169,19 @@ public:
LOGUNIT_ASSERT(a15s.isActivated());
}
-#if 15 < LOG4CXX_ABI_VERSION
+#if LOG4CXX_ABI_VERSION <= 15
+ /**
+ * Checks all levels of the appender heirarchy are activated
+ */
+ void ABI_15_Specialized_Appender_unagumented_activate_Test()
+ {
+ helpers::Pool p;
+ ABI_15_Specialized_Appender a15s;
+ a15s.activateOptions();
+ LOGUNIT_ASSERT(a15s.isActivated());
+ }
+
+#else
/**
* Checks all levels of the appender heirarchy are activated
*/