Improved on funciton .ADDRSIZE. Conform to coding style.
This commit is contained in:
@@ -649,8 +649,7 @@ static ExprNode* FuncAddrSize(void)
|
|||||||
Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING);
|
Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING);
|
||||||
if (Sym == 0) {
|
if (Sym == 0) {
|
||||||
Error ("Unknown symbol or scope: `%m%p'", &CurTok.SVal);
|
Error ("Unknown symbol or scope: `%m%p'", &CurTok.SVal);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
AddrSize = Sym->AddrSize;
|
AddrSize = Sym->AddrSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,8 +658,7 @@ static ExprNode* FuncAddrSize(void)
|
|||||||
NextTok ();
|
NextTok ();
|
||||||
SB_Terminate (&ScopeName);
|
SB_Terminate (&ScopeName);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
/* Parse the scope and the name */
|
/* Parse the scope and the name */
|
||||||
SymTable* ParentScope = ParseScopedIdent (&Name, &ScopeName);
|
SymTable* ParentScope = ParseScopedIdent (&Name, &ScopeName);
|
||||||
@@ -674,42 +672,39 @@ static ExprNode* FuncAddrSize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If ScopeName is empty, no explicit scope was specified. We have to
|
/* 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
|
/* 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) {
|
if (NoScope) {
|
||||||
Sym = SymFindAny (ParentScope, &Name);
|
Sym = SymFindAny (ParentScope, &Name);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Sym = SymFind (ParentScope, &Name, SYM_FIND_EXISTING);
|
Sym = SymFind (ParentScope, &Name, SYM_FIND_EXISTING);
|
||||||
}
|
}
|
||||||
/* If we found the symbol retrieve the size, otherwise complain */
|
/* If we found the symbol retrieve the size, otherwise complain */
|
||||||
if (Sym) {
|
if (Sym) {
|
||||||
AddrSize = Sym->AddrSize;
|
AddrSize = Sym->AddrSize;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Error ("Unknown symbol or scope: `%m%p%m%p'",
|
Error ("Unknown symbol or scope: `%m%p%m%p'",
|
||||||
&ScopeName, &Name);
|
&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) {
|
if (AddrSize == 0) {
|
||||||
Error ("Address size of `%m%p%m%p' is unknown", &ScopeName, &Name);
|
Warning(1, "Unknown address size: `%m%p%m%p'",
|
||||||
|
&ScopeName, &Name);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* Free the string buffers */
|
/* Free the string buffers */
|
||||||
SB_Done (&ScopeName);
|
SB_Done (&ScopeName);
|
||||||
SB_Done (&Name);
|
SB_Done (&Name);
|
||||||
|
|
||||||
/* Return the size */
|
/* Return the size. */
|
||||||
|
|
||||||
return GenLiteralExpr (AddrSize);
|
return GenLiteralExpr (AddrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -739,9 +739,10 @@ static token_t FindDotKeyword (void)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return R->Tok;
|
return R->Tok;
|
||||||
}
|
|
||||||
else {
|
} else {
|
||||||
return TOK_NONE;
|
return TOK_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user