Skip to content

Commit

Permalink
Replace Q_NULLPTR by nullptr
Browse files Browse the repository at this point in the history
The former is a compatibility macro for code not allowed to
use C++11.
  • Loading branch information
gruenich committed Jul 20, 2024
1 parent 76f1aac commit ab868c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
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"/>
<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

0 comments on commit ab868c7

Please sign in to comment.