1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 16:29:58 +00:00

More lineinfo usage.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4935 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-01-27 21:40:37 +00:00
parent a376e1e954
commit 81555b223d
2 changed files with 16 additions and 13 deletions

View File

@ -288,9 +288,9 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags
S->ExportSize = S->AddrSize; S->ExportSize = S->AddrSize;
} else if (S->AddrSize > S->ExportSize) { } else if (S->AddrSize > S->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
PWarning (GetSymPos (S), 1, "Symbol `%m%p' is %s but exported %s", LIWarning (&S->LineInfos, 1, "Symbol `%m%p' is %s but exported %s",
GetSymName (S), AddrSizeToStr (S->AddrSize), GetSymName (S), AddrSizeToStr (S->AddrSize),
AddrSizeToStr (S->ExportSize)); AddrSizeToStr (S->ExportSize));
} }
} }

View File

@ -36,12 +36,12 @@
/* common */ /* common */
#include "check.h" #include "check.h"
#include "coll.h" #include "coll.h"
#include "filepos.h"
#include "xmalloc.h" #include "xmalloc.h"
/* ca65 */ /* ca65 */
#include "error.h" #include "error.h"
#include "expr.h" #include "expr.h"
#include "lineinfo.h"
#include "scanner.h" #include "scanner.h"
#include "ulabel.h" #include "ulabel.h"
@ -56,9 +56,9 @@
/* Struct that describes an unnamed label */ /* Struct that describes an unnamed label */
typedef struct ULabel ULabel; typedef struct ULabel ULabel;
struct ULabel { struct ULabel {
FilePos Pos; /* Position of the label in the source */ Collection LineInfos; /* Position of the label in the source */
ExprNode* Val; /* The label value - may be NULL */ ExprNode* Val; /* The label value - may be NULL */
unsigned Ref; /* Number of references */ unsigned Ref; /* Number of references */
}; };
/* List management */ /* List management */
@ -82,9 +82,10 @@ static ULabel* NewULabel (ExprNode* Val)
ULabel* L = xmalloc (sizeof (ULabel)); ULabel* L = xmalloc (sizeof (ULabel));
/* Initialize the fields */ /* Initialize the fields */
L->Pos = CurTok.Pos; L->LineInfos = EmptyCollection;
L->Val = Val; GetFullLineInfo (&L->LineInfos);
L->Ref = 0; L->Val = Val;
L->Ref = 0;
/* Insert the label into the collection */ /* Insert the label into the collection */
CollAppend (&ULabList, L); CollAppend (&ULabList, L);
@ -160,7 +161,8 @@ void ULabDef (void)
ULabel* L = CollAtUnchecked (&ULabList, ULabDefCount); ULabel* L = CollAtUnchecked (&ULabList, ULabDefCount);
CHECK (L->Val == 0); CHECK (L->Val == 0);
L->Val = GenCurrentPC (); L->Val = GenCurrentPC ();
L->Pos = CurTok.Pos; CollDeleteAll (&L->LineInfos);
GetFullLineInfo (&L->LineInfos);
} else { } else {
/* There is no such label, create it */ /* There is no such label, create it */
NewULabel (GenCurrentPC ()); NewULabel (GenCurrentPC ());
@ -204,7 +206,7 @@ void ULabCheck (void)
unsigned I = ULabDefCount; unsigned I = ULabDefCount;
while (I < CollCount (&ULabList)) { while (I < CollCount (&ULabList)) {
ULabel* L = CollAtUnchecked (&ULabList, I); ULabel* L = CollAtUnchecked (&ULabList, I);
PError (&L->Pos, "Undefined label"); LIError (&L->LineInfos, "Undefined label");
++I; ++I;
} }
@ -214,10 +216,11 @@ void ULabCheck (void)
for (I = 0; I < CollCount (&ULabList); ++I) { for (I = 0; I < CollCount (&ULabList); ++I) {
ULabel* L = CollAtUnchecked (&ULabList, I); ULabel* L = CollAtUnchecked (&ULabList, I);
if (L->Ref == 0) { if (L->Ref == 0) {
PWarning (&L->Pos, 1, "No reference to unnamed label"); LIWarning (&L->LineInfos, 1, "No reference to unnamed label");
} }
} }
} }