From ab06ce74c5c4fef7bf6d77a73ceb7d491043cbdf Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 21 Apr 2025 18:29:01 +0200 Subject: [PATCH] More global namespace fixes --- oscar64/NativeCodeGenerator.cpp | 14 +++++++++----- oscar64/Parser.cpp | 13 +++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 2efb027..0fe67fa 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -697,13 +697,17 @@ bool NativeCodeInstruction::IsUsedResultInstructions(NumberSet& requiredTemps) } else { -#if 0 - for (int i = 0; i < 4; i++) + if (mLinkerObject) { - requiredTemps -= BC_REG_ACCU + i; - requiredTemps -= BC_REG_WORK + i; + for (int i = 0; i < 4; i++) + { + if (mLinkerObject->mZeroPageSet[BC_REG_ACCU + i]) + requiredTemps -= BC_REG_ACCU + i; + if (mLinkerObject->mZeroPageSet[BC_REG_WORK + i]) + requiredTemps -= BC_REG_WORK + i; + } } -#endif + if (mFlags & NICF_USE_WORKREGS) { for (int i = 0; i < 10; i++) diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index de3e69d..6bcd3c5 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -877,7 +877,19 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint64 flags, bool qualified, Decl } break; + case TK_COLCOLON: case TK_IDENT: + { + DeclarationScope* scope = mScope; + if (mScanner->mToken == TK_COLCOLON) + { + mScanner->NextToken(); + while (scope->mLevel > SLEVEL_STATIC) + scope = scope->mParent; + if (!ExpectToken(TK_IDENT)) + break; + } + pident = mScanner->mTokenIdent; mScanner->NextToken(); @@ -964,6 +976,7 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint64 flags, bool qualified, Decl mErrors->Error(mScanner->mLocation, EERR_OBJECT_NOT_FOUND, "Identifier not defined", pident); break; + } case TK_ENUM: {