John Reiser wrote on 2019/02/26 13:18:
That test 'testvoidarg' succeeds for me (normal termination, no SIGSEGV) on Fedora 28 and Fedora 29.
Yes, it only seems to affect f30/Rawhide with GCC 9 (though I'm not sure it's the culprit).
The traceback says:
> 41 QCOMPARE(addedFunc->arguments().count(), 0);
so the suggestion is to check if addedFunc->arguments() is NULL.
'addedFunc' itself is 0 (NULL).
Substituting testvoidarg.cpp.o as compiled by gcc-8.2.1-6.fc28.x86_64 (from the same source)
gives the same SIGSEGV. So compiling testvoidarg.cpp with gcc-9 is no longer a suspect.
=====
void TestVoidArg::testVoidParsedFunction()
{
const char cppCode[] = "struct A { void a(void); };";
const char xmlCode[] = "\
<typesystem package=\"Foo\">\
<value-type name='A'/>\
</typesystem>";
TestUtil t(cppCode, xmlCode);
AbstractMetaClassList classes = t.builder()->classes();
AbstractMetaClass* classA = classes.findClass("A");
QVERIFY(classA);
const AbstractMetaFunction* addedFunc = classA->findFunction("a");
QCOMPARE(addedFunc->arguments().count(), 0); ///// line 41
}
=====
The trouble here is that on "findFunction" as defined in abstractmetalang.cpp:1487
1487 const AbstractMetaFunction* AbstractMetaClass::findFunction(const QString& functionName) const
1488 {
1489 foreach (const AbstractMetaFunction *f, functions()) {
1490 if (f->name() == functionName)
1491 return f;
1492 }
1493 return 0;
1494 }
for QString list functions() it is expected to contain "a" but actually it just
contains "A" , which looks like its class name instead of function names contained
in the class - so it does not match and findFunction() returns 0.
Then... at least for testvoidarg test, the following patch seems to work...
================================================
--- apiextractor-0.10.10/abstractmetalang.cpp.for 2019-02-27 02:08:50.743492673 +0900
+++ apiextractor-0.10.10/abstractmetalang.cpp 2019-02-27 02:09:26.443445212 +0900
@@ -1486,7 +1486,8 @@
const AbstractMetaFunction* AbstractMetaClass::findFunction(const QString& functionName) const
{
- foreach (const AbstractMetaFunction *f, functions()) {
+ //foreach (const AbstractMetaFunction *f, functions()) {
+ for (const AbstractMetaFunction *f : functions()) {
if (f->name() == functionName)
return f;
}
==================================================
https://koji.fedoraproject.org/koji/taskinfo?taskID=33067706
(There are still many test failures, but at least this shows:
Start 33: testvoidarg
33/35 Test #33: testvoidarg ...................... Passed 0.01 sec
So... I guess Qt "foreach" behavior changed with gcc9..
Regards,
Mamoru
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx