tst_QMetaType: fix warning that buffer may be unused
We pass a pointer to uninitialized memory to QMetaType::create(). There's no harm because we're using the invalid QMetaType, but GCC is actually right to complain for any other type. qtestcase.h:54:25: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized] qmetatype.h:454:11: note: by argument 2 of type ‘const void*’ to ‘void* QMetaType::create(const void*) const’ declared here Pick-to: 6.3 6.4 Change-Id: I3859764fed084846bcb0fffd1703eb7967acf0d7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
e9c9e9225c
commit
f1457b7b47
|
|
@ -817,7 +817,7 @@ void tst_QMetaType::createCopy()
|
|||
switch (type) {
|
||||
case QMetaType::UnknownType:
|
||||
return []() {
|
||||
char buf[1];
|
||||
char buf[1] = {};
|
||||
QCOMPARE(QMetaType().create(&buf), nullptr);
|
||||
};
|
||||
#define RETURN_CREATE_COPY_FUNCTION(MetaTypeName, MetaTypeId, RealType) \
|
||||
|
|
@ -1412,7 +1412,7 @@ void tst_QMetaType::constructCopy()
|
|||
switch (type) {
|
||||
case QMetaType::UnknownType:
|
||||
return []() {
|
||||
char buf[1], buf2[1];
|
||||
char buf[1], buf2[1] = {};
|
||||
QCOMPARE(QMetaType().construct(&buf, &buf2), nullptr);
|
||||
};
|
||||
#define RETURN_CONSTRUCT_COPY_FUNCTION(MetaTypeName, MetaTypeId, RealType) \
|
||||
|
|
|
|||
Loading…
Reference in New Issue