Skip to content

Commit 7acba2f

Browse files
committed
issue #7348 Better warning in case a graph would have been to large
1 parent e43827f commit 7acba2f

9 files changed

+32
-10
lines changed

src/classdef.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,8 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
17061706
DotClassGraph inheritanceGraph(this,Inheritance);
17071707
if (inheritanceGraph.isTooBig())
17081708
{
1709-
warn_uncond("Inheritance graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data());
1709+
warn_uncond("Inheritance graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
1710+
name().data(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
17101711
}
17111712
else if (!inheritanceGraph.isTrivial())
17121713
{

src/dotcallgraph.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ bool DotCallGraph::isTrivial() const
212212

213213
bool DotCallGraph::isTooBig() const
214214
{
215-
int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0;
216-
return numNodes>=DOT_GRAPH_MAX_NODES;
215+
return numNodes()>=DOT_GRAPH_MAX_NODES;
217216
}
217+
218+
int DotCallGraph::numNodes() const
219+
{
220+
return m_startNode->children() ? m_startNode->children()->count() : 0;
221+
}
222+

src/dotcallgraph.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class DotCallGraph : public DotGraph
2828
~DotCallGraph();
2929
bool isTrivial() const;
3030
bool isTooBig() const;
31+
int numNodes() const;
3132
QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef,
3233
const char *path,const char *fileName,
3334
const char *relPath,bool writeImageMap=TRUE,

src/dotclassgraph.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,19 @@ bool DotClassGraph::isTrivial() const
419419
}
420420

421421
bool DotClassGraph::isTooBig() const
422+
{
423+
return numNodes()>=DOT_GRAPH_MAX_NODES;
424+
}
425+
426+
int DotClassGraph::numNodes() const
422427
{
423428
int numNodes = 0;
424429
numNodes+= m_startNode->children() ? m_startNode->children()->count() : 0;
425430
if (m_graphType==Inheritance)
426431
{
427432
numNodes+= m_startNode->parents() ? m_startNode->parents()->count() : 0;
428433
}
429-
return numNodes>=DOT_GRAPH_MAX_NODES;
434+
return numNodes;
430435
}
431436

432437
DotClassGraph::~DotClassGraph()

src/dotclassgraph.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class DotClassGraph : public DotGraph
2828
~DotClassGraph();
2929
bool isTrivial() const;
3030
bool isTooBig() const;
31+
int numNodes() const;
3132
QCString writeGraph(FTextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef,
3233
const char *path, const char *fileName, const char *relPath,
3334
bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1);

src/dotincldepgraph.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,12 @@ bool DotInclDepGraph::isTrivial() const
213213

214214
bool DotInclDepGraph::isTooBig() const
215215
{
216-
int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0;
217-
return numNodes>=Config_getInt(DOT_GRAPH_MAX_NODES);
216+
return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
217+
}
218+
219+
int DotInclDepGraph::numNodes() const
220+
{
221+
return m_startNode->children() ? m_startNode->children()->count() : 0;
218222
}
219223

220224
void DotInclDepGraph::writeXML(FTextStream &t)

src/dotincldepgraph.h

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class DotInclDepGraph : public DotGraph
3232
bool writeImageMap=TRUE,int graphId=-1);
3333
bool isTrivial() const;
3434
bool isTooBig() const;
35+
int numNodes() const;
3536
void writeXML(FTextStream &t);
3637
void writeDocbook(FTextStream &t);
3738

src/filedef.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol)
664664
DotInclDepGraph incDepGraph(this,FALSE);
665665
if (incDepGraph.isTooBig())
666666
{
667-
warn_uncond("Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data());
667+
warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
668+
name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
668669
}
669670
else if (!incDepGraph.isTrivial())
670671
{
@@ -688,7 +689,8 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol)
688689
DotInclDepGraph incDepGraph(this,TRUE);
689690
if (incDepGraph.isTooBig())
690691
{
691-
warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data());
692+
warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
693+
name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
692694
}
693695
else if (!incDepGraph.isTrivial())
694696
{

src/memberdef.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,8 @@ void MemberDefImpl::_writeCallGraph(OutputList &ol) const
28772877
DotCallGraph callGraph(this,FALSE);
28782878
if (callGraph.isTooBig())
28792879
{
2880-
warn_uncond("Call graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName()));
2880+
warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
2881+
qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
28812882
}
28822883
else if (!callGraph.isTrivial())
28832884
{
@@ -2900,7 +2901,8 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const
29002901
DotCallGraph callerGraph(this, TRUE);
29012902
if (callerGraph.isTooBig())
29022903
{
2903-
warn_uncond("Caller graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName()));
2904+
warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
2905+
qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
29042906
}
29052907
else if (!callerGraph.isTrivial())
29062908
{

0 commit comments

Comments
 (0)