--- ../../doxygen-1.8.3.1.p1/src/classdef.cpp	2013-01-06 07:37:39.000000000 -0500
+++ classdef.cpp	2013-03-06 16:16:07.233643000 -0500
@@ -4163,13 +4163,13 @@
     //static bool optimizeVhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
     if (ml) 
     {
-      ml->writeDeclarations(ol,this,0,0,0,title,subTitle,FALSE,showInline,inheritedFrom); 
+      ml->writeDeclarations(ol,this,0,0,0,title,subTitle,definitionType(),FALSE,showInline,inheritedFrom); 
       if (lt2!=-1)
       {
         MemberList * ml2 = getMemberList((MemberListType)lt2);
         if (ml2)
         {
-          ml2->writeDeclarations(ol,this,0,0,0,0,0,FALSE,showInline,inheritedFrom); 
+          ml2->writeDeclarations(ol,this,0,0,0,0,0,definitionType(),FALSE,showInline,inheritedFrom); 
         }
       }
     }
@@ -4225,7 +4225,7 @@
   if (ml) 
   {
     ml->setInGroup(inGroup);
-    ml->writePlainDeclarations(ol,this,0,0,0,inheritedFrom,inheritId); 
+    ml->writePlainDeclarations(ol,this,0,0,0,definitionType(),inheritedFrom,inheritId); 
   }
 }
 

--- ../../doxygen-1.8.3.1.p1/src/filedef.cpp	2013-01-05 10:17:41.000000000 -0500
+++ filedef.cpp	2013-03-06 16:18:48.749968000 -0500
@@ -1659,7 +1659,7 @@
     }
     else
     {
-      ml->writeDeclarations(ol,0,0,this,0,title,0);
+      ml->writeDeclarations(ol,0,0,this,0,title,0,definitionType());
     }
   }
 }

--- ../../doxygen-1.8.3.1.p1/src/groupdef.cpp	2013-01-05 10:17:41.000000000 -0500
+++ groupdef.cpp	2013-03-06 16:17:57.136710000 -0500
@@ -1465,7 +1465,7 @@
   }
   if (ml) 
   {
-    ml->writeDeclarations(ol,0,0,0,this,title,0);
+    ml->writeDeclarations(ol,0,0,0,this,title,0,definitionType());
   }
 }
 

--- ../../doxygen-1.8.3.1.p1/src/memberdef.cpp	2013-01-12 08:09:18.000000000 -0500
+++ memberdef.cpp	2013-03-07 08:49:15.110602000 -0500
@@ -539,7 +539,7 @@
     ClassDef *category;
     MemberDef *categoryRelation;
 
-    bool tagDataWritten;
+    unsigned tagDataWritten;
 };
 
 MemberDefImpl::MemberDefImpl() :
@@ -668,7 +668,7 @@
   hasDocumentedReturnType = FALSE;
   docProvider = 0;
   isDMember = def->getDefFileName().right(2).lower()==".d";
-  tagDataWritten = FALSE;
+  tagDataWritten = 0; // save separate written status for file, group, class, etc.
 }
 
 
@@ -1375,8 +1375,8 @@
 
 void MemberDef::writeDeclaration(OutputList &ol,
                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
-               bool inGroup,ClassDef *inheritedFrom,const char *inheritId
-               )
+               bool inGroup, const DefType compoundType, 
+               ClassDef *inheritedFrom,const char *inheritId)
 {
   //printf("%s MemberDef::writeDeclaration() inGroup=%d\n",qualifiedName().data(),inGroup);
 
@@ -1392,7 +1392,7 @@
   ASSERT (cd!=0 || nd!=0 || fd!=0 || gd!=0); // member should belong to something
   if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
 
-  _writeTagData();
+  _writeTagData(compoundType);
 
   QCString cname  = d->name();
   QCString cdname = d->displayName();
@@ -1506,7 +1506,7 @@
                     ltype.left(i),           // text
                     TRUE                     // autoBreak
                    ); 
