Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Q_NULLPTR by nullptr #6614

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cfg/qt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@
<not-bool/>
</arg>
</function>
<!-- bool QObject::disconnect(const char *signal = Q_NULLPTR, const QObject *receiver = Q_NULLPTR, const char *method = Q_NULLPTR) const -->
<!-- bool QObject::disconnect(const QObject *receiver, const char *method = Q_NULLPTR) const -->
<!-- bool QObject::disconnect(const char *signal = nullptr, const QObject *receiver = nullptr, const char *method = nullptr) const -->
<!-- bool QObject::disconnect(const QObject *receiver, const char *method = nullptr) const -->
<!-- bool QObject::disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) // static -->
<!-- bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) // static -->
<!-- bool QObject::disconnect(const QMetaObject::Connection &connection) // static -->
Expand Down Expand Up @@ -467,7 +467,7 @@
<not-uninit/>
</arg>
</function>
<!-- QString QObject::tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) //static -->
<!-- QString QObject::tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) //static -->
<function name="tr,QObject::tr">
<noreturn>false</noreturn>
<returnValue type="QString"/>
Expand Down Expand Up @@ -2041,7 +2041,7 @@
<use-retval/>
<const/>
</function>
<!-- int QString::toInt(bool *ok = Q_NULLPTR, int base = 10) const -->
<!-- int QString::toInt(bool *ok = nullptr, int base = 10) const -->
<function name="QString::toInt">
<noreturn>false</noreturn>
<returnValue type="int"/>
Expand Down Expand Up @@ -2459,9 +2459,9 @@
<not-uninit/>
</arg>
</function>
<!-- QString QFileDialog::getOpenFileName(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = Q_NULLPTR, Options options = Options()) //static -->
<!-- QString QFileDialog::getSaveFileName(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = Q_NULLPTR, Options options = Options()) //static -->
<!-- QString QFileDialog::getExistingDirectory(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), Options options = ShowDirsOnly) //static -->
<!-- QString QFileDialog::getOpenFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, Options options = Options()) //static -->
<!-- QString QFileDialog::getSaveFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, Options options = Options()) //static -->
<!-- QString QFileDialog::getExistingDirectory(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), Options options = ShowDirsOnly) //static -->
<function name="QFileDialog::getOpenFileName,QFileDialog::getSaveFileName,QFileDialog::getExistingDirectory">
<noreturn>false</noreturn>
<returnValue type="QString"/>
Expand All @@ -2470,7 +2470,7 @@
<not-uninit/>
</arg>
</function>
<!-- QStringList QFileDialog::getOpenFileNames(QWidget *parent = Q_NULLPTR, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = Q_NULLPTR, Options options = Options()) //static -->
<!-- QStringList QFileDialog::getOpenFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, Options options = Options()) //static -->
<function name="QFileDialog::getOpenFileNames">
<noreturn>false</noreturn>
<returnValue type="QStringList"/>
Expand Down Expand Up @@ -5325,7 +5325,7 @@
<define name="Q_NAMESPACE_EXPORT" value=""/>
<define name="Q_DECL_EXPORT" value=""/>
<define name="Q_DECL_IMPORT" value=""/>
<define name="QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context)" value="static inline QString trUtf8(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); }"/>
<define name="QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context)" value="static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); }"/>
<define name="Q_DECLARE_FLAGS(x,y)" value=""/>
<define name="Q_DECLARE_SEQUENTIAL_ITERATOR(C)" value=""/>
<define name="Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C)" value=""/>
Expand All @@ -5339,7 +5339,7 @@
<define name="Q_DECLARE_PRIVATE(Class)" value="inline Class##Private* d_func() { return reinterpret_cast&lt;Class##Private*&gt;(qGetPtrHelper(d_ptr)); } inline const Class##Private d_func() const { return reinterpret_cast&lt;const Class##Private *&gt;(qGetPtrHelper(d_ptr)); } friend class Class##Private;"/>
<define name="Q_DECLARE_PRIVATE_D(Dptr, Class)" value="inline Class##Private* d_func() { return reinterpret_cast&lt;Class##Private *&gt;(qGetPtrHelper(Dptr)); } inline const Class##Private* d_func() const { return reinterpret_cast&lt;const Class##Private *&gt;(qGetPtrHelper(Dptr)); } friend class Class##Private;"/>
<define name="Q_DECLARE_PUBLIC(Class)" value="inline Class##Public* d_func() { return reinterpret_cast&lt;Class##Public*&gt;(qGetPtrHelper(d_ptr)); } inline const Class##Public d_func() const { return reinterpret_cast&lt;const Class##Public *&gt;(qGetPtrHelper(d_ptr)); } friend class Class##Public;"/>
<define name="Q_DECLARE_TR_FUNCTIONS(context)" value="public: static inline QString tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) private:"/>
<define name="Q_DECLARE_TR_FUNCTIONS(context)" value="public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) private:"/>
<define name="Q_DISABLE_COPY(C)" value="C(C&amp;);C&amp; operator=(const C&amp;);"/>
<define name="Q_EMIT" value=""/>
<define name="Q_ENUM(X)" value=""/>
Expand All @@ -5352,7 +5352,7 @@
<define name="Q_INTERFACES(X)" value=""/>
<define name="Q_LIKELY(expr)" value="expr"/>
<define name="Q_NAMESPACE" value=""/>
<define name="Q_NULLPTR" value="NULL"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should have been removed completely, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say leave it as it was, since we want to handle Q_NULLPTR in code that still uses it. The changes in the tests in qt.cpp should also be reverted. But then there are pretty much no functional changes left.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, you want to test these old macros. Then it is better to leave everything as it is.

<define name="nullptr" value="NULL"/>
<define name="Q_OBJECT" value="static void qt_static_metacall(QObject*,QMetaObject::Call,int,void**);const MetaObject* metaObject() const;void* qt_metacast(const char*);int qt_metacall(QMetaObject::Call,int,void**);"/>
<define name="Q_PRIVATE_SLOT(d, signature)" value=""/>
<define name="Q_SLOTS" value=""/>
Expand Down
6 changes: 3 additions & 3 deletions test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ void validCode(int * pIntPtr, QString & qstrArg, double d)
Q_UNUSED(d)
if (QFile::exists("test")) {}

if (pIntPtr != Q_NULLPTR) {
if (pIntPtr != nullptr) {
*pIntPtr = 5;
}

Expand Down Expand Up @@ -627,11 +627,11 @@ void ignoredReturnValue()

void nullPointer(int * pIntPtr)
{
int * pNullPtr = Q_NULLPTR;
int * pNullPtr = nullptr;
// cppcheck-suppress nullPointer
*pNullPtr = 1;

if (pIntPtr != Q_NULLPTR) {
if (pIntPtr != nullptr) {
*pIntPtr = 2;
} else {
// cppcheck-suppress nullPointerRedundantCheck
Expand Down
Loading