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) {
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)) {
} 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);
}
-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 */
-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 */
# 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);
* 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);