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

OSSL_TRACE: enhance documentation and fix doc-nit errors #9224

Closed
wants to merge 3 commits into from

Conversation

mspncp
Copy link
Contributor

@mspncp mspncp commented Jun 23, 2019

OSSL_TRACE: enhance documentation and fix doc-nit errors

- Add the following macros to the NAME section:

  - with synopsis
        OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE_ENABLED
  - without synopsis
        OSSL_TRACEV (helper macro, not intended for public use)
        OSSL_TRACE[3-8] (omitted on purpose)

- Revise the NOTES section
Checklist

@mspncp mspncp added the branch: master Merge to master branch label Jun 23, 2019
- OpenSSL Tracing API

=head1 SYNOPSIS

=for comment generic
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this line disables the synopsis check completely, which is inconvenient when additional symbols are added later on to the pod file. Of course, I can remove the comment line temporarily to get the errors back, but it would be nicer if one could add a specific exclusion list (here: OSSL_TRACEV, OSSL_TRACE3, OSSL_TRACE4, ... OSSL_TRACE8 ).

@levitte do you think this would be a useful feature? If yes, I could raise an issue with a feature request for it.

Copy link
Member

Choose a reason for hiding this comment

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

I have had similar thoughts, but more on a section basis (and we should have our own keyword instead of piggy-backing on comment)

for openssl no-check NAME, SYNOPSIS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a feature request in #9226.

@@ -17,7 +23,13 @@ OSSL_TRACE_BEGIN, OSSL_TRACE_END, OSSL_TRACE1, OSSL_TRACE2, OSSL_TRACE9

/* trace group macros */
OSSL_TRACE_BEGIN(category) {
...
...
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Relative indentation was corrected from +3 to +4 characters.

BIO_dump(trace, somememory, somememory_l);
OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trace);
}
if (OSSL_trace_enabled(OSSL_TRACE_CATEGORY_TLS)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

1+4 (one space for perlpod, 4 spaces for C)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just noticed that the entire NOTES section needs an update. I'll put the pull request in WIP until it's done...

@mspncp mspncp changed the title OSSL_TRACE: fix doc-nit errors WIP: OSSL_TRACE: fix doc-nit errors Jun 23, 2019
@mspncp mspncp changed the title WIP: OSSL_TRACE: fix doc-nit errors WIP: OSSL_TRACE: add documentation and fix doc-nit errors Jun 23, 2019
@mspncp mspncp force-pushed the pr-fix-ossl-trace-doc-nits branch from 6a0fb8a to ef71d83 Compare June 23, 2019 23:16
@mspncp
Copy link
Contributor Author

mspncp commented Jun 23, 2019

I just noticed that the entire NOTES section needs an update.

Done. Taking the pr out of WIP again.

Please note the new commit message:

    OSSL_TRACE: enhance documentation and fix doc-nit errors
    
    - Add the following macros to the NAME section:
    
      - with synopsis
            OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE_ENABLED
      - without synopsis
            OSSL_TRACEV (helper macro, not intended for public use)
            OSSL_TRACE[3-8] (omitted on purpose)
    
    - Revise the NOTES section

@mspncp mspncp changed the title WIP: OSSL_TRACE: add documentation and fix doc-nit errors OSSL_TRACE: enhance documentation and fix doc-nit errors Jun 23, 2019
@mspncp mspncp requested a review from levitte June 23, 2019 23:22
- Add the following macros to the NAME section:

  - with synopsis
        OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE_ENABLED
  - without synopsis
        OSSL_TRACEV (helper macro, not intended for public use)
        OSSL_TRACE[3-8] (omitted on purpose)

- Revise the NOTES section
@@ -136,26 +152,71 @@ This will normally expand to:
} while (0);


C<OSSL_TRACE1()>, ... C<OSSL_TRACE9()> are one-shot macros which essentially wrap
a single BIO_printf() into a tracing group.
C<OSSL_TRACE()> and C<OSSL_TRACE1()>, C<OSSL_TRACE1()>, ... C<OSSL_TRACE9()> are
Copy link
Member

Choose a reason for hiding this comment

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

You repeat OSSL_TRACE1 twice here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


Internally, all one-shot macros are implemented using a generic C<OSSL_TRACEV()>
macro, since C90 does not support variadic macros. This helper macro has a rather
weird synopsis and is not intended to be used directly.
Copy link
Member

Choose a reason for hiding this comment

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

I'd make this stronger. Perhaps "must not be used directly".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... "must" sounds a bit too strong IMHO. Can we meet in the middle and say "should not be used directly"?

On one hand, I don't want to encourage using OSSL_TRACEV() by documenting it (mainly because of its odd synopsis), but on the other hand, I don't want to forbid it either. One valid use case for an application developer would be for example to add more macros OSSL_TRACE10(), ..., OSSL_TRACE11() along the lines of the existing ones.

(So it's more like "Use it at your own risk. We're unlikely to change it, but we don't advertise it as an official api.")

Copy link
Member

Choose a reason for hiding this comment

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

Its the last bit I was mostly worried about, i.e. people using it and expecting it to be stable. I'd be ok with "should", if there was something about it possibly changing in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helper macro is really unlikely to change, since the 'numbered' macros derived from it are officially documented and not allowed to change after their initial release. (Currently, the new TRACE api only exists on master.)

Copy link
Member

Choose a reason for hiding this comment

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

I strongly disagree with "must". These are public macros, we cannot dictate their use, only give the users a "fair warning". Our users often use more modern compilers.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, fair enough.

Copy link
Member

Choose a reason for hiding this comment

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

I like how fair we are 😉

@mspncp
Copy link
Contributor Author

mspncp commented Jun 24, 2019

Fixup pushed, see 91d0f49.

@mspncp mspncp added the approval: done This pull request has the required number of approvals label Jun 24, 2019
@mspncp
Copy link
Contributor Author

mspncp commented Jun 24, 2019

I pushed one final trivial fixup which I overlooked, see 74ca3d4

@mspncp
Copy link
Contributor Author

mspncp commented Jun 24, 2019

Merged to 6f92692, thanks!

@mspncp mspncp closed this Jun 24, 2019
levitte pushed a commit that referenced this pull request Jun 24, 2019
- Add the following macros to the NAME section:

  - with synopsis
        OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE_ENABLED
  - without synopsis
        OSSL_TRACEV (helper macro, not intended for public use)
        OSSL_TRACE[3-8] (omitted on purpose)

- Revise the NOTES section

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #9224)
@mspncp mspncp deleted the pr-fix-ossl-trace-doc-nits branch June 27, 2019 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: done This pull request has the required number of approvals branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants