From 0f5f94ed8a86355003533452a2d6cc8077d27535 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 31 Jan 2013 21:42:32 -0500 Subject: giscanner: Apply standard annotations to constant values While there's no particular reason I need to do this, there really isn't any reason to not do this, and it helps with doctool or whatever in the future if we want to document when a constant showed up. g-ir-compiler also keeps track of constant deprecations, so this fixes constants not ever being deprecated. https://bugzilla.gnome.org/show_bug.cgi?id=693040 --- tests/scanner/annotation.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index b3b4bd4c..09d4f4f2 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -180,6 +180,8 @@ GObject * annotation_transfer_floating(void); * Constant to define a calculated large value * * Value: 10000000000UL + * + * Since: 1.4 */ #define ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000)) -- cgit v1.2.1 From 2df621c53cdffbc3c43c3745947ee859020c8338 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 2 Feb 2013 11:49:48 -0500 Subject: tests: Move Annotation into Regress The goal here is to have one master library for testing lots of edge cases for GIRs rather than lots of individual libraries. https://bugzilla.gnome.org/show_bug.cgi?id=693097 --- tests/scanner/annotation.h | 152 ++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 09d4f4f2..154b0d88 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -1,5 +1,5 @@ -#ifndef __ANNOTATION_OBJECT_H__ -#define __ANNOTATION_OBJECT_H__ +#ifndef __REGRESS_ANNOTATION_OBJECT_H__ +#define __REGRESS_ANNOTATION_OBJECT_H__ #include @@ -7,175 +7,175 @@ typedef enum /*< flags,prefix=ANN >*/ { ANN_FLAG_FOO = 1, ANN_FLAG_BAR = 2 -} AnnotationBitfield; +} RegressAnnotationBitfield; /** - * AnnotationCallback: + * RegressAnnotationCallback: * @in: (in) (transfer none): array of ints * * This is a callback. * Return value: (transfer none): array of ints */ -typedef const gint* (*AnnotationCallback) (const gint *in); +typedef const gint* (*RegressAnnotationCallback) (const gint *in); /** - * AnnotationListCallback: + * RegressAnnotationListCallback: * @in: (in) (transfer none) (element-type utf8): list of strings * * This is a callback taking a list. * Return value: (transfer container) (element-type utf8): list of strings */ -typedef GList* (*AnnotationListCallback) (GList *in); +typedef GList* (*RegressAnnotationListCallback) (GList *in); /** - * AnnotationNotifyFunc: + * RegressAnnotationNotifyFunc: * @data: (closure): The user data * * This is a callback with a 'closure' argument that is not named * 'user_data' and hence has to be annotated. */ -typedef void (*AnnotationNotifyFunc) (gpointer data); +typedef void (*RegressAnnotationNotifyFunc) (gpointer data); /** - * AnnotationObject: + * RegressAnnotationObject: * - * This is an object used to test annotations. + * This is an object used to test regress_annotations. * * Attributes: (org.example.Test cows) */ -typedef struct _AnnotationObject AnnotationObject; -typedef struct _AnnotationObjectClass AnnotationObjectClass; +typedef struct _RegressAnnotationObject RegressAnnotationObject; +typedef struct _RegressAnnotationObjectClass RegressAnnotationObjectClass; -typedef void (*AnnotationForeachFunc) (AnnotationObject *object, +typedef void (*RegressAnnotationForeachFunc) (RegressAnnotationObject *object, const char *item, gpointer user_data); -struct _AnnotationObject +struct _RegressAnnotationObject { GObject parent_instance; }; -struct _AnnotationObjectClass +struct _RegressAnnotationObjectClass { GObjectClass parent_class; }; -GType annotation_object_get_type (void); +GType regress_annotation_object_get_type (void); -gint annotation_object_method (AnnotationObject *object); -gint annotation_object_out (AnnotationObject *object, +gint regress_annotation_object_method (RegressAnnotationObject *object); +gint regress_annotation_object_out (RegressAnnotationObject *object, int *outarg); -GObject* annotation_object_create_object(AnnotationObject *object); -GObject* annotation_object_allow_none (AnnotationObject *object, +GObject* regress_annotation_object_create_object(RegressAnnotationObject *object); +GObject* regress_annotation_object_allow_none (RegressAnnotationObject *object, const gchar *somearg); -GObject* annotation_object_notrans (AnnotationObject *object); -gint annotation_object_inout (AnnotationObject *object, +GObject* regress_annotation_object_notrans (RegressAnnotationObject *object); +gint regress_annotation_object_inout (RegressAnnotationObject *object, int *inoutarg); -gint annotation_object_inout2 (AnnotationObject *object, +gint regress_annotation_object_inout2 (RegressAnnotationObject *object, int *inoutarg); -gint annotation_object_inout3 (AnnotationObject *object, +gint regress_annotation_object_inout3 (RegressAnnotationObject *object, int *inoutarg); -gint annotation_object_in (AnnotationObject *object, +gint regress_annotation_object_in (RegressAnnotationObject *object, int *inarg); -gint annotation_object_calleeowns (AnnotationObject *object, +gint regress_annotation_object_calleeowns (RegressAnnotationObject *object, GObject **toown); -gint annotation_object_calleesowns (AnnotationObject *object, +gint regress_annotation_object_calleesowns (RegressAnnotationObject *object, GObject **toown1, GObject **toown2); -GList* annotation_object_get_strings (AnnotationObject *object); -GHashTable*annotation_object_get_hash (AnnotationObject *object); -void annotation_object_with_voidp (AnnotationObject *object, +GList* regress_annotation_object_get_strings (RegressAnnotationObject *object); +GHashTable*regress_annotation_object_get_hash (RegressAnnotationObject *object); +void regress_annotation_object_with_voidp (RegressAnnotationObject *object, void *data); -GSList* annotation_object_get_objects (AnnotationObject *object); +GSList* regress_annotation_object_get_objects (RegressAnnotationObject *object); -void annotation_object_use_buffer (AnnotationObject *object, +void regress_annotation_object_use_buffer (RegressAnnotationObject *object, guchar *bytes); -void annotation_object_compute_sum (AnnotationObject *object, +void regress_annotation_object_compute_sum (RegressAnnotationObject *object, int *nums); -void annotation_object_compute_sum_n(AnnotationObject *object, +void regress_annotation_object_compute_sum_n(RegressAnnotationObject *object, int *nums, int n_nums); -void annotation_object_compute_sum_nz(AnnotationObject *object, +void regress_annotation_object_compute_sum_nz(RegressAnnotationObject *object, int *nums, int n_nums); -void annotation_object_parse_args (AnnotationObject *object, +void regress_annotation_object_parse_args (RegressAnnotationObject *object, int *argc, char ***argv); -gboolean annotation_object_string_out (AnnotationObject *object, +gboolean regress_annotation_object_string_out (RegressAnnotationObject *object, char **str_out); -void annotation_object_foreach (AnnotationObject *object, - AnnotationForeachFunc func, +void regress_annotation_object_foreach (RegressAnnotationObject *object, + RegressAnnotationForeachFunc func, gpointer user_data); -void annotation_object_set_data (AnnotationObject *object, +void regress_annotation_object_set_data (RegressAnnotationObject *object, const guchar *data, gsize length); -void annotation_object_set_data2 (AnnotationObject *object, +void regress_annotation_object_set_data2 (RegressAnnotationObject *object, const gchar *data, gsize length); -void annotation_object_set_data3 (AnnotationObject *object, +void regress_annotation_object_set_data3 (RegressAnnotationObject *object, gpointer data, gsize length); -GObject* annotation_object_do_not_use (AnnotationObject *object); -void annotation_object_watch (AnnotationObject *object, - AnnotationForeachFunc func, +GObject* regress_annotation_object_do_not_use (RegressAnnotationObject *object); +void regress_annotation_object_watch (RegressAnnotationObject *object, + RegressAnnotationForeachFunc func, gpointer user_data); -void annotation_object_watch_full (AnnotationObject *object, - AnnotationForeachFunc func, +void regress_annotation_object_watch_full (RegressAnnotationObject *object, + RegressAnnotationForeachFunc func, gpointer user_data, GDestroyNotify destroy); -void annotation_object_hidden_self (gpointer object); +void regress_annotation_object_hidden_self (gpointer object); -void annotation_init (int *argc, +void regress_annotation_init (int *argc, char ***argv); -char ** annotation_return_array (int *length); -void annotation_versioned (void); -char ** annotation_string_zero_terminated (void); -void annotation_string_zero_terminated_out (char ***out); +char ** regress_annotation_return_array (int *length); +void regress_annotation_versioned (void); +char ** regress_annotation_string_zero_terminated (void); +void regress_annotation_string_zero_terminated_out (char ***out); -void annotation_string_array_length (guint n_properties, const gchar * const properties[]); +void regress_annotation_string_array_length (guint n_properties, const gchar * const properties[]); -void annotation_object_extra_annos (AnnotationObject *object); +void regress_annotation_object_extra_annos (RegressAnnotationObject *object); -void annotation_custom_destroy (AnnotationCallback callback, - AnnotationNotifyFunc destroy, +void regress_annotation_custom_destroy (RegressAnnotationCallback callback, + RegressAnnotationNotifyFunc destroy, gpointer data); -char * annotation_get_source_file (void); -void annotation_set_source_file (const char *fname); +char * regress_annotation_get_source_file (void); +void regress_annotation_set_source_file (const char *fname); -gint annotation_attribute_func (AnnotationObject *object, +gint regress_annotation_attribute_func (RegressAnnotationObject *object, const gchar *data); -void annotation_invalid_annotation (int foo); +void regress_annotation_invalid_regress_annotation (int foo); /** - * AnnotationStruct: + * RegressAnnotationStruct: * * This is a test of an array of object in an field of a struct. */ -struct AnnotationStruct +struct RegressAnnotationStruct { - AnnotationObject *objects[10]; + RegressAnnotationObject *objects[10]; }; -void annotation_ptr_array (GPtrArray *array); +void regress_annotation_ptr_array (GPtrArray *array); -GObject * annotation_test_parsing_bug630862 (void); +GObject * regress_annotation_test_parsing_bug630862 (void); -void annotation_space_after_comment_bug631690 (void); +void regress_annotation_space_after_comment_bug631690 (void); -gchar* annotation_return_filename (void); +gchar* regress_annotation_return_filename (void); -GObject * annotation_transfer_floating(void); +GObject * regress_annotation_transfer_floating(void); /* This one we can handle properly */ -#define ANNOTATION_CALCULATED_DEFINE (10 * 10) +#define REGRESS_ANNOTATION_CALCULATED_DEFINE (10 * 10) /** - * ANNOTATION_CALCULATED_LARGE: + * REGRESS_ANNOTATION_CALCULATED_LARGE: * * Constant to define a calculated large value * @@ -183,16 +183,16 @@ GObject * annotation_transfer_floating(void); * * Since: 1.4 */ -#define ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000)) +#define REGRESS_ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000)) /** - * ANNOTATION_CALCULATED_LARGE_DIV: + * REGRESS_ANNOTATION_CALCULATED_LARGE_DIV: * * Constant to define a calculated large value * * Value: 1000000UL */ -#define ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000)) +#define REGRESS_ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000)) -#endif /* __ANNOTATION_OBJECT_H__ */ +#endif /* __REGRESS_ANNOTATION_OBJECT_H__ */ -- cgit v1.2.1 From 9625f52b5205f5c6f35b8300d60782a6ad6cb237 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 20 Mar 2013 16:54:53 +0100 Subject: tests: fix a too wide search/replace Changed by accident in 2df621c53cdffbc3c43c3745947ee859020c8338 https://bugzilla.gnome.org/show_bug.cgi?id=697613 --- tests/scanner/annotation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 154b0d88..66470cbb 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -39,7 +39,7 @@ typedef void (*RegressAnnotationNotifyFunc) (gpointer data); /** * RegressAnnotationObject: * - * This is an object used to test regress_annotations. + * This is an object used to test annotations. * * Attributes: (org.example.Test cows) */ -- cgit v1.2.1 From a2b22ce75937d2d996ef90e0ab683d36031365d0 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Mon, 12 Aug 2013 16:54:11 +0200 Subject: giscanner: flesh out annotation parsing and storage - remove annotations regex, restore proper parens parsing - drop weird DocOption() storage class and use lists/dicts as appropriate - make GtkDocAnnotations a simple OrderedDict subclass instead of a weird hybrid dict/list storage class - Deprecate Attribute: tag, replace with (attributes) annotation on the identifier --- tests/scanner/annotation.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 66470cbb..b982a5b7 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -37,11 +37,9 @@ typedef GList* (*RegressAnnotationListCallback) (GList *in); typedef void (*RegressAnnotationNotifyFunc) (gpointer data); /** - * RegressAnnotationObject: + * RegressAnnotationObject: (attributes org.example.Test=cows) * * This is an object used to test annotations. - * - * Attributes: (org.example.Test cows) */ typedef struct _RegressAnnotationObject RegressAnnotationObject; typedef struct _RegressAnnotationObjectClass RegressAnnotationObjectClass; -- cgit v1.2.1 From b6954536f32352c0c29fe5a9a73de1018559a9c5 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Thu, 25 Jul 2013 17:49:11 +0200 Subject: giscanner: deprecate GObject-Introspection GTK-Doc tags After discussing a different issue with the GTK-Doc maintainers, we learned that our g-i specific top level tags should never have existed in the first place. The prefered notation for annotations that apply to the identifier should be written on the identifier line, for example like what we already do with (skip). As a result, this patch deprecates g-i specific top level tags and implements them as annotations on the identifier instead but still keeps support for malformed comment blocks using g-i specific top level tags. This means that all annotated code "out there" will continue to work just fine with this version of g-i, but when a developer decides to fix deprecation warnings in his/her comment blocks, the dependency on g-i needs to be raised to a version that contains at least this patch. #676133 https://bugzilla.gnome.org/show_bug.cgi?id=676133 --- tests/scanner/annotation.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index b982a5b7..2084da29 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -173,22 +173,18 @@ GObject * regress_annotation_transfer_floating(void); #define REGRESS_ANNOTATION_CALCULATED_DEFINE (10 * 10) /** - * REGRESS_ANNOTATION_CALCULATED_LARGE: + * REGRESS_ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) * * Constant to define a calculated large value * - * Value: 10000000000UL - * * Since: 1.4 */ #define REGRESS_ANNOTATION_CALCULATED_LARGE (1000 * G_GINT64_CONSTANT (10000000)) /** - * REGRESS_ANNOTATION_CALCULATED_LARGE_DIV: + * REGRESS_ANNOTATION_CALCULATED_LARGE_DIV: (value 1000000UL) * * Constant to define a calculated large value - * - * Value: 1000000UL */ #define REGRESS_ANNOTATION_CALCULATED_LARGE_DIV (1000 / G_GINT64_CONSTANT (10000000)) -- cgit v1.2.1 From 2a569cb68ca4e4ce08ff66fc20a79bc57222c2e2 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sun, 20 Oct 2013 20:47:13 +0200 Subject: giscanner: Correctly consume field annotations on structs A hidden exception was being thrown (which we now log), due to fields being treated as function parameters. Fixed to make field array annotations be transformed and written out to the gir correctly. https://bugzilla.gnome.org/show_bug.cgi?id=710561 --- tests/scanner/annotation.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 2084da29..b0cbe42d 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -159,6 +159,21 @@ struct RegressAnnotationStruct RegressAnnotationObject *objects[10]; }; +/** + * RegressAnnotationFields: + * @field1: Some documentation + * @arr: (array length=len): an array of length @len + * @len: the length of array + * + * This is a struct for testing field documentation and annotations + */ +struct RegressAnnotationFields +{ + int field1; + guchar *arr; + gulong len; +}; + void regress_annotation_ptr_array (GPtrArray *array); GObject * regress_annotation_test_parsing_bug630862 (void); -- cgit v1.2.1