--- /opt/cvs/dotgnu/pnet/cscc/csharp/cs_attrs.c Mon May 5 03:05:04 2003 +++ cscc/csharp/cs_attrs.c Fri May 30 03:20:12 2003 @@ -379,6 +379,29 @@ } /* + * Remove Attributes from code + */ + +static int CompareToAttribute(ILNode *node,const char * name) +{ + char *ident; + if(!name) return 0; + if(!node) return 0; + if(yyisa(node,ILNode_QualIdent)) + { + ident=ILQualIdentName(node,0); + if(!strcmp(ident,name))return 1; + else return CompareToAttribute(((ILNode_QualIdent*)node)->right, name); + } + if(yyisa(node,ILNode_Identifier)) + { + ident=ILQualIdentName(node,0); + if(!strcmp(ident,name))return 1; + } + return 0; +} + +/* * Process a single attribute in a section. */ static void ProcessAttr(ILGenInfo *info, ILProgramItem *item, @@ -418,6 +441,13 @@ int skipConst; ILType *argType; + if(CompareToAttribute(attr->name, + CCStringListGetValue(extension_flags,num_extension_flags, + "remove-attribute"))!=0) + { + return; + } + /* Hack: recognize "System.AttributeUsage" and add "Attribute". This doesn't solve all "ends in Attribute and lives in a namespace" problems, but gets rid of a particularly annoying one until a better