-        getAnonymousEnumType()->writeEnumDeclaration(ol,cd,nd,fd,gd);
+        getAnonymousEnumType()->writeEnumDeclaration(ol,cd,nd,fd,gd,compoundType);
         //ol+=*getAnonymousEnumType()->enumDecl();
         linkifyText(TextGeneratorOLImpl(ol),d,m_impl->fileDef,this,ltype.right(ltype.length()-i-l),TRUE); 
       }
@@ -2429,7 +2429,7 @@
         ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs);
         ol.startMemberDoc(ciname,name(),memAnchor,name(),showInline);
         linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,ldef.left(i));
-        vmd->writeEnumDeclaration(ol,getClassDef(),getNamespaceDef(),getFileDef(),getGroupDef());
+        vmd->writeEnumDeclaration(ol,getClassDef(),getNamespaceDef(),getFileDef(),getGroupDef(),definitionType());
         linkifyText(TextGeneratorOLImpl(ol),container,getBodyDef(),this,ldef.right(ldef.length()-i-l));
         
         found=TRUE;
@@ -3379,9 +3379,10 @@
   return v;
 }
 
-void MemberDef::_writeTagData()
-{
-  if (m_impl->tagDataWritten) return;
+void MemberDef::_writeTagData(const DefType compoundType)
+{ 
+  unsigned typeMask = 1 << compoundType;
+  if ((m_impl->tagDataWritten) & typeMask) return; // member already written for this type
   static bool generateTagFile = !Config_getString("GENERATE_TAGFILE").isEmpty();
   // write tag file information of this member
   if (generateTagFile && isLinkableInProject())
@@ -3446,12 +3447,13 @@
           Doxygen::tagFile << "      <anchor>" << convertToXML(fmd->anchor()) << "</anchor>" << endl; 
           Doxygen::tagFile << "      <arglist>" << convertToXML(fmd->argsString()) << "</arglist>" << endl; 
           Doxygen::tagFile << "    </member>" << endl;
+          fmd->m_impl->tagDataWritten |= typeMask;
           fmd->_addToSearchIndex();
         }
       }
     }
   }
-  m_impl->tagDataWritten=TRUE;
+  m_impl->tagDataWritten |= typeMask;
 }
 
 void MemberDef::_computeIsConstructor()
@@ -3552,7 +3554,8 @@
 }
 
 void MemberDef::writeEnumDeclaration(OutputList &typeDecl,
-     ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd)
+     ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 
+     const DefType compoundType)
 {
   KEEP_RESIDENT_DURING_CALL;
 
@@ -3581,7 +3584,7 @@
   {
     if (isLinkableInProject() || hasDocumentedEnumValues())
     {
-      _writeTagData();
+      _writeTagData(compoundType);
       writeLink(typeDecl,cd,nd,fd,gd);
     }
     else
@@ -3628,7 +3631,7 @@
 
           if (fmd->hasDocumentation()) // enum value has docs
           {
-            fmd->_writeTagData();
+            fmd->_writeTagData(compoundType);
             fmd->writeLink(typeDecl,cd,nd,fd,gd);
           }
           else // no docs for this enum value
@@ -4821,7 +4824,7 @@
   marshalBool         (Doxygen::symbolStorage,m_impl->docsForDefinition);
   marshalObjPointer   (Doxygen::symbolStorage,m_impl->category);
   marshalObjPointer   (Doxygen::symbolStorage,m_impl->categoryRelation);
-  marshalBool         (Doxygen::symbolStorage,m_impl->tagDataWritten);
+  marshalUInt         (Doxygen::symbolStorage,m_impl->tagDataWritten);
   marshalUInt(Doxygen::symbolStorage,END_MARKER);
 
   // function doesn't modify the object conceptually but compiler doesn't know this.
@@ -4925,7 +4928,7 @@
   m_impl->docsForDefinition       = unmarshalBool         (Doxygen::symbolStorage);
   m_impl->category                = (ClassDef*)unmarshalObjPointer   (Doxygen::symbolStorage);
   m_impl->categoryRelation        = (MemberDef*)unmarshalObjPointer  (Doxygen::symbolStorage);
-  m_impl->tagDataWritten          = unmarshalBool         (Doxygen::symbolStorage);
+  m_impl->tagDataWritten          = unmarshalUInt         (Doxygen::symbolStorage);
   marker = unmarshalUInt(Doxygen::symbolStorage);
   assert(marker==END_MARKER);
 

--- ../../doxygen-1.8.3.1.p1/src/memberdef.h	2013-01-05 10:17:42.000000000 -0500
+++ memberdef.h	2013-03-06 10:48:18.947359000 -0500
@@ -341,14 +341,16 @@
     // output generation
     void writeDeclaration(OutputList &ol,
                    ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
-                   bool inGroup,ClassDef *inheritFrom=0,const char *inheritId=0); 
+                   bool inGroup, const DefType compoundType,
+                   ClassDef *inheritFrom=0,const char *inheritId=0); 
     void writeDocumentation(MemberList *ml,OutputList &ol,
                             const char *scopeName,Definition *container,
                             bool inGroup,bool showEnumValues=FALSE,bool
                             showInline=FALSE);
     void writeMemberDocSimple(OutputList &ol,Definition *container);
     void writeEnumDeclaration(OutputList &typeDecl,
-            ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd);
+            ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 
+            const DefType compoundType);
     void warnIfUndocumented();
     
     MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs,
