Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbreak Doxygen configuration #559

Merged
merged 4 commits into from
Dec 4, 2019
Merged

Unbreak Doxygen configuration #559

merged 4 commits into from
Dec 4, 2019

Conversation

ilammy
Copy link
Collaborator

@ilammy ilammy commented Dec 3, 2019

We have a Doxyfile and a lot of Doxygen-compatible comments in Themis codebase. However, they are currently broken. Update Doxyfile and unbreak Doxygen configuration.

Now running doxygen from the project root is actually useful.

Before:

doxygen before

After:

doxygen after

It does not look as good as it could, there are many missing files, some docs are not pretty, etc. But at least they can be viewed now and we can work on improvements. Some of the most obnoxious ones are fixed right here.

Checklist

  • Change is covered by automated tests (it is not)
  • Benchmark results are attached (not applicable)
  • The coding guidelines are followed
  • Public API has proper documentation
  • Example projects and code samples are updated if needed (not applicable)
  • Changelog is updated if needed (not applicable)

PROJECT_NAME goes into the title, don't scream with ALL CAPS here.
PROJECT_BRIEF also goes into the title. Trailing dots are not used
in English titles and do not look good.

JAVADOC_AUTOBRIEF set to YES because writing "@brief" is excessive
and some members do not use it (resulting in missing short docs).

OPTIMIZE_OUTPUT_FOR_C so that we don't have references to classes
and things like that. We use Doxygen for Themis Core.

TYPEDEF_HIDES_STRUCT set to YES because Themis code style uses
typedefs instead of C tags, so we prefer to not mention them.

INPUT should include the top-level README file and only Themis Core.
USE_MDFILE_AS_MAINPAGE makes sure that README is displayed.
FILE_PATTERNS have to be set explicitly, otherwise Doxygen does not
see our source code.

MACRO_EXPANSION, EXPAND_ONLY_PREDEF, and PREDEFINED are used to
hide pervasive API exporting macros from Doxygen output.
Write these macros in a single line so that Doxygen preprocessor
strips them and does not break function definitions because of that.
@ilammy ilammy added the docs 📚 Documentation, both offline and online label Dec 3, 2019
@ilammy ilammy requested a review from vixentael December 3, 2019 08:17
Copy link
Collaborator

@Lagovas Lagovas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -154,8 +154,7 @@ themis_status_t themis_secure_message_verify(const uint8_t* public_key,
* storage then THEMIS_BUFFER_TOO_SMALL will return and wrapped_message_length will store length of
* buffer needed for wrapped message store
*/
DEPRECATED("use 'themis_secure_message_encrypt' with private and public keys to encrypt message, "
"or 'themis_secure_message_sign' with private key to sign message")
DEPRECATED("use 'themis_secure_message_encrypt' with private and public keys to encrypt message, or 'themis_secure_message_sign' with private key to sign message")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doxygen doesn't support multiline macro/function calls?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, not really. It tries really hard to emulate C preprocessor, but sometimes this leads to poor results. Doxygen does preprocessing mostly to exclude parts of the file due to conditional compilation.

Here the THEMIS_API and DEPRECATED macros are considered a part of return type and they get mentioned in function signature, and this breaks Doxygen parser leading to funny output:

Screen Shot 2019-12-03 at 16 46 00

Strictly speaking, they are a part of the signature, but we’re not really interested in this when generating API documentation. Thus we’d like to remove both of them.

Enabling EXPAND_ONLY_PREDEF and adding THEMIS_API to PREDEFINED gets rid of it. DEPRECATED macros will be ignored if they are written in one line, thanks to SKIP_FUNCTION_MACROS:

themis/Doxyfile

Lines 1987 to 1995 in c8a469f

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
# an all uppercase name, and do not end with a semicolon. Such function macros
# are typically used for boiler-plate code, and will confuse the parser if not
# removed.
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
SKIP_FUNCTION_MACROS = YES

@vixentael
Copy link
Contributor

Thank you @ilammy for taking care! Merge 'em all!

@ilammy ilammy merged commit 58f1b78 into cossacklabs:master Dec 4, 2019
@ilammy ilammy deleted the doxygen branch December 4, 2019 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs 📚 Documentation, both offline and online
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants