summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2014-03-02 19:32:42 (GMT)
committeralbert-github <albert.tests@gmail.com>2014-03-02 19:32:42 (GMT)
commitac611be473c2d9bf65bcafb53b0577274c4ae706 (patch)
tree3fa0e5b2798121b937fce6169d6a23e2575d4e1d /src/util.cpp
parent8eeaae0b06fd320745f22efe176e0f19d6c8e2a6 (diff)
downloadDoxygen-ac611be473c2d9bf65bcafb53b0577274c4ae706.zip
Doxygen-ac611be473c2d9bf65bcafb53b0577274c4ae706.tar.gz
Doxygen-ac611be473c2d9bf65bcafb53b0577274c4ae706.tar.bz2
In case of sections with the same name they are not reported.
In this patch it is checked if a section label has been used before and if so a warning is given with file name and line number (when possible) where the section label was used the first time. Note in section.h the item level was not initialized in the past in case of a copy constructor.
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/util.cpp b/src/util.cpp
index bc93446..0452fbb 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6280,14 +6280,29 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
{
file=pd->getOutputFileBase();
}
- SectionInfo *si=new SectionInfo(
- file,pd->name(),pd->title(),SectionInfo::Page,0,pd->getReference());
- //printf("si->label=`%s' si->definition=%s si->fileName=`%s'\n",
- // si->label.data(),si->definition?si->definition->name().data():"<none>",
- // si->fileName.data());
- //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
- //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data());
- Doxygen::sectionDict->append(pd->name(),si);
+ SectionInfo *si = Doxygen::sectionDict->find(pd->name());
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(file,-1,"multiple use of section label '%s', (first occurrence: %s, line %d)",pd->name().data(),si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(file,-1,"multiple use of section label '%s', (first occurrence: %s)",pd->name().data(),si->fileName.data());
+ }
+ }
+ else
+ {
+ si=new SectionInfo(
+ file,-1,pd->name(),pd->title(),SectionInfo::Page,0,pd->getReference());
+ //printf("si->label=`%s' si->definition=%s si->fileName=`%s'\n",
+ // si->label.data(),si->definition?si->definition->name().data():"<none>",
+ // si->fileName.data());
+ //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
+ //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data());
+ Doxygen::sectionDict->append(pd->name(),si);
+ }
}
}
return pd;