1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 22:25:28 +00:00

Used (size_t), instead of (long) where converting between pointers and integers.

(long) still is 32 bits on 64-bit Windows!
This commit is contained in:
Greg King
2021-12-12 17:36:03 -05:00
committed by mrdudz
parent c143dd1f41
commit 81930053dd
3 changed files with 7 additions and 7 deletions

View File

@@ -286,7 +286,7 @@ static void ParseAutoDecl (Declaration* Decl)
** We abuse the Collection somewhat by using it to store line ** We abuse the Collection somewhat by using it to store line
** numbers. ** numbers.
*/ */
CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(long)GetCurrentLine (), CollReplace (&CurrentFunc->LocalsBlockStack, (void *)(size_t)GetCurrentLine (),
CollCount (&CurrentFunc->LocalsBlockStack) - 1); CollCount (&CurrentFunc->LocalsBlockStack) - 1);
} else { } else {

View File

@@ -115,7 +115,7 @@ struct CodeEntry;
typedef struct DefOrRef DefOrRef; typedef struct DefOrRef DefOrRef;
struct DefOrRef { struct DefOrRef {
unsigned Line; unsigned Line;
long LocalsBlockId; size_t LocalsBlockId;
unsigned Flags; unsigned Flags;
int StackPtr; int StackPtr;
unsigned Depth; unsigned Depth;

View File

@@ -951,7 +951,7 @@ DefOrRef* AddDefOrRef (SymEntry* E, unsigned Flags)
DOR = xmalloc (sizeof (DefOrRef)); DOR = xmalloc (sizeof (DefOrRef));
CollAppend (E->V.L.DefsOrRefs, DOR); CollAppend (E->V.L.DefsOrRefs, DOR);
DOR->Line = GetCurrentLine (); DOR->Line = GetCurrentLine ();
DOR->LocalsBlockId = (long)CollLast (&CurrentFunc->LocalsBlockStack); DOR->LocalsBlockId = (size_t)CollLast (&CurrentFunc->LocalsBlockStack);
DOR->Flags = Flags; DOR->Flags = Flags;
DOR->StackPtr = StackPtr; DOR->StackPtr = StackPtr;
DOR->Depth = CollCount (&CurrentFunc->LocalsBlockStack); DOR->Depth = CollCount (&CurrentFunc->LocalsBlockStack);
@@ -1013,9 +1013,9 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
/* Are we jumping into a block with initalization of an object that /* Are we jumping into a block with initalization of an object that
** has automatic storage duration? Let's emit a warning. ** has automatic storage duration? Let's emit a warning.
*/ */
if ((long)CollLast (AIC) != DOR->LocalsBlockId && if ((size_t)CollLast (AIC) != DOR->LocalsBlockId &&
(CollCount (AIC) < DOR->Depth || (CollCount (AIC) < DOR->Depth ||
(long)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) { (size_t)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
Warning ("Goto at line %d to label %s jumps into a block with " Warning ("Goto at line %d to label %s jumps into a block with "
"initialization of an object that has automatic storage duration", "initialization of an object that has automatic storage duration",
GetCurrentLine (), Name); GetCurrentLine (), Name);
@@ -1044,9 +1044,9 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
/* Are we jumping into a block with initalization of an object that /* Are we jumping into a block with initalization of an object that
** has automatic storage duration? Let's emit a warning. ** has automatic storage duration? Let's emit a warning.
*/ */
if ((long)CollLast (AIC) != DOR->LocalsBlockId && if ((size_t)CollLast (AIC) != DOR->LocalsBlockId &&
(CollCount (AIC) >= DOR->Depth || (CollCount (AIC) >= DOR->Depth ||
(long)CollLast (AIC) >= (long)DOR->Line)) (size_t)CollLast (AIC) >= (size_t)DOR->Line))
Warning ("Goto at line %d to label %s jumps into a block with " Warning ("Goto at line %d to label %s jumps into a block with "
"initialization of an object that has automatic storage duration", "initialization of an object that has automatic storage duration",
DOR->Line, Name); DOR->Line, Name);