From f45604ee13214a37b1061a9cb2cd74d5e48ce161 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 23 Nov 2024 18:05:15 +1300 Subject: [PATCH] genbindings: move QAccessibleWidget hack into standard config --- cmd/genbindings/config-allowlist.go | 18 ++++++++++++++++++ cmd/genbindings/intermediate.go | 11 +---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index 36c9b34a..a391fd5a 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -196,6 +196,24 @@ func AllowVirtual(mm CppMethod) bool { return true // AllowSignal(mm) } +func AllowVirtualForClass(className string) bool { + + // Allowing the subclassing of QAccessibleWidget compiles fine, + // but, always gives a linker error: + // + // /usr/lib/go-1.19/pkg/tool/linux_amd64/link: running g++ failed: exit status 1 + // /usr/bin/ld: /tmp/go-link-1745036494/000362.o: in function `MiqtVirtualQAccessibleWidget::MiqtVirtualQAccessibleWidget(QWidget*)': + // undefined reference to `vtable for MiqtVirtualQAccessibleWidget' + // + // An undefined vtable usually indicates that the virtual class is missing + // definitions for some virtual methods, but AFAICT we have complete coverage. + if className == "QAccessibleWidget" { + return false + } + + return true +} + func AllowMethod(className string, mm CppMethod) error { for _, p := range mm.Parameters { diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 2de8067c..d6c30637 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -413,16 +413,7 @@ func (c *CppClass) VirtualMethods() []CppMethod { return nil } - // FIXME Allowing the subclassing of QAccessibleWidget compiles fine, - // but, always gives a linker error: - // - // /usr/lib/go-1.19/pkg/tool/linux_amd64/link: running g++ failed: exit status 1 - // /usr/bin/ld: /tmp/go-link-1745036494/000362.o: in function `MiqtVirtualQAccessibleWidget::MiqtVirtualQAccessibleWidget(QWidget*)': - // undefined reference to `vtable for MiqtVirtualQAccessibleWidget' - // - // An undefined vtable usually indicates that the virtual class is missing - // definitions for some virtual methods, but AFAICT we have complete coverage. - if c.ClassName == "QAccessibleWidget" { + if !AllowVirtualForClass(c.ClassName) { return nil }