summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* scanner: Validate emitter methodsebassi/signal-emitterEmmanuele Bassi2021-08-051-0/+35
| | | | | | | | | Follow the same semantics as Vala: 1. emitters should have the same return value as the signal 2. emitters should have the same parameters as the signal they emit (minus the instance parameter, which is implied in signals)
* scanner: Add (emitter) annotation for signalsEmmanuele Bassi2021-08-057-10/+73
| | | | | | Signals that have an emitter function should have an annotation to allow consumers of the introspection XML to effectively pair signals to their corresponding emitter functions that share the same prototype.
* Ignore accessor annotations for non-introspectable propertiesEmmanuele Bassi2021-08-052-3/+29
| | | | | | | If a property is not introspectable we need to decouple it from its accessors; the property data will not be compiled into the typelib, and when the compiler will try to resolve the offsets into the binary blob we'll get a fatal exception.
* Improve readability of error messageEmmanuele Bassi2021-08-051-3/+3
| | | | | Use the parent type and the function symbol when erroring out if we can't find a property accessor.
* Improve getter function matching heuristicEmmanuele Bassi2021-08-051-8/+13
| | | | | | | Some readonly boolean properties in the form of 'has-foo' or 'is-bar' expose a getter function in the form of `get_has_foo()` or `get_is_bar()`, according to extant coding practices. We should ensure we still check for those.
* scanner: Warn if property annotations are mismatchedEmmanuele Bassi2021-08-052-17/+37
| | | | | | If the (set-property) and (get-property) annotations on methods do not round trip with the (setter) and (getter) annotations on the corresponding property, we want to emit a warning.
* docs: Clarify scope of property-related annotationsEmmanuele Bassi2021-08-051-4/+4
| | | | | | | | The `set-property` and `get-property` identifier annotations only apply to methods. The `setter` and `getter` identifier annotations only apply to properties.
* Use a macro for the missing accessor sentinel valueEmmanuele Bassi2021-08-053-8/+10
| | | | Easier to read than `0x3ff`.
* scanner: Add an heuristic for property gettersEmmanuele Bassi2021-08-051-1/+6
| | | | | | | | If a property is boolean and read-only, the getter method can be the same as the property name, for instance: - gtk_widget_has_focus() - gtk_media_stream_has_audio()
* scanner: Try to pair properties with accessor methodsEmmanuele Bassi2021-08-052-2/+30
| | | | | | | The heuristic is pretty trivial: for any given non-construct-only, writable property, we check if there's a `set_<property>` method; for any given readable property, we check if there's a `get_<property>` method.
* docs: Clarify the meaning of accessor functionsEmmanuele Bassi2021-08-051-4/+16
| | | | | Public accessor functions are the functions typically called through g_object_set_property() and g_object_get_property().
* Document the new property accessors annotationsEmmanuele Bassi2021-08-052-0/+12
|
* tests: Add a Regress test for the property accessors annotationsEmmanuele Bassi2021-08-052-5/+9
|
* Add annotations for property setters and gettersEmmanuele Bassi2021-08-055-7/+65
| | | | | We need new annotations to allow library developers to associate a setter and a getter functions to a property definition.
* Add introspection data for property accessorsEmmanuele Bassi2021-08-058-1/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A GObject property can be accessed generically through the GObject API, e.g. g_object_set_property() and g_object_get_property(). Properties typically also have public accessor functions, which are (according to our own best practices) called through the generic API. The introspection data is currently missing the relation between a property and its public accessor functions. With this information, a language binding could, for instance, avoid exposing the C API entirely, thus minimizing the chances of collisions between property names and accessor functions; alternatively, a binding could call the C API directly instead of going through the generic GObject API, thus avoiding the boxing and unboxing from a native type to a GIArgument and finally into a GValue, and vice versa. In the GIR, we add two new attributes to the `property` element: - setter="SYMBOL" - getter="SYMBOL" where "symbol" is the C function identifier of the setter and getter functions, respectively. The `setter` attribute is only applied to writable, non-construct-only properties; the `getter` attribute is only applied to readable properties. We maintain the ABI compatibility of the typelib data by using 20 bits of the 25 reserved bits inside the PropertyBlob structure. The data is exposed through two new GIPropertyInfo methods: - g_property_info_get_setter() - g_property_info_get_getter() which return the GIFunctionInfo for the setter and getter functions, respectively.
* docs: Add the new accessors annotationsEmmanuele Bassi2021-08-052-0/+13
| | | | | Mention them in the annotations list, and add the new attributes to the GIR schema.
* tests: Check new property accessors annotationsEmmanuele Bassi2021-08-0510-275/+579
| | | | Add an accessors pair to Regress.TestObj and annotate them.
* Add new annotations for property accessorsEmmanuele Bassi2021-08-059-13/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce two new annotations: - (set-property PROPERTY_NAME) - (get-property PROPERTY_NAME) These annotations are valid inside function blocks for methods on objects and interfaces, and define whether a function is a property accessor, e.g.: /** * gtk_widget_set_name: (set-property name) * @self: ... * @name: ... * * ... */ /** * gtk_widget_get_name: (get-property name) * @self: ... * * ... * * Returns: ... */ The annotations are transformed into the GIR data as attributes: - glib:set-property="PROPERTY_NAME" - glib:get-property="PROPERTY_NAME" The underlying typelib data has had flags for setter and getter functions for a while, but they have never been plugged into the GIR data or the introspection scanner. Now they are; you can retrieve the GIPropertyInfo from a GIFunctionInfo that has the GI_FUNCTION_IS_SETTER or GI_FUNCTION_IS_GETTER flags set. Fixes: #13
* Property accessors work for interfaces and objectsEmmanuele Bassi2021-08-051-4/+16
| | | | | | We need to check the container type before trying to obtain a GIPropertyInfo for GIFunctionInfos that have a SETTER or a GETTER flag set.
* Add newly added girepository symbol to the API referenceEmmanuele Bassi2021-08-051-0/+1
|
* Add "final" class attributeEmmanuele Bassi2021-08-0513-6/+70
| | | | | | | | A "final" class is a leaf node in a derivable type hierarchy, and cannot be derived any further. This matches the changes in libgobject that introduced G_TYPE_FLAG_FINAL to the type flags.
* Add version macros for 1.70Emmanuele Bassi2021-08-051-0/+6
| | | | We are going to introduce new API.
* Update the GLib documentationEmmanuele Bassi2021-08-054-525/+1594
| | | | Up to the 2.69.1 tag.
* build: Export warnlib sources as variablesPhilip Chimento2021-08-051-0/+2
| | | | | | | This is so that GJS can use these variables in its own build files when including gobject-introspection as a Meson subproject. Previously we took the approach of using the files in their installed locations, but that doesn't work as a subproject.
* Update the developer.gnome.org URLsEmmanuele Bassi2021-08-056-12/+12
| | | | | | | The GNOME developers documentation website has been updated, and we're in the process of moving API references elsewhere. The old documentation is still available under developer-old.gnome.org, so let's update the URLs we have in our documentation.
* introspection: Remove 'caller-allocates' from POD typesPhilip Chimento2021-07-292-4/+4
| | | | | | | | | The (out caller-allocates) and (out callee-allocates) annotations are meant for structured or pointer types. Plain old data types are just regular out parameters and don't need the annotation about who allocates them. See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2005
* Clean up the subproject rules for GLibEmmanuele Bassi2021-07-281-34/+87
| | | | | | Make the variable names intelligible, and include a bunch of built files that are necessary to ensure that the generated GIR data actually matches the GLib API.
* docs: Add g-ir-doc-tool man pageDavid King2021-07-095-3/+146
|
* ci: Promote libpcre's subprojectEmmanuele Bassi2021-06-241-0/+3
| | | | | GLib has dropped the internal copy libpcre, so we need to promote libpcre's subproject to the top level.
* ci: Add pcre-devel to the minimal imageEmmanuele Bassi2021-06-241-1/+2
| | | | | | | GLib dropped the internal libpcre copy, which means we end up with a subproject inside a subproject. Since libpcre is frozen, we can rely on using the installed copy.
* ci: Install mako and markup modules in DockerEmmanuele Bassi2021-06-242-5/+2
| | | | Don't install them as part of the CI job. It's pointless repetition.
* Initialise argumentEmmanuele Bassi2021-06-241-1/+1
| | | | Avoid a "maybe uninitialized" compiler warning.
* build: Use warning_level=2Emmanuele Bassi2021-06-241-3/+1
| | | | | | | | | Drop explicit `-Wall` and `-Wextra` from the compiler flags. Meson adds `-Wall` with `warning_level=1`, and `-Wextra` with `warning_level=2`. Fixes: #319
* ci: Use modern Meson command lineEmmanuele Bassi2021-06-241-31/+33
| | | | | | | Don't call Ninja directly, and don't enter the build directory. Also move shared options to environment variables, so we don't have to copy and paste them everywhere.
* ci: Bump up the Docker tagsEmmanuele Bassi2021-06-243-4/+4
|
* ci: Update run-docker scripts to work with PodmanEmmanuele Bassi2021-06-242-12/+53
| | | | Not every Linux distro ships with Docker, and Podman is nicer.
* Use slightly less ancient MesonEmmanuele Bassi2021-06-245-7/+7
|
* ci: Use stable FedoraEmmanuele Bassi2021-06-242-2/+2
| | | | Fedora 29 was EOL'ed in 2019.
* Bump up version to 1.69.0Emmanuele Bassi2021-06-241-1/+1
|
* Add glib:name to enum memberMarc-André Lureau2021-06-207-35/+68
| | | | | | | This member will contain the string from the GEnumValue/GFlagsValue 'value_name' introspection dump. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* scanner: fix enum member c:identifierMarc-André Lureau2021-06-202-4/+8
| | | | | | Don't rely on runtime name, but on C header parsed symbol. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* tests/repository: Fix leak in test_constructor_return_typeDavid King2021-06-181-0/+1
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* g-ir-compiler: Fix leaks in write_out_typelibDavid King2021-06-181-0/+2
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* giscanner: Improve error handling while parsing macrosDavid King2021-06-181-3/+29
| | | | | | | | | Check for errors during g_file_open_tmp() and fdopen(). Make sure to free tmp_name and error as needed. Found with Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* girepository: Fix leak in prefix_with_contextDavid King2021-06-181-1/+3
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* girepository: Fix leak in write_vfunc_infoDavid King2021-06-181-1/+4
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* girepository: Fix leak in write_field_infoDavid King2021-06-181-0/+1
| | | | | | Unref type before reusing it. Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* girepository: Fix leak in _g_ir_parser_parse_fileDavid King2021-06-181-1/+5
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* girepository: Fix leak in g_callable_info_invokeDavid King2021-06-181-1/+4
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* ci: Limit depth of subprojects when cloningPhilip Withnall2021-06-074-0/+4
| | | | | | | | | Use the depth= argument from Meson 0.52 to limit the clone depth of subprojects to 1. This should make the CI images a little smaller, and reduce the bandwidth required to build them (although that’s not so important because it only happens once every few months). Signed-off-by: Philip Withnall <pwithnall@endlessos.org>