Excluding specific headers from dependency graphs
Asked Answered
T

1

15

I am not sure whether this is to be a doxygen or a dot question, but here goes.

In my project I have many files that need to include common headers such stdlib.h, stdint.h, and so on. When I ask doxygen to generate the dependency graphs for each of my files, this leads to a lot of clutter and noise as the drawing tool always reuses existing nodes and never duplicates them.

Can I somehow tell doxygen to exclude a set of headers from the generated graph, simply ignore them completely? I'd prefer not to resort to horrible preprocessor tricks to delete the #include's when building the documentation.

I found a couple mailing list threads of someone asking the same thing, but they either got no reply or a suggestion about playing with the dependency graph's maximum depth, which simply does not work, as the headers can be included at any depth (so doing that ends up munching my own local headers).

Tymothy answered 22/7, 2013 at 9:42 Comment(0)
S
12

Bit of a long shot this because my doxygen is a bit rusty, but have you tried

\cond \endcond

around the header section. (Conditional inclusion, but blank = false)

For example, the standard C or C++ headers usually clutter the dependency graph pretty much, so you might want to remove them from that graph (as their usage can be considered as part of the language). You can do that on a file basis like this (tested with 1.8.7):

/// \cond
#include <iostream>
#include <string>   // whatever...
/// \endcond

In other instances this excludes the code between the markers from being visible to doxygen, but I'm unsure it will work for this instance.

Spectrochemistry answered 26/7, 2013 at 16:9 Comment(6)
It worked! A bit bulky but I don't mind wrapping a few headers in some doxygen tags. Thanks so much :)Tymothy
Great! Just back from vacation and was wondering if this had been useful. Thanks for the feedback - and the bonus :)Spectrochemistry
Am I missing something about this? I tried //@cond #include <stdint.h> //@endcond but that didn't work. The same worked to remove a function from the file. Do I need to modify the stdint file?? Thanks.Muff
@user1050181 I think you need doxygen comments, so /// (triple slash) or /** */? Also the file needs to be readable by doxygen so it needs an \@file somewhere in a doxygen comment tooTymothy
I just checked, worked like a charm (even on files not referenced with a @file command, as standard language headers are). Edited with an example to make it clearer, for future readers.Shuping
Is this still the only way? I think ignoring system includes in a dependency graph is a pretty basic feature, maybe to the point where it should be default behavior. Redundant system includes are harmless, and a system header isn't going to include your user files. If you're looking for cyclic dependencies, trying to refactor or examine your project structure, etc. these aren't just clutter, they usually make a decent embedding impossible and you get graph spaghetti instead.Connie

© 2022 - 2024 — McMap. All rights reserved.