Skip to content

Commit 0972710

Browse files
authored
Merge pull request doxygen#12132 from jcowgill/nondeterministic-file-ordering
Fix nondeterministic input ordering of duplicate basenames
2 parents 1b6a75c + 87d1035 commit 0972710

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/doxygen.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11140,7 +11140,7 @@ static void readDir(FileInfo *fi,
1114011140
FileName *fn=nullptr;
1114111141
if (!name.empty())
1114211142
{
11143-
fn = fnMap->add(name,fullName);
11143+
fn = fnMap->add(name);
1114411144
fn->push_back(std::move(fd));
1114511145
}
1114611146
}
@@ -11228,7 +11228,7 @@ void readFileOrDirectory(const QCString &s,
1122811228
auto fd = createFileDef(dirPath+"/",name);
1122911229
if (!name.empty())
1123011230
{
11231-
FileName *fn = fnMap->add(name,filePath);
11231+
FileName *fn = fnMap->add(name);
1123211232
fn->push_back(std::move(fd));
1123311233
}
1123411234
}
@@ -12424,12 +12424,6 @@ void searchInputFiles()
1242412424
}
1242512425

1242612426
// Sort the FileDef objects by full path to get a predictable ordering over multiple runs
12427-
std::stable_sort(Doxygen::inputNameLinkedMap->begin(),
12428-
Doxygen::inputNameLinkedMap->end(),
12429-
[](const auto &f1,const auto &f2)
12430-
{
12431-
return qstricmp_sort(f1->fullName(),f2->fullName())<0;
12432-
});
1243312427
for (auto &fileName : *Doxygen::inputNameLinkedMap)
1243412428
{
1243512429
if (fileName->size()>1)
@@ -12440,6 +12434,12 @@ void searchInputFiles()
1244012434
});
1244112435
}
1244212436
}
12437+
std::stable_sort(Doxygen::inputNameLinkedMap->begin(),
12438+
Doxygen::inputNameLinkedMap->end(),
12439+
[](const auto &f1,const auto &f2)
12440+
{
12441+
return qstricmp_sort(f1->front()->absFilePath(),f2->front()->absFilePath())<0;
12442+
});
1244312443
if (Doxygen::inputNameLinkedMap->empty())
1244412444
{
1244512445
warn_uncond("No files to be processed, please check your settings, in particular INPUT, FILE_PATTERNS, and RECURSIVE\n");

src/filename.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ class FileDef;
2929
class FileName : public std::vector< std::unique_ptr<FileDef> >
3030
{
3131
public:
32-
FileName(const QCString &nm,const QCString &fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {}
32+
explicit FileName(const QCString &nm) : m_name(nm) {}
3333
QCString fileName() const { return m_name; }
34-
QCString fullName() const { return m_fName; }
35-
QCString path() const { return m_pathName; }
3634

3735
private:
3836
QCString m_name;
39-
QCString m_fName;
40-
QCString m_pathName;
4137
};
4238

4339
//! Custom combined key compare and hash functor that uses a lower case string in

src/tagreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root)
16761676
}
16771677
else
16781678
{
1679-
mn = Doxygen::inputNameLinkedMap->add(tfi->name,fullName);
1679+
mn = Doxygen::inputNameLinkedMap->add(tfi->name);
16801680
mn->push_back(std::move(fd));
16811681
}
16821682
buildMemberList(fe,tfi->members);

0 commit comments

Comments
 (0)