Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen report "potential recursive class relation"

Tags:

c++

doxygen

I have a C++ templated class base::Foo<class T>, and I have in another file a class base::bar::Foo : public base::Foo<Baz>. Doxygen seems not to like this, as it throws an error

<unknown>:1: Detected potential recursive class relation between class snLib::mocTwod::DsaCell and base class DsaCell< snLib::mocTwod::ProblemTraits, detLib::cellDiffusionTwod::ProblemTraits >!

Is there a way to prevent this from occurring? Doxygen's documentation doesn't talk about this error or anything about "potential recursive class relation"s.

The "base" class:

/*! \file snlib/DsaCell.hpp
 */
#ifndef snlib_DsaCell_hpp
#define snlib_DsaCell_hpp
#include "Dsa.hpp"

namespace snLib {
/*!
 * \brief  Implementation of naive cell-centered DSA
 */
template <class HoTraits_T, class LoTraits_T>
class DsaCell : public snLib::Dsa< HoTraits_T, LoTraits_T >
{
    [snip]
};
}
#endif

one of its descendants that is causing the problem:

/*! \file snlib/twod/moc/DsaCell.hpp
 */
#ifndef snlib_twod_moc_DsaCell_hpp
#define snlib_twod_moc_DsaCell_hpp
#include "snlib/DsaCell.hpp"

#include "ProblemTraits.hpp"
#include "detlib/twod/celldiffusion/ProblemTraits.hpp"

namespace snLib { namespace mocTwod {
/*!
 * \brief Inconsistent DSA for MOC
 */
class DsaCell : public snLib::DsaCell<
                        snLib::mocTwod::ProblemTraits,
                        detLib::cellDiffusionTwod::ProblemTraits
                        >
{
    [snip]
};
} } // end namespace snLib::mocTwod
#endif

My Doxygen configuration file has many options set, including the path configuration: STRIP_FROM_PATH (set to the root directory), STRIP_FROM_INC_PATH (same), INCLUDE_PATH (same).

Edit: it looks like the error was actually thrown in another Doxyfile that used the XML tags generated by the one with the conflicting name, so the problem was related to that. Anyway, I just renamed the base class to something else and all was well again.

like image 547
Seth Johnson Avatar asked Mar 02 '11 04:03

Seth Johnson


1 Answers

Doxygen has a function that check whether classes A and B have an inheritance relation (either direct or indirect), which is recursive. The function check the recursion for a limit depth of 256.

Probably doxygen is confused with your code (since the name coincidence) and think that class A depends on B and B depends on A again.

It could be a Doxygen bug, but the best approach can be rename the class.

like image 200
robermorales Avatar answered Nov 02 '22 21:11

robermorales