[gtk-doc] mkdb: Add support for (not optional) annotation



commit ad2087a8a74771ec77dfaf7402727af2443b5f48
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Nov 7 15:44:09 2017 +0000

    mkdb: Add support for (not optional) annotation
    
    The (optional) and (not nullable) annotations were already supported,
    but support for (not optional) was missing. Add that, and expand the
    tests to cover it.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790022

 gtkdoc/mkdb.py                             |    1 +
 tests/annotations/docs/tester-sections.txt |    3 ++
 tests/annotations/src/tester.c             |   44 ++++++++++++++++++++++++++++
 tests/annotations/src/tester.h             |    3 ++
 4 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index 96fa931..07ad659 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -128,6 +128,7 @@ AnnotationDefinition = {
     'nullable': "NULL may be passed as the value in, out, in-out; or as a return value.",
     'not nullable': "NULL must not be passed as the value in, out, in-out; or as a return value.",
     'optional': "NULL may be passed instead of a pointer to a location.",
+    'not optional': "NULL must not be passed as the pointer to a location.",
     'array': "Parameter points to an array of items.",
     'attribute': "Deprecated free-form custom annotation, replaced by (attributes) annotation.",
     'attributes': "Free-form key-value pairs.",
diff --git a/tests/annotations/docs/tester-sections.txt b/tests/annotations/docs/tester-sections.txt
index d7c1c38..3b33f0b 100644
--- a/tests/annotations/docs/tester-sections.txt
+++ b/tests/annotations/docs/tester-sections.txt
@@ -13,8 +13,11 @@ annotation_outparams
 annotation_outparams_nullable
 annotation_outparams_not_nullable
 annotation_outparams_optional
+annotation_outparams_not_optional
 annotation_outparams_optional_nullable
+annotation_outparams_not_optional_nullable
 annotation_outparams_optional_not_nullable
+annotation_outparams_not_optional_not_nullable
 annotation_skip
 annotation_skip_return
 annotation_scope
diff --git a/tests/annotations/src/tester.c b/tests/annotations/src/tester.c
index eeb1159..ae38512 100644
--- a/tests/annotations/src/tester.c
+++ b/tests/annotations/src/tester.c
@@ -151,6 +151,20 @@ annotation_outparams_optional (GList **list)
 }
 
 /**
+ * annotation_outparams_not_optional:
+ * @list: (out) (transfer none) (not optional): a pointer to take a list
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_outparams_not_optional (GList **list)
+{
+  return TRUE;
+}
+
+/**
  * annotation_outparams_nullable:
  * @list: (out) (transfer none) (nullable): a pointer to take a list; but %NULL
  * may also be returned
@@ -196,6 +210,21 @@ annotation_outparams_optional_nullable (GList **list)
 }
 
 /**
+ * annotation_outparams_not_optional_nullable:
+ * @list: (out) (transfer none) (not optional) (nullable): a pointer to take a
+ * list, not %NULL; but %NULL may also be returned in @list — isn’t that cool?
+ *
+ * Document non-optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_outparams_not_optional_nullable (GList **list)
+{
+  return TRUE;
+}
+
+/**
  * annotation_outparams_optional_not_nullable:
  * @list: (out) (transfer none) (optional) (not nullable): a pointer to take a
  * list, not %NULL; and %NULL must not be returned in @list — isn’t that cool?
@@ -211,6 +240,21 @@ annotation_outparams_optional_not_nullable (GList **list)
 }
 
 /**
+ * annotation_outparams_not_optional_not_nullable:
+ * @list: (out) (transfer none) (not optional) (not nullable): a pointer to take a
+ * list, not %NULL; and %NULL must not be returned in @list — isn’t that cool?
+ *
+ * Document non-optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_outparams_not_optional_not_nullable (GList **list)
+{
+  return TRUE;
+}
+
+/**
  * annotation_skip: (skip)
  * @list: a pointer to take a list
  *
diff --git a/tests/annotations/src/tester.h b/tests/annotations/src/tester.h
index e3b0f78..1a4a68b 100644
--- a/tests/annotations/src/tester.h
+++ b/tests/annotations/src/tester.h
@@ -26,10 +26,13 @@ GList *annotation_elementtype_returns (void);
 
 gboolean annotation_outparams (GList **list);
 gboolean annotation_outparams_optional (GList **list);
+gboolean annotation_outparams_not_optional (GList **list);
 gboolean annotation_outparams_nullable (GList **list);
 gboolean annotation_outparams_not_nullable (GList **list);
 gboolean annotation_outparams_optional_nullable (GList **list);
+gboolean annotation_outparams_not_optional_nullable (GList **list);
 gboolean annotation_outparams_optional_not_nullable (GList **list);
+gboolean annotation_outparams_not_optional_not_nullable (GList **list);
 
 void annotation_skip (GList *list);
 gboolean annotation_skip_return (GList *list);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]