Doxygen EXTRACT_ALL=NO does not work - doxygen

I have the following Problem using doxygen in an C project. I have many internal structures that are not documented. Therefore it set EXTRACT_ALL=NO in my Doxyfile. Unfortunately doxygen still extracts some of them. Here is a minimal working example. Suppose the following header file:
#ifndef HASHTABLE_H
# define HASHTABLE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void* object;
typedef char *(*object_getname)( object obj);
typedef void (*object_free)( object obj);
typedef mess_int_t (*object_hash)( char *name, mess_int_t size);
typedef struct {
hashtable_entry *next;
object *obj;
} hashtable_entry;
typedef struct {
object_getname name;
object_free freigabe;
object_hash hash;
mess_int_t size;
hashtable_entry **hashtable;
} hashtable_t;
typedef hashtable_t * hashtable;
#ifdef __cplusplus
}
#endif
#endif
and the following options set in the Doxyfile:
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
But in the generate Data structure list both structures are listed. Some other undocumented structures defined in the same way in other files are not listed as I expect it from the description of EXTRACT_ALL=NO. Why does doxygen extract some and others not?
The whole doxyfile is available at: http://pastebin.com/J7c9BbvW
I am using doxygen 1.8.5

The answer of the problem is, like we already discussed it in the above comments, that the following setup works:
EXPORT_ALL=NO
in the Doxyfile prevents doxygen only extract data structures from header files instead of all source files.
Setting
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
disables the listing of undocumented structures in the header files.

ENABLE_PREPROCESSING = NO
Unfortunately, doxygen does not parse multi-including header files protect:
#ifndef HASHTABLE_H
# define HASHTABLE_H

Related

In Doxygen for a C++ project how do I get documentation for member functions that are #included in this nonstandard way?

I have a class that has a #include inside it containing the member function declarations, like this:
class PContextActions_t {
public:
#define PARG blah...
#include "pActionDecls.h"
#undef PARG
#define PARG
#include "pActionDecls.h"
#undef PARG
void OtherFuncs(); /// Another function
};
because they need to be declared twice with different arguments. When I run doxygen on this project I get documentation for OtherFuncs(), but not for any of the functions declared in pActionDecls.
What can I do about this? I've tried:
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
CLANG_ASSISTED_PARSING = YES

C++ - Why do I have to include .cpp file along with/ instead of .h file to acces the value of a global variable in the following case?

I am trying to properly declare and define global variables in separate files and include them in a third file which deals with class declaration.
The three files are:
1) global.h
#ifndef GLOBAL_H_INCLUDED
#define GLOBAL_H_INCLUDED
extern const int marker_num;
extern const int dim;
using namespace std;
#endif // GLOBAL_H_INCLUDED
2) global.cpp
#include <iostream>
#include <cstdio>
#include <cmath>
#include "global.h"
#include "WorldState.h"
#include "Robot.h"
#include "Sensor.h"
#include "Marker.h"
constexpr const int marker_num = 10;
constexpr const int dim = (2 * marker_num) + 3;
3) WorldState.h
#ifndef WORLDSTATE_H
#define WORLDSTATE_H
#include "global.h"
#include "global.cpp"
class WorldState{
public:
WorldState(float a[], float b[dim][dim]);
get_wstate();
protected:
private:
float w_state[];
float covar_matrix[dim][dim];
};
#endif // WORLDSTATE_H
I am using the global variable dim to declare and define a multidimensional array. I have declared dim inside global.h and defined it inside global.cpp. Now, I have a class called WorldState and inside its header, I am using dim. If I comment out #include "global.cpp", it throws the following error:
C:\Users\syamp\Documents\codeblocks\slam\WorldState.h|10|error: array bound is not an integer constant before ']' token
My understanding is that including the .h file includes the corresponding .cpp as well, and that all declarations should be inside .h and all definitions should be inside .cpp. However, it doesn't seem to work in this case.
1) If I decide to include global.cpp file inside WorldState.h, isn't it bad programming practice? I am trying to write a good code not just a code that works.
2) An alternative is to define values of variable(s) dim (and marker_num) inside global.h. Is that good programming practice?
3) I believe there is something that I am missing. Kindly suggest the best method to resolve this issue. I am using codeblocks and C++11. Thanks in advance.
I am using the global variable dim to declare and define a multidimensional array.
When declaring a fixed-length array at compile-time, the value(s) of its dimension(s) must be known to the compiler, but your separation prevents the value of dim from being known to the compiler at all, so dim cannot be used to specify fixed array dimensions. Any code that uses dim will just compile into a reference to it, and then the linker will resolve the references after compilation is done. Just because dim is declared as const does not make it suitable as a compile-time constant. To do that, you must define its value in its declaration, eg:
#ifndef GLOBAL_H_INCLUDED
#define GLOBAL_H_INCLUDED
static constexpr const int marker_num = 10;
static constexpr const int dim = (2 * marker_num);
using namespace std;
#endif // GLOBAL_H_INCLUDED
Otherwise, if you keep dim's declaration and definition in separate files, you will have to dynamically allocate the array at run-time instead of statically at compile-time.
I have declared dim inside global.h and defined it inside global.cpp.
That is fine for values you don't need to use until run-time. That will not work for values you need to use at compile-time.
My understanding is that including the .h file includes the corresponding .cpp as well
That is not even remotely true. The project/makefile brings in the .cpp file when invoking the compiler. The .h file has nothing to do with that.
that all declarations should be inside .h and all definitions should be inside .cpp.
Typically yes, but not always.
If I decide to include global.cpp file inside WorldState.h, isn't it bad programming practice?
Yes.
An alternative is to define values of variable(s) dim (and marker_num) inside global.h. Is that good programming practice?
Yes, if you want to use them where compile-time constants are expected.

