diff options
author | Sergio Martins <smartins@kde.org> | 2018-01-17 23:42:11 +0000 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2018-01-17 23:43:27 +0000 |
commit | cd7f73b23339a61a8a1ced1781540baad3feb14f (patch) | |
tree | 957591c2c4f89863a7744fad9655a02af2db6d35 /tests/fully-qualified-moc-types | |
parent | 2020890dbdcef7869af4fe46360e803295482765 (diff) |
Rename fully-qualified-signals-and-properties to fully-qualified-moc-types
Will warn for slots too.
Diffstat (limited to 'tests/fully-qualified-moc-types')
-rw-r--r-- | tests/fully-qualified-moc-types/config.json | 7 | ||||
-rw-r--r-- | tests/fully-qualified-moc-types/main.cpp | 22 | ||||
-rw-r--r-- | tests/fully-qualified-moc-types/main.cpp.expected | 1 | ||||
-rw-r--r-- | tests/fully-qualified-moc-types/main.moc_ | 261 |
4 files changed, 291 insertions, 0 deletions
diff --git a/tests/fully-qualified-moc-types/config.json b/tests/fully-qualified-moc-types/config.json new file mode 100644 index 00000000..e7e6e0cb --- /dev/null +++ b/tests/fully-qualified-moc-types/config.json @@ -0,0 +1,7 @@ +{ + "tests" : [ + { + "filename" : "main.cpp" + } + ] +} diff --git a/tests/fully-qualified-moc-types/main.cpp b/tests/fully-qualified-moc-types/main.cpp new file mode 100644 index 00000000..aa352a54 --- /dev/null +++ b/tests/fully-qualified-moc-types/main.cpp @@ -0,0 +1,22 @@ +#include <QtCore/QObject> + +struct A {}; + +namespace NS { + struct MyType {}; + class MyObject : public QObject + { + Q_OBJECT + Q_SIGNALS: + void mysig(NS::MyType); + void mysig2(MyType); // Warn + void mysig3(NS::MyType); + void mysig4(const NS::MyType &); + void mysig5(A); + void mysig6(const A); + void mysig7(const A *); + void mysig8(A *); + }; +} + +#include "main.moc_" diff --git a/tests/fully-qualified-moc-types/main.cpp.expected b/tests/fully-qualified-moc-types/main.cpp.expected new file mode 100644 index 00000000..9e9d0fc0 --- /dev/null +++ b/tests/fully-qualified-moc-types/main.cpp.expected @@ -0,0 +1 @@ +fully-qualified-moc-types/main.cpp:12:9: warning: signal arguments need to be fully-qualified (NS::MyType instead of MyType) [-Wclazy-fully-qualified-moc-types] diff --git a/tests/fully-qualified-moc-types/main.moc_ b/tests/fully-qualified-moc-types/main.moc_ new file mode 100644 index 00000000..d9aea291 --- /dev/null +++ b/tests/fully-qualified-moc-types/main.moc_ @@ -0,0 +1,261 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'main.cpp' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.4) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include <QtCore/qbytearray.h> +#include <QtCore/qmetatype.h> +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'main.cpp' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.9.4. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_NS__MyObject_t { + QByteArrayData data[15]; + char stringdata0[101]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_NS__MyObject_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_NS__MyObject_t qt_meta_stringdata_NS__MyObject = { + { +QT_MOC_LITERAL(0, 0, 12), // "NS::MyObject" +QT_MOC_LITERAL(1, 13, 5), // "mysig" +QT_MOC_LITERAL(2, 19, 0), // "" +QT_MOC_LITERAL(3, 20, 10), // "NS::MyType" +QT_MOC_LITERAL(4, 31, 6), // "mysig2" +QT_MOC_LITERAL(5, 38, 6), // "MyType" +QT_MOC_LITERAL(6, 45, 6), // "mysig3" +QT_MOC_LITERAL(7, 52, 6), // "mysig4" +QT_MOC_LITERAL(8, 59, 6), // "mysig5" +QT_MOC_LITERAL(9, 66, 1), // "A" +QT_MOC_LITERAL(10, 68, 6), // "mysig6" +QT_MOC_LITERAL(11, 75, 6), // "mysig7" +QT_MOC_LITERAL(12, 82, 8), // "const A*" +QT_MOC_LITERAL(13, 91, 6), // "mysig8" +QT_MOC_LITERAL(14, 98, 2) // "A*" + + }, + "NS::MyObject\0mysig\0\0NS::MyType\0mysig2\0" + "MyType\0mysig3\0mysig4\0mysig5\0A\0mysig6\0" + "mysig7\0const A*\0mysig8\0A*" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_NS__MyObject[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 8, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 8, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 54, 2, 0x06 /* Public */, + 4, 1, 57, 2, 0x06 /* Public */, + 6, 1, 60, 2, 0x06 /* Public */, + 7, 1, 63, 2, 0x06 /* Public */, + 8, 1, 66, 2, 0x06 /* Public */, + 10, 1, 69, 2, 0x06 /* Public */, + 11, 1, 72, 2, 0x06 /* Public */, + 13, 1, 75, 2, 0x06 /* Public */, + + // signals: parameters + QMetaType::Void, 0x80000000 | 3, 2, + QMetaType::Void, 0x80000000 | 5, 2, + QMetaType::Void, 0x80000000 | 3, 2, + QMetaType::Void, 0x80000000 | 3, 2, + QMetaType::Void, 0x80000000 | 9, 2, + QMetaType::Void, 0x80000000 | 9, 2, + QMetaType::Void, 0x80000000 | 12, 2, + QMetaType::Void, 0x80000000 | 14, 2, + + 0 // eod +}; + +void NS::MyObject::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + MyObject *_t = static_cast<MyObject *>(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->mysig((*reinterpret_cast< NS::MyType(*)>(_a[1]))); break; + case 1: _t->mysig2((*reinterpret_cast< MyType(*)>(_a[1]))); break; + case 2: _t->mysig3((*reinterpret_cast< NS::MyType(*)>(_a[1]))); break; + case 3: _t->mysig4((*reinterpret_cast< const NS::MyType(*)>(_a[1]))); break; + case 4: _t->mysig5((*reinterpret_cast< A(*)>(_a[1]))); break; + case 5: _t->mysig6((*reinterpret_cast< const A(*)>(_a[1]))); break; + case 6: _t->mysig7((*reinterpret_cast< const A*(*)>(_a[1]))); break; + case 7: _t->mysig8((*reinterpret_cast< A*(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast<int *>(_a[0]); + { + typedef void (MyObject::*_t)(NS::MyType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig)) { + *result = 0; + return; + } + } + { + typedef void (MyObject::*_t)(MyType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig2)) { + *result = 1; + return; + } + } + { + typedef void (MyObject::*_t)(NS::MyType ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig3)) { + *result = 2; + return; + } + } + { + typedef void (MyObject::*_t)(const NS::MyType & ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig4)) { + *result = 3; + return; + } + } + { + typedef void (MyObject::*_t)(A ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig5)) { + *result = 4; + return; + } + } + { + typedef void (MyObject::*_t)(const A ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig6)) { + *result = 5; + return; + } + } + { + typedef void (MyObject::*_t)(const A * ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig7)) { + *result = 6; + return; + } + } + { + typedef void (MyObject::*_t)(A * ); + if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&MyObject::mysig8)) { + *result = 7; + return; + } + } + } +} + +const QMetaObject NS::MyObject::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_NS__MyObject.data, + qt_meta_data_NS__MyObject, qt_static_metacall, nullptr, nullptr} +}; + + +const QMetaObject *NS::MyObject::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *NS::MyObject::qt_metacast(const char *_clname) +{ + if (!_clname) return nullptr; + if (!strcmp(_clname, qt_meta_stringdata_NS__MyObject.stringdata0)) + return static_cast<void*>(this); + return QObject::qt_metacast(_clname); +} + +int NS::MyObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 8) + qt_static_metacall(this, _c, _id, _a); + _id -= 8; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 8) + *reinterpret_cast<int*>(_a[0]) = -1; + _id -= 8; + } + return _id; +} + +// SIGNAL 0 +void NS::MyObject::mysig(NS::MyType _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} + +// SIGNAL 1 +void NS::MyObject::mysig2(MyType _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 1, _a); +} + +// SIGNAL 2 +void NS::MyObject::mysig3(NS::MyType _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 2, _a); +} + +// SIGNAL 3 +void NS::MyObject::mysig4(const NS::MyType & _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 3, _a); +} + +// SIGNAL 4 +void NS::MyObject::mysig5(A _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 4, _a); +} + +// SIGNAL 5 +void NS::MyObject::mysig6(const A _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 5, _a); +} + +// SIGNAL 6 +void NS::MyObject::mysig7(const A * _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 6, _a); +} + +// SIGNAL 7 +void NS::MyObject::mysig8(A * _t1) +{ + void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 7, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE |