summaryrefslogtreecommitdiff
path: root/girepository
Commit message (Collapse)AuthorAgeFilesLines
* Add introspection data for property accessorsEmmanuele Bassi2021-08-057-1/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add new annotations for property accessorsEmmanuele Bassi2021-08-054-6/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "final" class attributeEmmanuele Bassi2021-08-058-3/+54
| | | | | | | | 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.
* Initialise argumentEmmanuele Bassi2021-06-241-1/+1
| | | | Avoid a "maybe uninitialized" compiler warning.
* 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
* Make test suite work with cross-related optionsJohn Ericson2021-05-231-7/+0
| | | | | | | | | | Because of skepticism I received in #224, I made this PR which keeps the testsuite and CI improvements but doesn't add any new build options. I hope this would be less controversial: - no new knobs - tests for those using existing build options - CI tests `build_introspection_data = false`
* Use g_memdup2() with newer versions of GLibEmmanuele Bassi2021-03-121-1/+9
| | | | | The g_memdup() function has been deprecated, so we should use the new g_memdup2() function if available.
* Merge branch 'objectinfo_nullable' into 'master'Mathieu Duponchelle2020-07-221-14/+14
|\ | | | | | | | | Add missing nullable annotations to GObjectInfo See merge request GNOME/gobject-introspection!225
| * Add missing nullable annotations to GObjectInfoJonne Haß2020-05-261-14/+14
| |
* | Merge branch 'standalone-doc-sections' into 'master'Mathieu Duponchelle2020-07-221-1/+2
|\ \ | | | | | | | | | | | | Add the notion of standalone doc sections. See merge request GNOME/gobject-introspection!226
| * | Add the notion of standalone doc sections.Mathieu Duponchelle2020-07-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Up to now, section annotations had to match a class or interface name in order to be serialized in the gir. With this commit, they now get serialized as docsection nodes, for potential use by documentation tools.
* | | meson: also build gi-dump-types on WindowsChristoph Reiter2020-05-192-2/+3
| | |
* | | Use `_get_oshandle()` and `g_win32_output_stream_new()` instead sinceGisle Vanem2020-05-151-1/+5
| | | | | | | | | | | | | | | | | | `g_win32_output_stream_new_from_fd()` is private in Gio. It's normally not exported unless `GLIB_STATIC_COMPILATION` is effective. PS. Why would i not be called `GIO_STATIC_COMPILATION` for Gio .c-files?
* | | Obs! Change back to `g_unix_output_stream_new()` for non-Win32.Gisle Vanem2020-05-141-1/+1
| | |
* | | [Win32] Fix gi-dump-types.c to build on WindowsGisle Vanem2020-05-141-4/+12
|/ /
* | Add missing nullable annotation to g_object_info_get_parentJonne Haß2020-05-141-1/+1
| |
* | Add missing nullable annotation to g_irepository_get_shared_libraryJonne Haß2020-05-141-1/+1
|/
* girepository: Add GITypeInfo utility functions for storing values in pointersPhilip Chimento2020-04-262-0/+182
| | | | | | | | This functionality is used in both PyGObject and GJS, and if not done correctly can lead to architecture-specific bugs. It seems best to add API in gobject-introspection for the correct way to do it. See also: GNOME/gjs#309
* girepository: Add 1.66 version macroPhilip Chimento2020-04-261-0/+6
| | | | Required for adding new API to the 1.66 series.
* Revert "Revert "Meson: Fix build when glib is built as subproject""Xavier Claessens2020-04-242-1/+4
| | | | This reverts commit 42b7d634a9a7500dcc71651f71844148fc200be3.
* Revert "Meson: Fix build when glib is built as subproject"Emmanuele Bassi2020-04-242-4/+1
| | | | | | This reverts commit ec00edd941953626ac027810f747847f68a71000. The nightly run time does not have Meson 0.54.
* Meson: Fix build when glib is built as subprojectXavier Claessens2020-04-222-1/+4
|
* Fix build reproducibilityJoshua Watt2019-12-111-4/+0
| | | | | | | | | | | | ba744068 ("Make meson.override_find_program working on more complex use cases") made the build no longer reproducible by encoding a build system path into the output. This shouldn't be necessary anyway, since it should be possible to add new paths to search for gir files by setting the XDG_DATA_DIR environment variable. Closes #318 Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
* girepository: Also store GType cache missesCarlos Garnacho2019-11-141-1/+14
| | | | | | | | | | | | | | | | | | | | | There are notably 4 classes of GTypes where a girepository lookup might fail: - GTypes from private interfaces in public objects (eg. MetaCullable in mutter) - GTypes for private base objects with public interfaces (eg. GLocalFile in GLib) - GTypes registered from the language, and presumably not coming from the GIR - GTypes of objects/interfaces that we didn't load a typelib for It is moot to look for those over and over again, and a full lookup can be taxing if looking up for a method/property on objects with those characteristics. It seems we can cache the misses too, so next lookups are just as quick as an introspected GType. The cache is invalidated after loading new typelibs, in case some of the previously missed GTypes is now properly introspected.
* girepository: Fix memory leakPhilip Chimento2019-10-101-0/+2
| | | | In g_irepository_get_object_gtype_interfaces()
* build: use proper dylib versioning on macOSTom Schoonjans2019-09-101-1/+11
|
* Make meson.override_find_program working on more complex use casesThibault Saunier2019-08-151-0/+4
| | | | | | | Add some missing `meson.override_find_program` And make sure that the `.gir` we build are found when used uninstalled as a concequence of `meson.override_find_program`.
* structinfo: Fix offset in find_method()Florian Müllner2019-08-141-4/+1
| | | | | | | | The current offset only considers the fields themselves, but not the optional embedded type that may follow each field. Use the existing helper function instead of computing the offset to fix the issue.
* meson: don't pass "install" to configure_file() unless really neededChristoph Reiter2019-07-261-1/+0
| | | | | | | | | | In our case it was never needed because it defaults to true if install_dir is set, which it always is for all calls. This avoids a warning when running with newer meson where it complains that install is only available with 0.50+. Fixes #298
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-191-1/+6
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.
* girepository: Return pointer array for interface cachePhilip Chimento2019-06-202-4/+4
| | | | | | | | | | | | | In g_irepository_get_object_gtype_interfaces(), returning the address of the first GIBaseInfo* does not work reliably, because the GIBaseInfos are not necessarily stored contiguously. So the second and subsequent ones might be garbage. Instead, return the address of the array of GIBaseInfo pointers. Add a test that verifies the functionality, as well. This is unfortunately an API and ABI break.
* build: Force-include msvc_recommended_pragmas.h on Visual StudioChun-wei Fan2019-04-302-31/+50
| | | | | | | | | | By doing so, we essentially cover the various compiler flags that we want to use for non-Visual Studio builds to check for warnings that might cause real concern. This also skips the checks for the various GCC-isque CFlag checks that are scattered in the various build files on Visual Studio builds, since they are essentially meaningless on Visual Studio builds.
* Fix a possible use-after-free.Elliott Sales de Andrade2019-02-021-1/+1
| | | | | | If g_mapped_file_new fails, then `version` will be freed, but it was already added to the hash table. This means there could be a use-after-free while doing a lookup on the hash table the next time.
* Fix possible leak of transitive dependency name.Elliott Sales de Andrade2019-02-021-1/+2
| | | | | | If a transitive dependency appears twice, the original pointer will be removed from the hash table. Since these names were created by g_strsplit, they need to be freed, or they will leak.
* repository: Fix annotation for g_irepository_get_object_gtype_interfaces()Rico Tzschichholz2019-01-161-2/+2
| | | | Introduced by 9826d952358c8330d72ecba062f489fbdc31bbd1
* repository: g_irepository_get_object_gtype_interfacesColin Walters2019-01-092-0/+105
| | | | | | | | | | | Bindings in some cases need to look up information from a GType dynamically. Support that better by supplying a cache for this information. (Rebased and versioning / gtk-doc stuff added by Philip Chimento.) Closes #38. See gjs#55.
* ci: enable -Werror for msys2+mesonChristoph Reiter2019-01-012-0/+3
|
* Cleanup strict-prototypes warningsTomasz Miąsko2018-12-203-5/+4
|
* meson: add default compiler warning flags and enable -Werror on CIChristoph Reiter2018-12-182-5/+40
| | | | | | | | This enables various compiler warnings project wide and disables the triggered ones for each library/executable. This should give us roughly the same behaviour as with autotools. Tested with gcc8 and clang7.
* meson: Use `copy` instead of an empty configurationEmmanuele Bassi2018-12-181-1/+1
| | | | | The configure_file target has grown a `copy` argument to avoid using an empty configuration_data object since Meson 0.47.
* girepository: Add version macros and functions. Fixes #200Christoph Reiter2018-12-165-1/+179
| | | | | | | | | | | This adds the following macros and functions: GI_MAJOR_VERSION, GI_MICRO_VERSION, GI_MINOR_VERSION, GI_CHECK_VERSION, gi_get_major_version,gi_get_micro_version, gi_get_minor_version. Since we share a prefix with glib we have to namespace these by using the gi_ prefix. g_gi would also work but we already export symbols with gi_ like gi_cclosure_marshal_generic(), gi_type_tag_get_ffi_type() and gi_type_info_extract_ffi_return_value(), so let's not add another naming scheme.
* baseinfo: don't abort when calling g_base_info_get_name() on a GITypeInfo. ↵Christoph Reiter2018-12-151-0/+1
| | | | | | | | | | Fixes #96 GITypeInfo is a GIBaseInfo so calling g_base_info_get_name() on it should do something sensible. g_base_info_get_name() has always been documented to return NULL in case no name is available so return that instead.
* giobjectinfo: Fix some documentation for find_vfunc_using_interfacesJasper St. Pierre2018-12-151-2/+2
| | | | See #66
* docs: Field offsets are in the units of bytesTomasz Miąsko2018-12-141-1/+1
|