mirror of
https://github.com/mappu/miqt.git
synced 2025-04-27 15:40:21 +00:00
genbindings: apply quirks to ctors, merge LinuxOnly into quirks
This commit is contained in:
parent
c2e299d381
commit
aff87f98a2
@ -398,6 +398,8 @@ nextMethod:
|
||||
continue
|
||||
}
|
||||
|
||||
ApplyQuirks(ret.ClassName, &mm)
|
||||
|
||||
ret.Ctors = append(ret.Ctors, mm)
|
||||
|
||||
case "CXXDestructorDecl":
|
||||
|
@ -632,21 +632,19 @@ func AllowType(p CppParameter, isReturnType bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LinuxWindowsCompatCheck checks if the parameter is incompatible between the
|
||||
// generated headers (generated on Linux) with other OSes such as Windows.
|
||||
// These methods will be blocked on non-Linux OSes.
|
||||
func LinuxWindowsCompatCheck(p CppParameter) bool {
|
||||
if p.GetQtCppType().ParameterType == "Q_PID" {
|
||||
return true // int64 on Linux, _PROCESS_INFORMATION* on Windows
|
||||
}
|
||||
|
||||
if p.GetQtCppType().ParameterType == "QSocketDescriptor::DescriptorType" {
|
||||
return true // uintptr_t-compatible on Linux, void* on Windows
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ApplyQuirks(className string, mm *CppMethod) {
|
||||
|
||||
if mm.ReturnType.GetQtCppType().ParameterType == "Q_PID" {
|
||||
// int64 on Linux, _PROCESS_INFORMATION* on Windows
|
||||
mm.LinuxOnly = true
|
||||
}
|
||||
|
||||
if mm.ReturnType.GetQtCppType().ParameterType == "QSocketDescriptor::DescriptorType" ||
|
||||
(len(mm.Parameters) > 0 && mm.Parameters[0].GetQtCppType().ParameterType == "QSocketDescriptor::DescriptorType") {
|
||||
// uintptr_t-compatible on Linux, void* on Windows
|
||||
mm.LinuxOnly = true
|
||||
}
|
||||
|
||||
if className == "QArrayData" && mm.MethodName == "needsDetach" && mm.IsConst {
|
||||
mm.BecomesNonConstInVersion = addr("6.7")
|
||||
}
|
||||
|
@ -68,18 +68,9 @@ func applyTypedefs_Method(m *CppMethod) {
|
||||
for k, p := range m.Parameters {
|
||||
transformed := applyTypedefs(p)
|
||||
m.Parameters[k] = transformed
|
||||
|
||||
if LinuxWindowsCompatCheck(transformed) {
|
||||
m.LinuxOnly = true
|
||||
}
|
||||
}
|
||||
|
||||
m.ReturnType = applyTypedefs(m.ReturnType)
|
||||
|
||||
// Also apply OS compatibility rules
|
||||
if LinuxWindowsCompatCheck(m.ReturnType) {
|
||||
m.LinuxOnly = true
|
||||
}
|
||||
}
|
||||
|
||||
// astTransformTypedefs replaces the ParameterType with any known typedef value.
|
||||
|
Loading…
x
Reference in New Issue
Block a user