In some cases you may want to substitute a macro name or function by something else without exposing the result to further macro substitution. Note also that preprocessor definitions that are normally defined automatically by the preprocessor (like _cplusplus), have to be defined by hand with doxygen's parser (this is done because these defines are often platform/compiler specific). Note that the PREDEFINED tag accepts function like macro definitions (like DECLARE_INTERFACE ), normal macro substitutions (like PURE and THIS) and plain defines (like _cplusplus). Virtual HRESULT QueryInterface ( REFIID iid, void **ppv) = 0 We can make sure that the proper result is fed to doxygen's parser: /*! A reference to an IID */ "STDMETHOD(result,name)=virtual result name" \ PREDEFINED = "DECLARE_INTERFACE(name)=class name" \ Without macro expansion doxygen will get confused, but we may not want to expand the REFIID macro, because it is documented and the user that reads the documentation should use it when implementing the interface.īy setting the following in the configuration file: ENABLE_PREPROCESSING = YES STDMETHOD(HRESULT,QueryInterface) (THIS_ REFIID iid, void **ppv) PURE Similar settings can be used for removing _attribute_ expressions from the input: ENABLE_PREPROCESSING = YESįor a more complex example, suppose you have the following obfuscated code fragment of an abstract base class called IUnknown: /*! A reference to an IID */ This will make sure the _declspec(dllexport) is removed before doxygen parses the source code. To help doxygen one typically uses the following preprocessor settings: ENABLE_PREPROCESSING = YES When nothing is done, doxygen will be confused and see _declspec as some sort of function. extern "C" void _declspec(dllexport) ErrorMsg( String aMessage.) The same goes for GNU's _attribute_ extension. For this you have to set the EXPAND_ONLY_PREDEF tag to YES and specify the macro definitions after the PREDEFINED or EXPAND_AS_DEFINED tag.Ī typically example where some help from the preprocessor is needed is when dealing with the language extension from Microsoft: _declspec. Therefore, doxygen also allows you to expand only those defines that you explicitly specify. Note that doxygen will now expand all macro definitions (recursively if needed). Then the result after preprocessing becomes: #define VERSION In case you want to expand the CONST_STRING macro, you should set the MACRO_EXPANSION tag in the configuration file to YES. In the case above doxygen will then read both statements, i.e.: static CONST_STRING version = "2.xx" You can disable all preprocessing by setting ENABLE_PREPROCESSING to NO in the configuration file. Then by default doxygen will feed the following to its parser: #define VERSION So if you have the following code fragment #define VERSION 200 That is, it evaluates conditional compilation statements (like #if) and evaluates macro definitions, but it does not perform macro expansion. Source files that are used as input to doxygen can be parsed by doxygen's built-in C-preprocessor.īy default doxygen does only partial preprocessing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |