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.7 6.5
Task-number: QTBUG-122619
Change-Id: Ie2167b6c56d96c7804785e225f3fe02dbc78984c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a4c85a5cf19d8919797aba41077bfa8796427f54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-04-09 12:19:50 +02:00 committed by Qt Cherry-pick Bot
parent 790a52b7e0
commit e5c551a5cf
8 changed files with 21 additions and 14 deletions

View File

@ -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
)

View File

@ -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

View File

@ -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

View File

@ -11,6 +11,7 @@
#include <qlist.h>
#include <qshareddata.h>
QT_REQUIRE_CONFIG(dom);
QT_BEGIN_NAMESPACE
//

View File

@ -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

View File

@ -7,6 +7,7 @@
#include <qdom.h>
#include <private/qglobal_p.h>
QT_REQUIRE_CONFIG(dom);
QT_BEGIN_NAMESPACE
//

View File

@ -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()

View File

@ -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)