@@ -380,7 +382,7 @@
                           const QCString &cfname,const QCString &ciname,
                           const QCString &cname);
     void _writeCategoryRelation(OutputList &ol);
-    void _writeTagData();
+    void _writeTagData(const DefType);
     void _addToSearchIndex();
 
     static int s_indentLevel;

--- ../../doxygen-1.8.3.1.p1/src/membergroup.cpp	2013-01-05 10:17:42.000000000 -0500
+++ membergroup.cpp	2013-03-06 14:55:20.411250000 -0500
@@ -112,7 +112,7 @@
   //printf("MemberGroup::writeDeclarations() %s\n",grpHeader.data());
   QCString ldoc = doc;
   if (!ldoc.isEmpty()) ldoc.prepend("<a name=\""+anchor()+"\" id=\""+anchor()+"\"></a>");
-  memberList->writeDeclarations(ol,cd,nd,fd,gd,grpHeader,ldoc,FALSE,showInline);
+  memberList->writeDeclarations(ol,cd,nd,fd,gd,grpHeader,ldoc,DefinitionIntf::TypeGroup,FALSE,showInline);
 }
 
 void MemberGroup::writePlainDeclarations(OutputList &ol,
@@ -121,7 +121,7 @@
               )
 {
   //printf("MemberGroup::writePlainDeclarations() memberList->count()=%d\n",memberList->count());
-  memberList->writePlainDeclarations(ol,cd,nd,fd,gd,inheritedFrom,inheritId);
+  memberList->writePlainDeclarations(ol,cd,nd,fd,gd,DefinitionIntf::TypeGroup,inheritedFrom,inheritId);
 }
 
 void MemberGroup::writeDocumentation(OutputList &ol,const char *scopeName,
@@ -150,7 +150,7 @@
     {
       MemberList ml(lt);
       ml.append(md);
-      ml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId);
+      ml.writePlainDeclarations(ol,cd,0,0,0,DefinitionIntf::TypeGroup,inheritedFrom,inheritId);
     }
   }
 }

