From c57dd789fd0a76a81499c9413203a46d1743e0f8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 21 Mar 2013 14:15:12 -0700 Subject: Mark as unused the private members that aren't and CANNOT be used Those members were left uninitialised by inline constructors and/or the destructor of those classes is/was also inline. Those members cannot be used to store pointers that need managing during the Qt 5.x lifetime. They can be used to store simple values, as if they were integers. Detected by Apple Clang 4.2. Change-Id: I20e2def7c4006668e2d6a7e332c89e2dc8c2a184 Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/dbus/qdbuserror.cpp | 4 +++- src/xml/sax/qxml.cpp | 20 ++++++++++++++++++++ src/xml/sax/qxml.h | 8 ++++---- 3 files changed, 27 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index f486c19fdc..ddc2be7c38 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -257,7 +257,9 @@ static inline QDBusError::ErrorType get(const char *name) QDBusError::QDBusError() : code(NoError) { - + // ### This class has an implicit (therefore inline) destructor + // so the following field cannot be used. + Q_UNUSED(unused); } #ifndef QT_BOOTSTRAPPED diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 47e137976b..0e20041a62 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -985,12 +985,22 @@ void QXmlNamespaceSupport::reset() Constructs an empty attribute list. */ +QXmlAttributes::QXmlAttributes() +{ + // ### In Qt 5.0, this function was inlined and d was not initialized + // The member cannot be used until Qt 6.0 + Q_UNUSED(d); +} /*! \fn QXmlAttributes::~QXmlAttributes() Destroys the attributes object. */ +QXmlAttributes::~QXmlAttributes() +{ +} + /*! Looks up the index of an attribute by the qualified name \a qName. @@ -2400,11 +2410,21 @@ events are reported. Constructs a handler for use with subclasses of QXmlReader. */ +QXmlDefaultHandler::QXmlDefaultHandler() +{ + // ### In Qt 5.0, this function was inlined and d was not initialized + // The member cannot be used until Qt 6.0 + Q_UNUSED(d); +} + /*! \fn QXmlDefaultHandler::~QXmlDefaultHandler() Destroys the handler. */ +QXmlDefaultHandler::~QXmlDefaultHandler() +{ +} /*! \reimp diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 4ce2c26b05..743f8702af 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -117,8 +117,8 @@ private: class Q_XML_EXPORT QXmlAttributes { public: - QXmlAttributes() {} - virtual ~QXmlAttributes() {} + QXmlAttributes(); + virtual ~QXmlAttributes(); int index(const QString& qName) const; int index(QLatin1String qName) const; @@ -365,8 +365,8 @@ public: class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler { public: - QXmlDefaultHandler() { } - virtual ~QXmlDefaultHandler() { } + QXmlDefaultHandler(); + virtual ~QXmlDefaultHandler(); void setDocumentLocator(QXmlLocator* locator); bool startDocument(); -- cgit v1.2.3