1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-06 20:37:16 +00:00

Renamed attribute handling functions. Added SymHasAttr().

git-svn-id: svn://svn.cc65.org/cc65/trunk@4375 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-10-19 10:19:26 +00:00
parent 918171231c
commit 548336a7bd
6 changed files with 19 additions and 9 deletions

View File

@ -170,7 +170,7 @@ static void Parse (void)
Entry = AddGlobalSym (Decl.Ident, Decl.Type, Decl.StorageClass);
/* Add declaration attributes */
SymUseAttributes (Entry, &Decl);
SymUseAttr (Entry, &Decl);
/* Reserve storage for the variable if we need to */
if (Decl.StorageClass & SC_STORAGE) {

View File

@ -1169,7 +1169,7 @@ static void ParseAnsiParamList (FuncDesc* F)
Sym = AddLocalSym (Decl.Ident, ParamTypeCvt (Decl.Type), Decl.StorageClass, 0);
/* Add attributes if we have any */
SymUseAttributes (Sym, &Decl);
SymUseAttr (Sym, &Decl);
/* If the parameter is a struct or union, emit a warning */
if (IsClassStruct (Decl.Type)) {

View File

@ -487,7 +487,7 @@ static void FunctionCall (ExprDesc* Expr)
} else {
/* Check function attributes */
if (Expr->Sym && SymGetAttribute (Expr->Sym, atNoReturn)) {
if (Expr->Sym && SymHasAttr (Expr->Sym, atNoReturn)) {
/* For now, handle as if a return statement was encountered */
F_ReturnFound (CurrentFunc);
}

View File

@ -153,7 +153,7 @@ void DumpSymEntry (FILE* F, const SymEntry* E)
const DeclAttr* SymGetAttribute (const SymEntry* Sym, DeclAttrType AttrType)
const DeclAttr* SymGetAttr (const SymEntry* Sym, DeclAttrType AttrType)
/* Return an attribute for this symbol or NULL if the attribute does not exist */
{
/* Beware: We may not even have a collection */
@ -177,7 +177,7 @@ const DeclAttr* SymGetAttribute (const SymEntry* Sym, DeclAttrType AttrType)
void SymUseAttributes (SymEntry* Sym, struct Declaration* D)
void SymUseAttr (SymEntry* Sym, struct Declaration* D)
/* Use the attributes from the declaration for this symbol */
{
/* We cannot specify attributes twice */

View File

@ -231,10 +231,20 @@ INLINE const char* SymGetAsmName (const SymEntry* Sym)
# define SymGetAsmName(Sym) ((Sym)->AsmName)
#endif
const DeclAttr* SymGetAttribute (const SymEntry* Sym, DeclAttrType AttrType);
const DeclAttr* SymGetAttr (const SymEntry* Sym, DeclAttrType AttrType);
/* Return an attribute for this symbol or NULL if the attribute does not exist */
void SymUseAttributes (SymEntry* Sym, struct Declaration* D);
#if defined(HAVE_INLINE)
INLINE int SymHasAttr (const SymEntry* Sym, DeclAttrType A)
/* Return true if the symbol has the given attribute */
{
return (SymGetAttr (Sym, A) != 0);
}
#else
# define SymHasAttr(Sym, A) (SymGetAttr (Sym, A) != 0)
#endif
void SymUseAttr (SymEntry* Sym, struct Declaration* D);
/* Use the attributes from the declaration for this symbol */
void CvtRegVarToAuto (SymEntry* Sym);

View File

@ -162,8 +162,8 @@ static void CheckSymTable (SymTable* Tab)
* defined but not used.
*/
if (((Flags & SC_AUTO) || (Flags & SC_STATIC)) && (Flags & SC_EXTERN) == 0) {
if (SymIsDef (Entry) && !SymIsRef (Entry) &&
SymGetAttribute (Entry, atUnused) == 0) {
if (SymIsDef (Entry) && !SymIsRef (Entry) &&
!SymHasAttr (Entry, atUnused)) {
if (Flags & SC_PARAM) {
if (IS_Get (&WarnUnusedParam)) {
Warning ("Parameter `%s' is never used", Entry->Name);