From: cuz Date: Mon, 31 Mar 2008 21:28:50 +0000 (+0000) Subject: More fixes for Watcom C / C89. X-Git-Tag: V2.12.0~28 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=225e1ca58e9e929c7d77a8c654211f7363ff65f7;p=cc65 More fixes for Watcom C / C89. git-svn-id: svn://svn.cc65.org/cc65/trunk@3829 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ca65/main.c b/src/ca65/main.c index 462fb464a..151672702 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -147,13 +147,14 @@ static void NewSymbol (const char* SymName, long Val) /* Define a symbol with a fixed numeric value in the current scope */ { ExprNode* Expr; + SymEntry* Sym; /* Convert the name to a string buffer */ StrBuf SymBuf = STATIC_STRBUF_INITIALIZER; SB_CopyStr (&SymBuf, SymName); /* Search for the symbol, allocate a new one if it doesn't exist */ - SymEntry* Sym = SymFind (CurrentScope, &SymBuf, SYM_ALLOC_NEW); + Sym = SymFind (CurrentScope, &SymBuf, SYM_ALLOC_NEW); /* Check if have already a symbol with this name */ if (SymIsDef (Sym)) { @@ -295,7 +296,7 @@ static void DefineSymbol (const char* Def) InvDef (Def); } P = Def; - + /* Copy the symbol, checking the rest */ I = 0; while (IsIdChar (*P)) { diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 4f6b62973..0c9a2fa11 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1144,7 +1144,7 @@ static void DoInclude (void) /* Name must follow */ if (Tok != TOK_STRCON) { ErrorSkip ("String constant expected"); - } else { + } else { SB_Terminate (&SVal); NewInputFile (SB_GetConstBuf (&SVal)); } @@ -1558,9 +1558,11 @@ static void DoSetCPU (void) if (Tok != TOK_STRCON) { ErrorSkip ("String constant expected"); } else { + cpu_t CPU; + /* Try to find the CPU */ SB_Terminate (&SVal); - cpu_t CPU = FindCPU (SB_GetConstBuf (&SVal)); + CPU = FindCPU (SB_GetConstBuf (&SVal)); /* Switch to the new CPU */ SetCPU (CPU); diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 8b7ef9656..891971c95 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -646,9 +646,13 @@ static unsigned char FindDotKeyword (void) * return TOK_NONE if not found. */ { - struct DotKeyword K = { SB_GetConstBuf (&SVal), 0 }; + struct DotKeyword K; struct DotKeyword* R; + /* Initialize K */ + K.Key = SB_GetConstBuf (&SVal); + K.Tok = 0; + /* If we aren't in ignore case mode, we have to uppercase the keyword */ if (!IgnoreCase) { UpcaseSVal (); diff --git a/src/ca65/symbol.c b/src/ca65/symbol.c index c81899fa9..444decfc5 100644 --- a/src/ca65/symbol.c +++ b/src/ca65/symbol.c @@ -62,12 +62,13 @@ SymTable* ParseScopedIdent (StrBuf* Name, StrBuf* FullName) * by the caller for error messages or similar. */ { + SymTable* Scope; + /* Clear both passed string buffers */ SB_Clear (Name); SB_Clear (FullName); /* Get the starting table */ - SymTable* Scope; if (Tok == TOK_NAMESPACE) { /* Start from the root scope */ diff --git a/src/ca65/symentry.h b/src/ca65/symentry.h index 5da15a59f..42b281ed7 100644 --- a/src/ca65/symentry.h +++ b/src/ca65/symentry.h @@ -312,7 +312,7 @@ INLINE const StrBuf* GetSymName (const SymEntry* S) return GetStrBuf (S->Name); } #else -# define GetSymName(S) GetString ((S)->Name) +# define GetSymName(S) GetStrBuf ((S)->Name) #endif #if defined(HAVE_INLINE) @@ -353,3 +353,4 @@ INLINE const FilePos* GetSymPos (const SymEntry* S) +