From b18cfe6bdbc3036ccfb48db4fd4d7dc63026a7a5 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 10 Dec 2024 19:47:23 -0500 Subject: [PATCH] Consistently use UINT32_MAX, not -1, for uint32_t values --- src/asm/fstack.cpp | 2 +- src/asm/parser.y | 2 +- src/asm/symbol.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/asm/fstack.cpp b/src/asm/fstack.cpp index b33646ea..97a4ac8f 100644 --- a/src/asm/fstack.cpp +++ b/src/asm/fstack.cpp @@ -162,7 +162,7 @@ bool yywrap() { // If the node is referenced outside this context, we can't edit it, so duplicate it if (context.fileInfo.use_count() > 1) { context.fileInfo = std::make_shared(*context.fileInfo); - context.fileInfo->ID = -1; // The copy is not yet registered + context.fileInfo->ID = UINT32_MAX; // The copy is not yet registered } std::vector &fileInfoIters = context.fileInfo->iters(); diff --git a/src/asm/parser.y b/src/asm/parser.y index 820ddf49..f16556eb 100644 --- a/src/asm/parser.y +++ b/src/asm/parser.y @@ -1702,7 +1702,7 @@ sect_org: } | LBRACK uconst RBRACK { $$ = $2; - if ($$ < 0 || $$ >= 0x10000) { + if ($$ < 0 || $$ > 0xFFFF) { ::error("Address $%x is not 16-bit\n", $$); $$ = -1; } diff --git a/src/asm/symbol.cpp b/src/asm/symbol.cpp index fa829268..1ae86aba 100644 --- a/src/asm/symbol.cpp +++ b/src/asm/symbol.cpp @@ -169,7 +169,7 @@ static Symbol &createSymbol(std::string const &symName) { sym.section = nullptr; sym.src = fstk_GetFileStack(); sym.fileLine = sym.src ? lexer_GetLineNo() : 0; - sym.ID = -1; + sym.ID = UINT32_MAX; sym.defIndex = nextDefIndex++; return sym;