[Doxygen-develop] [PATCH] [1/2] prototype mistaken as class constructor: recognize pointers
Brought to you by:
dimitri
From: Dave D. <do...@do...> - 2005-12-19 22:30:18
|
Symptom: Some function prototypes end up being treated as constructor calls. Example: /** \brief something */ typedef struct { int x; } t; extern t foo(struct t *); // declaration /** \brief something */ t foo(struct t * x) // definition Doxygen thinks that the declaration is actually a variable being created with a call to a constructor for type t. It ends up putting it in the "Variables" section. This patch adds a check of the arguments being passed to the function that might be a constructor. If any argument ends in an asterisk, it must be a bare pointer type with no parameter name and therefore this must be a function prototype instead of a constructor call. Index: doxygen-1.4.5/src/doxygen.cpp =================================================================== --- doxygen-1.4.5.orig/src/doxygen.cpp 2005-11-11 12:07:22.000000000 -0500 +++ doxygen-1.4.5/src/doxygen.cpp 2005-11-11 12:20:06.000000000 -0500 @@ -1972,6 +1972,13 @@ result=FALSE; // arg type is a known type goto done; } + // If the argument is a pointer type, then this is a function prototype. + if (a->type.find('*',a->type.length()-1)!=-1) + { + //printf("%s:%d: false (arg is a pointer)\n",__FILE__,__LINE__); + result=FALSE; + goto done; + } if (a->type.find(initChars)==0) { result=TRUE; // argument type starts with typical initializer char |