From 62013d77721820976102581b4cbd31404c109903 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Mar 2017 11:46:26 -0800 Subject: Mark to remove const from function parameters in QtCore public headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some compilers are known to complain about this with a warning. GCC complains about const on return values on -Wignored-qualifiers (enabled at -Wextra), so it's not too much of a jump to assume that others do too. Besides, this is not Qt Library API policy. As maintainer for QtCore, I'm exercising my prerrogative in specifying certain unspecified parts of the coding style, like I've done for constructor initializer lists. Since all the classes involved are exported (including QVector, through derived classes), we can't remove the qualifier until Qt 6, since there are compilers known to encode the qualifier in the mangled name (suncc). I'm not introducing #ifdef to silence unknown compilers unless we get an actual complaint. Change-Id: I33850dcdb2ce4a47878efffd14a876edef843c46 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetatype.h | 2 +- src/corelib/kernel/qvariant.h | 2 +- src/corelib/tools/qvector.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 7b0a9f986b..5a90314735 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -526,7 +526,7 @@ public: static bool load(QDataStream &stream, int type, void *data); #endif - explicit QMetaType(const int type); + explicit QMetaType(const int type); // ### Qt6: drop const inline ~QMetaType(); inline bool isValid() const; diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index c0e5f2f591..a2c5711993 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -464,7 +464,7 @@ public: void create(int type, const void *copy); bool cmp(const QVariant &other) const; int compare(const QVariant &other) const; - bool convert(const int t, void *ptr) const; + bool convert(const int t, void *ptr) const; // ### Qt6: drop const private: // force compile error, prevent QVariant(bool) to be called diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index a526d35ddc..e345163c2f 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -291,6 +291,7 @@ public: private: friend class QRegion; // Optimization for QRegion::rects() + // ### Qt6: remove const from int parameters void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default); void reallocData(const int sz) { reallocData(sz, d->alloc); } void freeData(Data *d); -- cgit v1.2.3