summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <[email protected]>2024-04-09 12:19:50 +0200
committerEdward Welbourne <[email protected]>2024-08-29 20:21:14 +0200
commita4c85a5cf19d8919797aba41077bfa8796427f54 (patch)
tree5eeaddf2aeb3986ac9a1c4fa29f6509bf5c337f2
parent70b680502997678b7c9964acef6569b18b6a65bf (diff)
QtXml: be systematic about feature dom
All the actual code of the module was subject to #ifndef QT_NO_DOM, aside from the *_p.h that were only included subject to such #if-ery, so there's nothing left of the module if the feature is ever disabled, but be consistent with the module defining a feature that allows that. Convert #ifndef QT_NO_DOM to #if QT_CONFIG(dom) (and move to outside the namespace, where nothing was inside without the define), require feature dom in the *_p.h and test, change CMake config to skip the test when the feature is disabled (and add a missing SPDX comment), condition including sources on the feature. Pick-to: 6.8 6.7 6.5 Task-number: QTBUG-122619 Change-Id: Ie2167b6c56d96c7804785e225f3fe02dbc78984c Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r--src/xml/CMakeLists.txt10
-rw-r--r--src/xml/dom/qdom.cpp4
-rw-r--r--src/xml/dom/qdom.h9
-rw-r--r--src/xml/dom/qdom_p.h1
-rw-r--r--src/xml/dom/qdomhelpers.cpp4
-rw-r--r--src/xml/dom/qdomhelpers_p.h1
-rw-r--r--tests/auto/xml/CMakeLists.txt5
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp1
8 files changed, 21 insertions, 14 deletions
diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt
index e0c31eeabd9..65e13db7e7e 100644
--- a/src/xml/CMakeLists.txt
+++ b/src/xml/CMakeLists.txt
@@ -7,8 +7,6 @@
qt_internal_add_module(Xml
SOURCES
- dom/qdom.cpp dom/qdom.h dom/qdom_p.h
- dom/qdomhelpers.cpp dom/qdomhelpers_p.h
qtxmlglobal.h
DEFINES
QT_NO_CONTEXTLESS_CONNECT
@@ -23,13 +21,17 @@ qt_internal_add_module(Xml
Qt::CorePrivate
)
-## Scopes:
-#####################################################################
+qt_internal_extend_target(Xml CONDITION QT_FEATURE_dom
+ SOURCES
+ dom/qdom.cpp dom/qdom.h dom/qdom_p.h
+ dom/qdomhelpers.cpp dom/qdomhelpers_p.h
+)
qt_internal_extend_target(Xml CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")
LINK_OPTIONS
"/BASE:0x61000000"
)
+
qt_internal_add_docs(Xml
doc/qtxml.qdocconf
)
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index a9c2a648582..043fd3a6855 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -5,7 +5,7 @@
#include <qdom.h>
#include "private/qxmlutils_p.h"
-#ifndef QT_NO_DOM
+#if QT_CONFIG(dom)
#include "qdom_p.h"
#include "qdomhelpers_p.h"
@@ -6983,4 +6983,4 @@ QDomComment QDomNode::toComment() const
QT_END_NAMESPACE
-#endif // QT_NO_DOM
+#endif // feature dom
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index a3900609c40..0ac7d9130e9 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -7,13 +7,12 @@
#include <QtXml/qtxmlglobal.h>
#include <QtCore/qstring.h>
+#if QT_CONFIG(dom)
+
class tst_QDom;
QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_DOM
-
class QIODevice;
class QTextStream;
@@ -666,8 +665,8 @@ private:
Q_XML_EXPORT QTextStream& operator<<(QTextStream& stream, const QDomNode& node);
-#endif // QT_NO_DOM
-
QT_END_NAMESPACE
+#endif // feature dom
+
#endif // QDOM_H
diff --git a/src/xml/dom/qdom_p.h b/src/xml/dom/qdom_p.h
index b2ecd534c88..2a8e2deac0c 100644
--- a/src/xml/dom/qdom_p.h
+++ b/src/xml/dom/qdom_p.h
@@ -11,6 +11,7 @@
#include <qlist.h>
#include <qshareddata.h>
+QT_REQUIRE_CONFIG(dom);
QT_BEGIN_NAMESPACE
//
diff --git a/src/xml/dom/qdomhelpers.cpp b/src/xml/dom/qdomhelpers.cpp
index 0649e0c75d8..c41529f289d 100644
--- a/src/xml/dom/qdomhelpers.cpp
+++ b/src/xml/dom/qdomhelpers.cpp
@@ -3,7 +3,7 @@
#include <QtXml/qtxmlglobal.h>
-#ifndef QT_NO_DOM
+#if QT_CONFIG(dom)
#include "qdomhelpers_p.h"
#include "qdom_p.h"
@@ -442,4 +442,4 @@ bool QDomParser::parseMarkupDecl()
QT_END_NAMESPACE
-#endif // QT_NO_DOM
+#endif // feature dom
diff --git a/src/xml/dom/qdomhelpers_p.h b/src/xml/dom/qdomhelpers_p.h
index 5a4b2207f9a..6a27fe09d0d 100644
--- a/src/xml/dom/qdomhelpers_p.h
+++ b/src/xml/dom/qdomhelpers_p.h
@@ -7,6 +7,7 @@
#include <qdom.h>
#include <private/qglobal_p.h>
+QT_REQUIRE_CONFIG(dom);
QT_BEGIN_NAMESPACE
//
diff --git a/tests/auto/xml/CMakeLists.txt b/tests/auto/xml/CMakeLists.txt
index 92ac1870f69..6c770d18eb6 100644
--- a/tests/auto/xml/CMakeLists.txt
+++ b/tests/auto/xml/CMakeLists.txt
@@ -1,3 +1,6 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-add_subdirectory(dom)
+
+if(QT_FEATURE_dom)
+ add_subdirectory(dom)
+endif()
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index b73dbc49e27..d77ecc811d8 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -17,6 +17,7 @@
#include <cmath>
#include <QtXml/private/qdom_p.h>
+QT_REQUIRE_CONFIG(dom);
QT_FORWARD_DECLARE_CLASS(QDomDocument)
QT_FORWARD_DECLARE_CLASS(QDomNode)