mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Merge #17873: doc: Add to Doxygen documentation guidelines
c902c4c0c6
doc: Add to Doxygen documentation guidelines (Jon Layton) Pull request description: Completes the up-for-grabs PR #16948. Changes can be tested here: [doc/developer-notes.md](https://github.com/jonatack/bitcoin/blob/doxygen-developer-notes-improvements/doc/developer-notes.md) Co-authored-by: Jon Layton <me@jonl.io> ACKs for top commit: fanquake: ACKc902c4c0c6
- quick read, checked the new links work. laanwj: ACKc902c4c0c6
Tree-SHA512: 3b4cebba23061ad5243b2288c2006bf8527e74c689223825f96a44014875d15b2ab6ff54b8aa342ca657a14cf6ce3ab7d6e25bea5befd91162bc2645a74ddb7e
This commit is contained in:
commit
ceb789cf3a
1 changed files with 57 additions and 19 deletions
|
@ -9,6 +9,7 @@ Developer Notes
|
||||||
- [Coding Style (C++)](#coding-style-c)
|
- [Coding Style (C++)](#coding-style-c)
|
||||||
- [Coding Style (Python)](#coding-style-python)
|
- [Coding Style (Python)](#coding-style-python)
|
||||||
- [Coding Style (Doxygen-compatible comments)](#coding-style-doxygen-compatible-comments)
|
- [Coding Style (Doxygen-compatible comments)](#coding-style-doxygen-compatible-comments)
|
||||||
|
- [Generating Documentation](#generating-documentation)
|
||||||
- [Development tips and tricks](#development-tips-and-tricks)
|
- [Development tips and tricks](#development-tips-and-tricks)
|
||||||
- [Compiling for debugging](#compiling-for-debugging)
|
- [Compiling for debugging](#compiling-for-debugging)
|
||||||
- [Compiling for gprof profiling](#compiling-for-gprof-profiling)
|
- [Compiling for gprof profiling](#compiling-for-gprof-profiling)
|
||||||
|
@ -35,6 +36,9 @@ Developer Notes
|
||||||
- [Source code organization](#source-code-organization)
|
- [Source code organization](#source-code-organization)
|
||||||
- [GUI](#gui)
|
- [GUI](#gui)
|
||||||
- [Subtrees](#subtrees)
|
- [Subtrees](#subtrees)
|
||||||
|
- [Upgrading LevelDB](#upgrading-leveldb)
|
||||||
|
- [File Descriptor Counts](#file-descriptor-counts)
|
||||||
|
- [Consensus Compatibility](#consensus-compatibility)
|
||||||
- [Scripted diffs](#scripted-diffs)
|
- [Scripted diffs](#scripted-diffs)
|
||||||
- [Suggestions and examples](#suggestions-and-examples)
|
- [Suggestions and examples](#suggestions-and-examples)
|
||||||
- [Release notes](#release-notes)
|
- [Release notes](#release-notes)
|
||||||
|
@ -138,12 +142,17 @@ For example, to describe a function use:
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
/**
|
/**
|
||||||
* ... text ...
|
* ... Description ...
|
||||||
* @param[in] arg1 A description
|
*
|
||||||
* @param[in] arg2 Another argument description
|
* @param[in] arg1 input description...
|
||||||
* @pre Precondition for function...
|
* @param[in] arg2 input description...
|
||||||
|
* @param[out] arg3 output description...
|
||||||
|
* @return Return cases...
|
||||||
|
* @throws Error type and cases...
|
||||||
|
* @pre Pre-condition for function...
|
||||||
|
* @post Post-condition for function...
|
||||||
*/
|
*/
|
||||||
bool function(int arg1, const char *arg2)
|
bool function(int arg1, const char *arg2, std::string& arg3)
|
||||||
```
|
```
|
||||||
|
|
||||||
A complete list of `@xxx` commands can be found at http://www.doxygen.nl/manual/commands.html.
|
A complete list of `@xxx` commands can be found at http://www.doxygen.nl/manual/commands.html.
|
||||||
|
@ -158,44 +167,73 @@ To describe a class, use the same construct above the class definition:
|
||||||
* @see GetWarnings()
|
* @see GetWarnings()
|
||||||
*/
|
*/
|
||||||
class CAlert
|
class CAlert
|
||||||
{
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To describe a member or variable use:
|
To describe a member or variable use:
|
||||||
```c++
|
```c++
|
||||||
int var; //!< Detailed description after the member
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
|
||||||
```c++
|
|
||||||
//! Description before the member
|
//! Description before the member
|
||||||
int var;
|
int var;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
```c++
|
||||||
|
int var; //!< Description after the member
|
||||||
|
```
|
||||||
|
|
||||||
Also OK:
|
Also OK:
|
||||||
```c++
|
```c++
|
||||||
///
|
///
|
||||||
/// ... text ...
|
/// ... Description ...
|
||||||
///
|
///
|
||||||
bool function2(int arg1, const char *arg2)
|
bool function2(int arg1, const char *arg2)
|
||||||
```
|
```
|
||||||
|
|
||||||
Not OK (used plenty in the current source, but not picked up):
|
Not picked up by Doxygen:
|
||||||
```c++
|
```c++
|
||||||
//
|
//
|
||||||
// ... text ...
|
// ... Description ...
|
||||||
//
|
//
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also not picked up by Doxygen:
|
||||||
|
```c++
|
||||||
|
/*
|
||||||
|
* ... Description ...
|
||||||
|
*/
|
||||||
|
```
|
||||||
|
|
||||||
A full list of comment syntaxes picked up by Doxygen can be found at http://www.doxygen.nl/manual/docblocks.html,
|
A full list of comment syntaxes picked up by Doxygen can be found at http://www.doxygen.nl/manual/docblocks.html,
|
||||||
but the above styles are favored.
|
but the above styles are favored.
|
||||||
|
|
||||||
Documentation can be generated with `make docs` and cleaned up with `make clean-docs`. The resulting files are located in `doc/doxygen/html`; open `index.html` to view the homepage.
|
Recommendations:
|
||||||
|
|
||||||
Before running `make docs`, you will need to install dependencies `doxygen` and `dot`. For example, on macOS via Homebrew:
|
- Avoiding duplicating type and input/output information in function
|
||||||
```
|
descriptions.
|
||||||
brew install graphviz doxygen
|
|
||||||
```
|
- Use backticks (``) to refer to `argument` names in function and
|
||||||
|
parameter descriptions.
|
||||||
|
|
||||||
|
- Backticks aren't required when referring to functions Doxygen already knows
|
||||||
|
about; it will build hyperlinks for these automatically. See
|
||||||
|
http://www.doxygen.nl/manual/autolink.html for complete info.
|
||||||
|
|
||||||
|
- Avoid linking to external documentation; links can break.
|
||||||
|
|
||||||
|
- Javadoc and all valid Doxygen comments are stripped from Doxygen source code
|
||||||
|
previews (`STRIP_CODE_COMMENTS = YES` in [Doxyfile.in](doc/Doxyfile.in)). If
|
||||||
|
you want a comment to be preserved, it must instead use `//` or `/* */`.
|
||||||
|
|
||||||
|
### Generating Documentation
|
||||||
|
|
||||||
|
The documentation can be generated with `make docs` and cleaned up with `make
|
||||||
|
clean-docs`. The resulting files are located in `doc/doxygen/html`; open
|
||||||
|
`index.html` in that directory to view the homepage.
|
||||||
|
|
||||||
|
Before running `make docs`, you'll need to install these dependencies:
|
||||||
|
|
||||||
|
Linux: `sudo apt install doxygen graphviz`
|
||||||
|
|
||||||
|
MacOS: `brew install doxygen graphviz`
|
||||||
|
|
||||||
Development tips and tricks
|
Development tips and tricks
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue