From 30e9cb7e755793333ddac6efdd6fed7857f76036 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 20 Apr 2024 00:07:17 -0400 Subject: [PATCH] - backend update from GZDoom --- source/common/filesystem/source/fs_findfile.cpp | 3 +++ source/common/objects/dobjtype.cpp | 4 +++- source/common/scripting/backend/codegen.cpp | 9 ++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/common/filesystem/source/fs_findfile.cpp b/source/common/filesystem/source/fs_findfile.cpp index 1f8824fc7..9bc32e75e 100644 --- a/source/common/filesystem/source/fs_findfile.cpp +++ b/source/common/filesystem/source/fs_findfile.cpp @@ -40,6 +40,9 @@ #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include diff --git a/source/common/objects/dobjtype.cpp b/source/common/objects/dobjtype.cpp index 4c2a1bd4d..0d1bfdf9a 100644 --- a/source/common/objects/dobjtype.cpp +++ b/source/common/objects/dobjtype.cpp @@ -667,6 +667,8 @@ PClass *PClass::FindClassTentative(FName name) // //========================================================================== +bool ShouldAllowGameSpecificVirtual(FName name, unsigned index, PType* arg, PType* varg); + int PClass::FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc, bool exactReturnType, bool ignorePointerReadOnly) { auto proto = variant->Proto; @@ -698,7 +700,7 @@ int PClass::FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction break; } } - else + else if(!ShouldAllowGameSpecificVirtual(name, a, proto->ArgumentTypes[a], vproto->ArgumentTypes[a])) { fail = true; break; diff --git a/source/common/scripting/backend/codegen.cpp b/source/common/scripting/backend/codegen.cpp index 28f27f850..8b3ee306a 100644 --- a/source/common/scripting/backend/codegen.cpp +++ b/source/common/scripting/backend/codegen.cpp @@ -12564,7 +12564,14 @@ FxExpression *FxLocalVariableDeclaration::Resolve(FCompileContext &ctx) { if (Init->IsStruct()) { - ValueType = NewPointer(ValueType); + bool writable = true; + + if(ctx.Version >= MakeVersion(4, 12, 0)) + { + Init->RequestAddress(ctx, &writable); + } + + ValueType = NewPointer(ValueType, !writable); Init = new FxTypeCast(Init, ValueType, false); SAFE_RESOLVE(Init, ctx); }