Consistently use UINT32_MAX, not -1, for uint32_t values

This commit is contained in:
Rangi42
2024-12-10 19:47:23 -05:00
parent a8ec9228d4
commit b18cfe6bdb
3 changed files with 3 additions and 3 deletions

View File

@@ -162,7 +162,7 @@ bool yywrap() {
// If the node is referenced outside this context, we can't edit it, so duplicate it // If the node is referenced outside this context, we can't edit it, so duplicate it
if (context.fileInfo.use_count() > 1) { if (context.fileInfo.use_count() > 1) {
context.fileInfo = std::make_shared<FileStackNode>(*context.fileInfo); context.fileInfo = std::make_shared<FileStackNode>(*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<uint32_t> &fileInfoIters = context.fileInfo->iters(); std::vector<uint32_t> &fileInfoIters = context.fileInfo->iters();

View File

@@ -1702,7 +1702,7 @@ sect_org:
} }
| LBRACK uconst RBRACK { | LBRACK uconst RBRACK {
$$ = $2; $$ = $2;
if ($$ < 0 || $$ >= 0x10000) { if ($$ < 0 || $$ > 0xFFFF) {
::error("Address $%x is not 16-bit\n", $$); ::error("Address $%x is not 16-bit\n", $$);
$$ = -1; $$ = -1;
} }

View File

@@ -169,7 +169,7 @@ static Symbol &createSymbol(std::string const &symName) {
sym.section = nullptr; sym.section = nullptr;
sym.src = fstk_GetFileStack(); sym.src = fstk_GetFileStack();
sym.fileLine = sym.src ? lexer_GetLineNo() : 0; sym.fileLine = sym.src ? lexer_GetLineNo() : 0;
sym.ID = -1; sym.ID = UINT32_MAX;
sym.defIndex = nextDefIndex++; sym.defIndex = nextDefIndex++;
return sym; return sym;