From: JT Date: Mon, 20 Apr 2015 21:20:54 +0000 (-0400) Subject: Improved on funciton .ADDRSIZE. Conform to coding style. X-Git-Tag: V2.15~11^2~3^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dfddf8f9d25ed29ee8e26715b018ba60a7fb06a0;p=cc65 Improved on funciton .ADDRSIZE. Conform to coding style. --- diff --git a/src/ca65/expr.c b/src/ca65/expr.c index ad1a0b155..8fdc37421 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -629,7 +629,7 @@ static ExprNode* FuncReferenced (void) -static ExprNode* FuncAddrSize(void) +static ExprNode* FuncAddrSize (void) /* Handle the .ADDRSIZE function */ { StrBuf ScopeName = STATIC_STRBUF_INITIALIZER; @@ -646,71 +646,66 @@ static ExprNode* FuncAddrSize(void) if (CurTok.Tok == TOK_LOCAL_IDENT) { /* Cheap local symbol */ - Sym = SymFindLocal(SymLast, &CurTok.SVal, SYM_FIND_EXISTING); + Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING); if (Sym == 0) { - Error("Unknown symbol or scope: `%m%p'", &CurTok.SVal); - } - else { + Error ("Unknown symbol or scope: `%m%p'", &CurTok.SVal); + } else { AddrSize = Sym->AddrSize; } /* Remember and skip SVal, terminate ScopeName so it is empty */ - SB_Copy(&Name, &CurTok.SVal); - NextTok(); - SB_Terminate(&ScopeName); + SB_Copy (&Name, &CurTok.SVal); + NextTok (); + SB_Terminate (&ScopeName); - } - else { + } else { /* Parse the scope and the name */ - SymTable* ParentScope = ParseScopedIdent(&Name, &ScopeName); + SymTable* ParentScope = ParseScopedIdent (&Name, &ScopeName); /* Check if the parent scope is valid */ if (ParentScope == 0) { /* No such scope */ - SB_Done(&ScopeName); - SB_Done(&Name); - return GenLiteral0(); + SB_Done (&ScopeName); + SB_Done (&Name); + return GenLiteral0 (); } /* If ScopeName is empty, no explicit scope was specified. We have to - * search upper scope levels in this case. + ** search upper scope levels in this case. */ - NoScope = SB_IsEmpty(&ScopeName); + NoScope = SB_IsEmpty (&ScopeName); /* If we did find a scope with the name, read the symbol defining the - * size, otherwise search for a symbol entry with the name and scope. + ** size, otherwise search for a symbol entry with the name and scope. */ if (NoScope) { - Sym = SymFindAny(ParentScope, &Name); - } - else { - Sym = SymFind(ParentScope, &Name, SYM_FIND_EXISTING); + Sym = SymFindAny (ParentScope, &Name); + } else { + Sym = SymFind (ParentScope, &Name, SYM_FIND_EXISTING); } /* If we found the symbol retrieve the size, otherwise complain */ if (Sym) { AddrSize = Sym->AddrSize; - } - else { - Error("Unknown symbol or scope: `%m%p%m%p'", + } else { + Error ("Unknown symbol or scope: `%m%p%m%p'", &ScopeName, &Name); } } - /* Check if we have a size */ - /* if we don't know, return it anyway, zero can mean unknown, or uncomment this code for an error - if (AddrSize == 0 ) { - Error ("Address size of `%m%p%m%p' is unknown", &ScopeName, &Name); + if (AddrSize == 0) { + Warning(1, "Unknown address size: `%m%p%m%p'", + &ScopeName, &Name); } - */ /* Free the string buffers */ - SB_Done(&ScopeName); - SB_Done(&Name); + SB_Done (&ScopeName); + SB_Done (&Name); - /* Return the size */ - return GenLiteralExpr(AddrSize); + /* Return the size. */ + + return GenLiteralExpr (AddrSize); } @@ -1052,7 +1047,7 @@ static ExprNode* Factor (void) break; case TOK_ADDRSIZE: - N = Function(FuncAddrSize); + N = Function (FuncAddrSize); break; case TOK_BLANK: diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 9543c9872..db747cf70 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -739,9 +739,10 @@ static token_t FindDotKeyword (void) default: break; } + return R->Tok; - } - else { + + } else { return TOK_NONE; } }