How to help doxygen resolve "matches multiple directories"? - c++

In our project we have the following directory structure:
gambit
gambit/Utils
gambit/Utils/include/gambit/Utils
gambit/Utils/src
gambit/Core
gambit/Core/include/gambit/Core
gambit/Core/src
...
and so on. We do this so that in our files we have a clean include structure, like this:
#include "gambit/Utils/somefile.hpp"
where we compile with -Igambit/Utils/include and so forth. Now I would like to add doxygen documentation for each level in this directory tree. But how can I do it? I seem to be unable to avoid warning: \dir command matches multiple directories. For example, say I want to document the root directory, I seem to have no choice but to write e.g.
/// \dir gambit
/// \brief Root of GAMBIT source tree
///
/// Some long description
However that gives me warning: \dir command matches multiple directories because it matches the root directory, as well as both of these directories:
gambit/Utils/include/gambit
gambit/Core/include/gambit
But this is the root directory of the project, I cannot add anything to the path name to make it unique, because there is nothing to add! The same problem exists for the gambit/Utils and gambit/Core ambiguities. Is there some way to tell doxygen to prefer shorter matches? Currently it just seems to pick randomly between its options. Documenting the other directories with their long names doesn't seem to help, it looks like doxygen doesn't use that information to go back and resolve earlier conflicts.

Related

Disambiguate source files in Chapel build

Following up on this question about including source files. I am including a Chapel modules that contains one file called classes.chpl, but my current project also has a classes.chpl. What is the correct disambiguation pattern? When I do
chpl -M/path/src
it notes the conflict, then chooses the classes.chpl in the current directory. Should I compile the module for export as in this page or is there another pattern.
== UPDATE ==
The directory structure looks like
projA/alpha.chpl
/classes.chpl
projB/beta.chpl
/classes.chpl
Where each project depends on the classes in the respective classes.chpl file. Trying to compile projA I am currently using
chpl alpha.chpl -M../projB/
But this causes a conflict, as it tries to use projA/classes.cphl for the classes in both beta.chpl and alpha.chpl.
As described in the module search paths tech note, the Chapel compiler searches for user modules by, in this order:
Looking at .chpl files specified on the command line
Looking at other .chpl files in the directories containing the files specified on the command line
Looking at .chpl files in the paths specified via the -M option or the CHPL_MODULE_PATH environment variable
Since the compiler finds the classes.chpl from the project directory using rule 2, and only finds the /path/src/classes.chpl with rule 3, it chooses the one in the project directory. To get it to choose /path/src/classes.chpl instead, you can specify it on the command line so it is found with rule 1.
chpl mainModule.chpl /path/src/classes.chpl

How to use the exclude_files regex in cpplint?

I am using cpplint to check my sourcode agains the google style guide.
Cpplint's help says:
cpplint.py supports per-directory configurations specified in CPPLINT.cfg
files. CPPLINT.cfg file can contain a number of key=value pairs.
Currently the following options are supported:
"exclude_files" allows to specify a regular expression to be matched against
a file name. If the expression matches, the file is skipped and not run
through liner.
Example file:
filter=-build/include_order,+build/include_alpha
exclude_files=.*\.cc
The above example disables build/include_order warning and enables
build/include_alpha as well as excludes all .cc from being
processed by linter, in the current directory (where the .cfg
file is located) and all sub-directories.
How I use cpplint:
I use cpplint by this command to check all files in my source folder:
cpplint src/*.c
Well there is one special file foo.cc which must not be checked. So I tried to create a CPPLIN.cfg to use the exclude_files property. My file looks like this:
set noparent
filter=-build/include_dir
exclude_files=foo.cc
Nevertheless foo.cc is still checked.
What I have already tried to do:
I tried exclude_files=/.*\.cc/. This should exclude all files ending with *.cc. Nevertheless all files are still checked.
I tried to remove my filter from the file. This caused more errors than before. So I am now sure that my CPPLINT.cfg file is found by cpplint.
Question:
How to use the exclude_files regex in cpplint correctly?
Turns out apparently that the doc is wrong: exclude_files only excludes files in the same directory as CPPLINT.cfg, not in subdirectories. See https://github.com/google/styleguide/issues/220
So the solution would be to create src/CPPLINT.cfg and put exclude_files=.*\.cc in it.

How to add entire path into IAR

I just start to use IAR Embedded workbench and meet an issue now. What I need to do is to make a project via IAR with some specific file(.h and .c).
In Eclipse I can add a directory, and then when it compiles, it will scan every sub-directories in the directory to find the included files. I did the same in IAR, but it didn't work. The IAR only scans the directory I added in the 'preprocess' TAG, and it never scans the sub folders in it. Is there any way that can help me to let the IAR scan the 'entire directory', not only the current path?
I'm not sure if my description is accurate or not. Please let me know and help me with this issue.
Thank you so much!!!!!
Your description of the IAR C and C++ include file search is correct: you must explicitly include the directory. The compiler does not search subdirectories.
If the number of subdirectories makes entry in the [IDE Options> Preprocessor > Additional include directories] entry table unwieldy, you can place them in a separate text file and add "-f " in the extra options. Note that using that parameter you may want to use the $PROJ_DIR$ as a root for a relative path.
$PROJ_DIR$ does not seem to get expanded if you put the include directories in a file and use -f

How to add Stata programs in subdirectories?

I'd like to add a directory containing .ado files to the ado-path. This directory contains several subdirectories, corresponding to different projects. The .ado files are in these subdirectories.
However, when I type adopath + directory, commands in the .ado files are not recognized by Stata. I need to enter adopath + directory/subdirectory for each subdirectory. Is there a way around it?
Stata has a rule that in addition to the directories (etc.) explicitly named in the adopath, it will also look off those in subdirectories named by an individual letter for programs whose names begin with that letter.
Thus suppose you are invoking a command whatever and your named directories include c:\ado\plus. Stata's searches will include c:\ado\plus\w if that exists and a program file has not yet been found.
However, Stata doesn't promise to search in all subdirectories and it will pay attention to the initial letter of the program name.
Having .ado files specific to a project would best be accommodated by changing to the directory involved while working on that project. If you prefer not to do that, then you need to name specific directories fully if they don't match your adopath as extended by this single letter rule.
This is a matter of personal style, but I have never thought of any ados I wrote as specific to a particular project. Do-files yes, but not ados. But your project do-file might start with additions to the adopath and finish with reversing those.

Waf: Recursively collect source files and include paths

My C-gcc project structure is:
\Project\wscript (only one in project)
\Project\build\
\Project\Source\Module_1\foo.c
\Project\Source\Module_1\foo.h
\Project\Source\Module_1\dummy\foo2.h
\Project\Source\Module_n\bar.c
\Project\Source\Module_n\any dept...\bar.h
How can I recursively find all *.C files in 'Source' and add to
bld.program(source=HERE)?
instead of manually listing it:
bld.program(source="foo.c bar.c...", includes='..\\Source ..\\Source\Module_1')
Also how can I find every subfolders (preferably which has *.h) and append to include path?
Should I write my own finder functions in python and just pass it?
bld.program(source=SRCs_FOUND, includes=Paths_FOUND)
Will this cause any dependency problems in building?
In any modern IDE this thinking is common, drag one file to the Source tree, and it's automatically added to the build list. Thanks!
You can use globbing to scan the directories.
bld.program(
name = ...
....
source = bld.path.ant_glob('**/Source/*.C')
)
Just search for ant_glob in the waf book.