From 7acba2f316a6e8f02364d76ab96b7ff9e739aec1 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 15:49:20 +0100 Subject: issue #7348 Better warning in case a graph would have been to large --- src/classdef.cpp | 3 ++- src/dotcallgraph.cpp | 9 +++++++-- src/dotcallgraph.h | 1 + src/dotclassgraph.cpp | 7 ++++++- src/dotclassgraph.h | 1 + src/dotincldepgraph.cpp | 8 ++++++-- src/dotincldepgraph.h | 1 + src/filedef.cpp | 6 ++++-- src/memberdef.cpp | 6 ++++-- 9 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/classdef.cpp b/src/classdef.cpp index cee8be9..fd24f0b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1706,7 +1706,8 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const DotClassGraph inheritanceGraph(this,Inheritance); if (inheritanceGraph.isTooBig()) { - warn_uncond("Inheritance graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Inheritance graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!inheritanceGraph.isTrivial()) { diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index 15d408a..b024f09 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -212,6 +212,11 @@ bool DotCallGraph::isTrivial() const bool DotCallGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes()>=DOT_GRAPH_MAX_NODES; } + +int DotCallGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; +} + diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index c96b9cf..bba976c 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -28,6 +28,7 @@ class DotCallGraph : public DotGraph ~DotCallGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName, const char *relPath,bool writeImageMap=TRUE, diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index 3f5d228..da272b4 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -420,13 +420,18 @@ bool DotClassGraph::isTrivial() const bool DotClassGraph::isTooBig() const { + return numNodes()>=DOT_GRAPH_MAX_NODES; +} + +int DotClassGraph::numNodes() const +{ int numNodes = 0; numNodes+= m_startNode->children() ? m_startNode->children()->count() : 0; if (m_graphType==Inheritance) { numNodes+= m_startNode->parents() ? m_startNode->parents()->count() : 0; } - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes; } DotClassGraph::~DotClassGraph() diff --git a/src/dotclassgraph.h b/src/dotclassgraph.h index b3b9291..1874f54 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -28,6 +28,7 @@ public: ~DotClassGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 23588db..05a96d9 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -213,8 +213,12 @@ bool DotInclDepGraph::isTrivial() const bool DotInclDepGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=Config_getInt(DOT_GRAPH_MAX_NODES); + return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES); +} + +int DotInclDepGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; } void DotInclDepGraph::writeXML(FTextStream &t) diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index b664ccb..5807ce8 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -32,6 +32,7 @@ class DotInclDepGraph : public DotGraph bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; void writeXML(FTextStream &t); void writeDocbook(FTextStream &t); diff --git a/src/filedef.cpp b/src/filedef.cpp index f00c82b..346fb62 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -664,7 +664,8 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { - warn_uncond("Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { @@ -688,7 +689,8 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { - warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 9b6967b..840dd78 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -2877,7 +2877,8 @@ void MemberDefImpl::_writeCallGraph(OutputList &ol) const DotCallGraph callGraph(this,FALSE); if (callGraph.isTooBig()) { - warn_uncond("Call graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callGraph.isTrivial()) { @@ -2900,7 +2901,8 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const DotCallGraph callerGraph(this, TRUE); if (callerGraph.isTooBig()) { - warn_uncond("Caller graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callerGraph.isTrivial()) { -- cgit v0.12