--- ../../doxygen-1.8.3.1.p1/src/memberlist.cpp	2013-01-05 10:17:42.000000000 -0500
+++ memberlist.cpp	2013-03-06 14:46:56.433538000 -0500
@@ -296,7 +296,8 @@
 }
 
 void MemberList::writePlainDeclarations(OutputList &ol,
-                       ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
+                       ClassDef *cd,NamespaceDef *nd,FileDef *fd,
+                       GroupDef *gd, const DefinitionIntf::DefType compoundType,
                        ClassDef *inheritedFrom,const char *inheritId
                       )
 {
@@ -336,7 +337,7 @@
         case MemberType_Event:  
           {
             if (first) ol.startMemberList(),first=FALSE;
-            md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,inheritedFrom,inheritId);
+            md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,compoundType,inheritedFrom,inheritId);
             break;
           }
         case MemberType_Enumeration: 
@@ -373,7 +374,7 @@
               ol.startMemberItem(md->anchor(),0,inheritId);
               ol.writeString("enum ");
               ol.insertMemberAlign();
-              md->writeEnumDeclaration(ol,cd,nd,fd,gd);
+              md->writeEnumDeclaration(ol,cd,nd,fd,gd,compoundType);
               ol.endMemberItem();
               if (!md->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
               {
@@ -409,7 +410,7 @@
               ol.startMemberList();
               first=FALSE;
             }
-            md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,inheritedFrom,inheritId);
+            md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,compoundType,inheritedFrom,inheritId);
             break;
           }
         case MemberType_EnumValue: 
@@ -418,7 +419,7 @@
             {
               //printf("EnumValue!\n");
               if (first) ol.startMemberList(),first=FALSE;
-              md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,inheritedFrom,inheritId);
+              md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,compoundType,inheritedFrom,inheritId);
             }
           }
           break;
@@ -444,7 +445,7 @@
             ol.startMemberList();
             first=FALSE;
           }
-          md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup);
+          md->writeDeclaration(ol,cd,nd,fd,gd,m_inGroup,compoundType);
         }
         md->setFromAnonymousScope(TRUE);
       }
@@ -476,7 +477,8 @@
  */
 void MemberList::writeDeclarations(OutputList &ol,
              ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
-             const char *title,const char *subtitle, bool showEnumValues,
+             const char *title,const char *subtitle,
+             const DefinitionIntf::DefType compoundType,bool showEnumValues,
              bool showInline,ClassDef *inheritedFrom)
 {
   (void)showEnumValues; // unused
@@ -562,7 +564,7 @@
     }
     else
     {
-      writePlainDeclarations(ol,cd,nd,fd,gd,inheritedFrom,inheritId);
+      writePlainDeclarations(ol,cd,nd,fd,gd,compoundType,inheritedFrom,inheritId);
     }
 
     //printf("memberGroupList=%p\n",memberGroupList);

--- ../../doxygen-1.8.3.1.p1/src/memberlist.h	2013-01-05 10:17:42.000000000 -0500
+++ memberlist.h	2013-03-06 14:47:00.238254000 -0500
@@ -56,11 +56,12 @@
     void countDocMembers(bool countEnumValues=FALSE);
     int countInheritableMembers(ClassDef *inheritedFrom) const;
     void writePlainDeclarations(OutputList &ol,
-               ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
+               ClassDef *cd,NamespaceDef *nd,FileDef *fd,
+               GroupDef *gd,const DefinitionIntf::DefType compoundType,
                ClassDef *inheritedFrom,const char *inheritId);
     void writeDeclarations(OutputList &ol,
                ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
-               const char *title,const char *subtitle,
+               const char *title,const char *subtitle,const DefinitionIntf::DefType compoundType,
                bool showEnumValues=FALSE,bool showInline=FALSE,
                ClassDef *inheritedFrom=0);
     void writeDocumentation(OutputList &ol,const char *scopeName,

--- ../../doxygen-1.8.3.1.p1/src/namespacedef.cpp	2013-01-05 10:17:42.000000000 -0500
+++ namespacedef.cpp	2013-03-06 14:56:34.548922000 -0500
@@ -965,7 +965,7 @@
 void NamespaceDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title)
 {
   MemberList * ml = getMemberList(lt);
-  if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0);
+  if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0,DefinitionIntf::TypeNamespace);
 }
 
 void NamespaceDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title)

