All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v2 1/8] qobject: Include API docs in docs/devel/qobject.html
Date: Thu, 19 Nov 2020 10:37:22 +0100	[thread overview]
Message-ID: <87wnyhd6wd.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201116224143.1284278-2-ehabkost@redhat.com> (Eduardo Habkost's message of "Mon, 16 Nov 2020 17:41:36 -0500")

Eduardo Habkost <ehabkost@redhat.com> writes:

> Render existing doc comments at docs/devel/qobject.html.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  docs/devel/index.rst       |  1 +
>  docs/devel/qobject.rst     | 11 +++++++++
>  include/qapi/qmp/qnum.h    |  4 +++-
>  include/qapi/qmp/qobject.h | 48 +++++++++++++++++++++++++-------------
>  qobject/qnum.c             | 19 ++++++++++++---
>  5 files changed, 63 insertions(+), 20 deletions(-)
>  create mode 100644 docs/devel/qobject.rst
>
> diff --git a/docs/devel/index.rst b/docs/devel/index.rst
> index f10ed77e4c..1cb39a9384 100644
> --- a/docs/devel/index.rst
> +++ b/docs/devel/index.rst
> @@ -35,3 +35,4 @@ Contents:
>     clocks
>     qom
>     block-coroutine-wrapper
> +   qobject
> diff --git a/docs/devel/qobject.rst b/docs/devel/qobject.rst
> new file mode 100644
> index 0000000000..4f192ced7c
> --- /dev/null
> +++ b/docs/devel/qobject.rst
> @@ -0,0 +1,11 @@
> +QObject API
> +===========
> +
> +.. kernel-doc:: include/qapi/qmp/qobject.h
> +
> +QNum module
> +-----------
> +
> +.. kernel-doc:: include/qapi/qmp/qnum.h
> +
> +.. kernel-doc:: qobject/qnum.c
> diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h
> index bbae0a5ec8..25f4733efc 100644
> --- a/include/qapi/qmp/qnum.h
> +++ b/include/qapi/qmp/qnum.h
> @@ -23,7 +23,9 @@ typedef enum {
>      QNUM_DOUBLE
>  } QNumKind;
>  
> -/*
> +/**
> + * DOC:
> + *
>   * QNum encapsulates how our dialect of JSON fills in the blanks left
>   * by the JSON specification (RFC 8259) regarding numbers.
>   *

Educate me: what does DOC: do?

> diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
> index fcfd549220..bdc33bdb65 100644
> --- a/include/qapi/qmp/qobject.h
> +++ b/include/qapi/qmp/qobject.h
> @@ -1,5 +1,5 @@
>  /*
> - * QEMU Object Model.
> + * QObject API
>   *
>   * Based on ideas by Avi Kivity <avi@redhat.com>
>   *
> @@ -10,24 +10,31 @@
>   *
>   * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
>   * See the COPYING.LIB file in the top-level directory.
> + */
> +
> +/**
> + * DOC: QObject Reference Counts Terminology
>   *
> - * QObject Reference Counts Terminology
> - * ------------------------------------
> + * Returning references
> + * --------------------
>   *
> - *  - Returning references: A function that returns an object may
> - *  return it as either a weak or a strong reference.  If the
> - *  reference is strong, you are responsible for calling
> - *  qobject_unref() on the reference when you are done.
> + * A function that returns an object may return it as either a
> + * weak or a strong reference.  If the reference is strong, you
> + * are responsible for calling qobject_unref() on the reference
> + * when you are done.
>   *
> - *  If the reference is weak, the owner of the reference may free it at
> - *  any time in the future.  Before storing the reference anywhere, you
> - *  should call qobject_ref() to make the reference strong.
> + * If the reference is weak, the owner of the reference may free it at
> + * any time in the future.  Before storing the reference anywhere, you
> + * should call qobject_ref() to make the reference strong.
>   *
> - *  - Transferring ownership: when you transfer ownership of a reference
> - *  by calling a function, you are no longer responsible for calling
> - *  qobject_unref() when the reference is no longer needed.  In other words,
> - *  when the function returns you must behave as if the reference to the
> - *  passed object was weak.
> + * Transferring ownership
> + * ----------------------
> + *
> + * When you transfer ownership of a reference by calling a
> + * function, you are no longer responsible for calling
> + * qobject_unref() when the reference is no longer needed.  In
> + * other words, when the function returns you must behave as if
> + * the reference to the passed object was weak.
>   */
>  #ifndef QOBJECT_H
>  #define QOBJECT_H
> @@ -81,6 +88,8 @@ static inline void qobject_ref_impl(QObject *obj)
>  
>  /**
>   * qobject_is_equal(): Return whether the two objects are equal.
> + * @x: QObject pointer
> + * @y: QObject pointer
>   *
>   * Any of the pointers may be NULL; return true if both are.  Always
>   * return false if only one is (therefore a QNull object is not
> @@ -90,6 +99,7 @@ bool qobject_is_equal(const QObject *x, const QObject *y);
>  
>  /**
>   * qobject_destroy(): Free resources used by the object
> + * @obj: QObject pointer
>   */
>  void qobject_destroy(QObject *obj);
>  
> @@ -103,6 +113,7 @@ static inline void qobject_unref_impl(QObject *obj)
>  
>  /**
>   * qobject_ref(): Increment QObject's reference count
> + * @obj: QObject pointer
>   *
>   * Returns: the same @obj. The type of @obj will be propagated to the
>   * return type.
> @@ -115,12 +126,14 @@ static inline void qobject_unref_impl(QObject *obj)
>  
>  /**
>   * qobject_unref(): Decrement QObject's reference count, deallocate
> - * when it reaches zero
> + *                  when it reaches zero
> + * @obj: QObject pointer
>   */
>  #define qobject_unref(obj) qobject_unref_impl(QOBJECT(obj))
>  
>  /**
>   * qobject_type(): Return the QObject's type
> + * @obj: QObject pointer
>   */
>  static inline QType qobject_type(const QObject *obj)
>  {
> @@ -130,6 +143,9 @@ static inline QType qobject_type(const QObject *obj)
>  
>  /**
>   * qobject_check_type(): Helper function for the qobject_to() macro.
> + * @obj: QObject pointer
> + * @type: Expected type of QObject
> + *
>   * Return @obj, but only if @obj is not NULL and @type is equal to
>   * @obj's type.  Return NULL otherwise.
>   */
> diff --git a/qobject/qnum.c b/qobject/qnum.c
> index 7012fc57f2..017c8aa739 100644
> --- a/qobject/qnum.c
> +++ b/qobject/qnum.c
> @@ -17,6 +17,7 @@
>  
>  /**
>   * qnum_from_int(): Create a new QNum from an int64_t
> + * @value: int64_t value
>   *
>   * Return strong reference.
>   */
> @@ -33,6 +34,7 @@ QNum *qnum_from_int(int64_t value)
>  
>  /**
>   * qnum_from_uint(): Create a new QNum from an uint64_t
> + * @value: uint64_t value
>   *
>   * Return strong reference.
>   */
> @@ -49,6 +51,7 @@ QNum *qnum_from_uint(uint64_t value)
>  
>  /**
>   * qnum_from_double(): Create a new QNum from a double
> + * @value: double value
>   *
>   * Return strong reference.
>   */
> @@ -65,6 +68,8 @@ QNum *qnum_from_double(double value)
>  
>  /**
>   * qnum_get_try_int(): Get an integer representation of the number
> + * @qn: QNum object
> + * @val: pointer to value
>   *
>   * Return true on success.
>   */
> @@ -90,6 +95,7 @@ bool qnum_get_try_int(const QNum *qn, int64_t *val)
>  
>  /**
>   * qnum_get_int(): Get an integer representation of the number
> + * @qn: QNum object
>   *
>   * assert() on failure.
>   */
> @@ -102,7 +108,9 @@ int64_t qnum_get_int(const QNum *qn)
>  }
>  
>  /**
> - * qnum_get_uint(): Get an unsigned integer from the number
> + * qnum_value_get_try_uint(): Get an unsigned integer from the number
> + * @qn: QNum object
> + * @val: pointer to value
>   *
>   * Return true on success.
>   */
> @@ -128,6 +136,7 @@ bool qnum_get_try_uint(const QNum *qn, uint64_t *val)
>  
>  /**
>   * qnum_get_uint(): Get an unsigned integer from the number
> + * @qn: QNum object
>   *
>   * assert() on failure.
>   */
> @@ -141,6 +150,7 @@ uint64_t qnum_get_uint(const QNum *qn)
>  
>  /**
>   * qnum_get_double(): Get a float representation of the number
> + * @qn: QNum object
>   *
>   * qnum_get_double() loses precision for integers beyond 53 bits.
>   */
> @@ -200,6 +210,8 @@ char *qnum_to_string(QNum *qn)
>  
>  /**
>   * qnum_is_equal(): Test whether the two QNums are equal
> + * @x: QNum object
> + * @y: QNum object
>   *
>   * Negative integers are never considered equal to unsigned integers,
>   * but positive integers in the range [0, INT64_MAX] are considered
> @@ -253,8 +265,9 @@ bool qnum_is_equal(const QObject *x, const QObject *y)
>  }
>  
>  /**
> - * qnum_destroy_obj(): Free all memory allocated by a
> - * QNum object
> + * qnum_destroy_obj(): Free all memory allocated by a QNum object
> + *
> + * @obj: QNum object to be destroyed
>   */
>  void qnum_destroy_obj(QObject *obj)
>  {

Many lines of the form

  + * @foo: a foo

One of my reasons to dislike GTK-Doc.  Oh well, it's what we're using.



  parent reply	other threads:[~2020-11-19  9:38 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 22:41 [PATCH v2 0/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 1/8] qobject: Include API docs in docs/devel/qobject.html Eduardo Habkost
2020-11-17  8:23   ` Marc-André Lureau
2020-11-19  9:37   ` Markus Armbruster [this message]
2020-11-19 18:03     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 2/8] qnum: Make qnum_get_double() get const pointer Eduardo Habkost
2020-11-17  8:26   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 3/8] qnum: QNumValue type for QNum value literals Eduardo Habkost
2020-11-17  8:37   ` Marc-André Lureau
2020-11-17 14:42     ` Eduardo Habkost
2020-11-17 14:58       ` Marc-André Lureau
2020-11-19 10:24         ` Markus Armbruster
2020-11-19 18:21           ` Eduardo Habkost
2020-11-19 20:55             ` Eduardo Habkost
2020-11-20  9:05               ` Markus Armbruster
2020-11-20  5:29             ` Markus Armbruster
2020-11-20 18:27               ` Eduardo Habkost
2020-11-23  7:51                 ` Markus Armbruster
2020-11-23 18:33                   ` Eduardo Habkost
2020-11-24  8:49                     ` Markus Armbruster
2020-11-24 14:41                       ` Eduardo Habkost
2020-11-24 15:20                         ` Markus Armbruster
2020-11-24 15:29                           ` Eduardo Habkost
2020-11-25  6:40                             ` Markus Armbruster
2020-11-25 15:01                               ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 4/8] qnum: qnum_value_is_equal() function Eduardo Habkost
2020-11-17  8:42   ` Marc-André Lureau
2020-11-17 15:49     ` Eduardo Habkost
2020-11-17 16:53       ` Marc-André Lureau
2020-11-17 17:21         ` Eduardo Habkost
2020-11-19 10:27   ` Markus Armbruster
2020-11-19 18:24     ` Eduardo Habkost
2020-11-20  6:52       ` Markus Armbruster
2020-11-20 18:22         ` Eduardo Habkost
2020-11-23  8:17           ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 5/8] qlit: Support all types of QNums Eduardo Habkost
2020-11-17  8:52   ` Marc-André Lureau
2020-11-19 10:39     ` Markus Armbruster
2020-11-19 18:56       ` Eduardo Habkost
2020-11-20  6:55         ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 6/8] qlit: qlit_type() function Eduardo Habkost
2020-11-17  8:53   ` Marc-André Lureau
2020-11-19 10:41   ` Markus Armbruster
2020-11-19 17:56     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 7/8] qom: Make object_property_set_default() public Eduardo Habkost
2020-11-17  8:56   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 8/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-17  9:02   ` Marc-André Lureau
2020-11-19 12:39 ` [PATCH v2 0/8] " Markus Armbruster
2020-11-19 17:13   ` Eduardo Habkost
2020-11-19 17:23     ` Paolo Bonzini
2020-11-19 17:55       ` Eduardo Habkost
2020-11-19 18:25         ` Paolo Bonzini
2020-11-19 19:05           ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnyhd6wd.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.