Doxygen: Force undeclared functions to be documented

Our C++ program has a built-in script interface and is able to run scripts in it. The scripts have access to convenience functions provided by the C++ program.
Now we would like Doxygen to create the documentation of the functions the script has access to. Such a function declaration looks like this:
void ScriptEngine::load_script(const QString &path) {
//...
/*! \fn sleep_ms(const unsigned int timeout_ms)
\brief sleeps for timeout_ms milliseconds.
\param timeout_ms
*/
(*lua)["sleep_ms"] = [](const unsigned int timeout_ms) {
//sleep(timeout_ms)
};
//more convenience functions..
//...
}
Obviously Doxygen won't include a
sleep_ms(const unsigned int timeout_ms)
into the documentation. Is there a way to to tell Doxygen to do so?
Do this:
Add the following line to your Doxyfile:
PREDEFINED = _DOXYGEN_
Make sure the ENABLE_PREPROCESSING tag in the Doxyfile is set to YES.
Put your declarations and documentation for the undeclared functions inside an #ifdef _DOXYGEN_ section.
#ifdef _DOXYGEN_
/*! \fn sleep_ms(const unsigned int timeout_ms)
\brief sleeps for timeout_ms milliseconds.
\param timeout_ms
*/
void sleep_ms(const unsigned int timeout_ms);
#endif
Don't put the above code inside a method or function such as ScriptEngine::load_script(), as you previously tried. And don't put it inside a namespace or class, unless in fact the function being declared is a member of that namespace or class.
With this method, your declarations will not create linker errors during a normal build, but will be seen by Doxygen.
See Also
http://www.doxygen.nl/manual/config.html#cfg_predefined

Doxygen XML output: <references> missing for global variable

I am missing the
<references>
tags for global variables if the functions using them are defined in the same source file. They are there if I define the global variable in a different source file. Is there any known solution to this? The code is C for an embedded system.
Update:
I have narrowed it down to this: If the function references a member of the global struct, there will be only a reference to the typedef member, not a reference to the variable:
test.h
typedef struct
{
int b;
} a_S;
extern a_S a;
test1.c
#include "test.h"
a_S a;
void UseA1(void)
{
a_S *ptrA = &a; /* working, "UseA1" will reference "a" in the doxygen xml output */
}
void UseA2(void)
{
a.b = 0; /* not working, "UseA2" will NOT reference "a" in the doxygen xml output */
}
But only if the variable is defined in the same source file. If it is defined in another source file, there will be the reference to the variable as well as the reference to the typedef member:
test_data.c
#include "test.h"
a_S a;
test2.c
#include "test.h"
void UseA1(void)
{
a_S *ptrA = &a; /* still working */
}
void UseA2(void)
{
a.b = 0; /* working too! */
}
Unfortunately this is not an option because of our existing coding standards... Is there any way around this?

Extracting text from pdf using objective-c(libz.dylib)

I have imported the pdf.h file in my view controller class and tried calling
NSString *outPutString = convertPDF(pathToPdfFile);
but while building it gives me linker error:
_convertPDF" refrenced from: -[ScriptViewController searchBarSearchButtonClicked:] in ScriptViewController.o Symbol(s) not found
I have also included libz.dylib in my project.
What am I doing wrong?
Is there any step to be followed before building the project which includes c code?
Also one more question:
Will this search algorithm work on any PDF(simple and formatted pdfs).
What if you change the name of the .m file that calls pdf.h to xxxx.mm ? It's a c++ file.
I tested it and found out it works only with simple ascii pdfs.
Your must use the definition in the pdf.h
#if __cplusplus
extern "C" {
#endif
NSString* convertPDF(NSString * pathToFile);
#if __cplusplus
}
#endif
also in the implementation file *pdf.m*m use:
#if __cplusplus
extern "C" {
#endif
NSString* convertPDF(NSString * pathToFile);
#if __cplusplus
} //Extern C
#endif