-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
…gen output not reproducible
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> | |
virtual void setDiskName(const QCString &name) { m_diskName = name; } | ||
virtual void sort(); | ||
virtual void setParent(DirDef *parent); | ||
virtual void setDirCount(int count); | ||
virtual void setLevel(); | ||
virtual void addUsesDependency(const DirDef *usedDir,const FileDef *srcFd, | ||
const FileDef *dstFd,bool srcDirect, bool dstDirect); | ||
|
@@ -92,7 +93,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> | |
QCString m_shortName; | ||
QCString m_diskName; | ||
FileList m_fileList; // list of files in the group | ||
int m_dirCount; | ||
int m_dirCount = -1; | ||
int m_level; | ||
DirDef *m_parent; | ||
UsedDirLinkedMap m_usedDirs; | ||
|
@@ -107,8 +108,6 @@ DirDef *createDirDef(const QCString &path) | |
//---------------------------------------------------------------------- | ||
// method implementation | ||
|
||
static int g_dirCount=0; | ||
|
||
DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path) | ||
{ | ||
bool fullPathNames = Config_getBool(FULL_PATH_NAMES); | ||
|
@@ -132,7 +131,6 @@ DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path) | |
m_dispName = m_dispName.left(m_dispName.length()-1); | ||
} | ||
|
||
m_dirCount = g_dirCount++; | ||
m_level=-1; | ||
m_parent=0; | ||
} | ||
|
@@ -163,6 +161,11 @@ void DirDefImpl::setParent(DirDef *p) | |
m_parent=p; | ||
} | ||
|
||
void DirDefImpl::setDirCount(int count) | ||
{ | ||
m_dirCount=count; | ||
} | ||
|
||
void DirDefImpl::addFile(const FileDef *fd) | ||
{ | ||
m_fileList.push_back(fd); | ||
|
@@ -1006,7 +1009,6 @@ void buildDirectories() | |
{ | ||
for (const auto &fd : *fn) | ||
{ | ||
//printf("buildDirectories %s\n",qPrint(fd->name())); | ||
if (fd->getReference().isEmpty()) | ||
{ | ||
DirDef *dir; | ||
|
@@ -1051,7 +1053,17 @@ void buildDirectories() | |
std::sort(Doxygen::dirLinkedMap->begin(), | ||
Doxygen::dirLinkedMap->end(), | ||
[](const auto &d1,const auto &d2) | ||
{ return qstricmp(d1->shortName(),d2->shortName()) < 0; }); | ||
{ int i1 = qstricmp(d1->shortName(),d2->shortName()); | ||
int i2 = qstricmp(d1->name(),d2->name()); | ||
return i1 < 0 ? true : i2<0 ? true : false; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
albert-github
Collaborator
|
||
}); | ||
|
||
// set the directory count identifier | ||
int dirCount=0; | ||
for (const auto &dir : *Doxygen::dirLinkedMap) | ||
{ | ||
dir->setDirCount(dirCount++); | ||
} | ||
|
||
computeCommonDirPrefix(); | ||
} | ||
|
Please reconsider the implementation of this comparator. I fear it does not satisfy the "strict weak order" precondition of
std::sort
.The return statement basically means:
Such a straight-forward disjunction is typically inappropriate for
std::sort
. For example, if you have one value dA withshortName
A
andname
Z/A
and another value dB withshortName
B
andname
Y/B
, then both dA < dB and dB < dA are true according to this comparator. But this must not be the case for a "strict weak order".The correct return statement must be