Skip to content

Commit

Permalink
linuxonly: fix ifdef quirks for building on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mappu committed Nov 19, 2024
1 parent 3902c9d commit bbc75b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmd/genbindings/emitcabi.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
ret.WriteString(
"#ifndef Q_OS_LINUX\n" +
"\treturn;\n" +
"#endif\n",
"#else\n",
)
}

Expand All @@ -992,6 +992,12 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
ret.WriteString("\t*outptr_" + cabiClassName(baseClass) + " = static_cast<" + baseClass + "*>(ret);\n")
}

if ctor.LinuxOnly {
ret.WriteString(
"#endif\n",
)
}

ret.WriteString(
"}\n" +
"\n",
Expand Down
3 changes: 2 additions & 1 deletion qt/gen_qsocketnotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,10 @@ void QSocketDescriptor_new2(QSocketDescriptor* param1, QSocketDescriptor** outpt
void QSocketDescriptor_new3(int descriptor, QSocketDescriptor** outptr_QSocketDescriptor) {
#ifndef Q_OS_LINUX
return;
#endif
#else
QSocketDescriptor* ret = new QSocketDescriptor(static_cast<QSocketDescriptor::DescriptorType>(descriptor));
*outptr_QSocketDescriptor = ret;
#endif
}

bool QSocketDescriptor_IsValid(const QSocketDescriptor* self) {
Expand Down
3 changes: 2 additions & 1 deletion qt6/gen_qsocketnotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,10 @@ void QSocketDescriptor_new2(QSocketDescriptor* param1, QSocketDescriptor** outpt
void QSocketDescriptor_new3(int descriptor, QSocketDescriptor** outptr_QSocketDescriptor) {
#ifndef Q_OS_LINUX
return;
#endif
#else
QSocketDescriptor* ret = new QSocketDescriptor(static_cast<QSocketDescriptor::DescriptorType>(descriptor));
*outptr_QSocketDescriptor = ret;
#endif
}

bool QSocketDescriptor_IsValid(const QSocketDescriptor* self) {
Expand Down

0 comments on commit bbc75b8

Please sign in to comment.