Commit Graph

626 Commits

Author SHA1 Message Date
Christoph Reiter
06c8219cee meson: also build gi-dump-types on Windows 2020-05-19 19:39:34 +02:00
Gisle Vanem
1b5c989202 Use _get_oshandle() and g_win32_output_stream_new() instead since
`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?
2020-05-15 10:59:39 +00:00
Gisle Vanem
f7e4b797a8 Obs! Change back to g_unix_output_stream_new() for non-Win32. 2020-05-14 19:57:43 +00:00
Gisle Vanem
da7e635b71 [Win32] Fix gi-dump-types.c to build on Windows 2020-05-14 19:25:11 +00:00
Jonne Haß
d41f718dda Add missing nullable annotation to g_object_info_get_parent 2020-05-14 17:26:21 +02:00
Jonne Haß
47136da074 Add missing nullable annotation to g_irepository_get_shared_library 2020-05-14 17:24:08 +02:00
Philip Chimento
7daee7b90a girepository: Add GITypeInfo utility functions for storing values in pointers
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
2020-04-26 10:24:26 -07:00
Philip Chimento
8fcdeefb3a girepository: Add 1.66 version macro
Required for adding new API to the 1.66 series.
2020-04-26 10:21:04 -07:00
Xavier Claessens
74ff43c47f Revert "Revert "Meson: Fix build when glib is built as subproject""
This reverts commit 42b7d634a9a7500dcc71651f71844148fc200be3.
2020-04-24 15:05:03 -04:00
Emmanuele Bassi
3d39d61e3d Revert "Meson: Fix build when glib is built as subproject"
This reverts commit ec00edd941953626ac027810f747847f68a71000.

The nightly run time does not have Meson 0.54.
2020-04-24 11:52:45 +01:00
Xavier Claessens
75a1bb1e13 Meson: Fix build when glib is built as subproject 2020-04-22 21:15:45 -04:00
Joshua Watt
f257d2f891 Fix build reproducibility
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>
2019-12-11 18:30:14 +01:00
Carlos Garnacho
67a0f3e914 girepository: Also store GType cache misses
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.
2019-11-14 16:23:39 +00:00
Philip Chimento
fcc94454c1 girepository: Fix memory leak
In g_irepository_get_object_gtype_interfaces()
2019-10-10 13:34:23 -07:00
Tom Schoonjans
590421cf14 build: use proper dylib versioning on macOS 2019-09-10 12:49:04 +01:00
Thibault Saunier
ddaa2a9ec3 Make meson.override_find_program working on more complex use cases
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`.
2019-08-15 13:58:07 +00:00
Florian Müllner
e0f9f94a7e structinfo: Fix offset in find_method()
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.
2019-08-14 23:17:54 +02:00
Christoph Reiter
8958f167bf meson: don't pass "install" to configure_file() unless really needed
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
2019-07-26 18:18:23 +00:00
Mathieu Duponchelle
995d87db17 scanner: parse and expose function macros
This is useful for documentation tools, and other utilities that
rely on full introspection of the C API of a given library.
2019-07-19 01:21:38 +02:00
Philip Chimento
a458c66cbf girepository: Return pointer array for interface cache
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.
2019-06-20 11:54:10 -07:00
Chun-wei Fan
1a19f05a0e build: Force-include msvc_recommended_pragmas.h on Visual Studio
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.
2019-04-30 16:07:39 +08:00
Elliott Sales de Andrade
6747ec55dd Fix a possible use-after-free.
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.
2019-02-02 03:00:15 -05:00
Elliott Sales de Andrade
d17edde568 Fix possible leak of transitive dependency name.
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.
2019-02-02 03:00:15 -05:00
Rico Tzschichholz
4c0a8388d5 repository: Fix annotation for g_irepository_get_object_gtype_interfaces()
Introduced by 9826d952358c8330d72ecba062f489fbdc31bbd1
2019-01-16 21:04:26 +01:00
Colin Walters
8de3abd642 repository: g_irepository_get_object_gtype_interfaces
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.
2019-01-09 21:44:10 -08:00
Christoph Reiter
9b367e74ef ci: enable -Werror for msys2+meson 2019-01-01 18:06:47 +01:00
Tomasz Miąsko
b12b08df2f Cleanup strict-prototypes warnings 2018-12-20 17:34:38 +01:00
Christoph Reiter
13ba457c22 meson: add default compiler warning flags and enable -Werror on CI
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.
2018-12-18 21:39:33 +00:00
Emmanuele Bassi
cb1d599495 meson: Use copy instead of an empty configuration
The configure_file target has grown a `copy` argument to avoid using an
empty configuration_data object since Meson 0.47.
2018-12-18 12:32:53 +00:00
Christoph Reiter
487e670b1f girepository: Add version macros and functions. Fixes #200
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.
2018-12-16 12:51:58 +01:00
Christoph Reiter
db90b3b3ae baseinfo: don't abort when calling g_base_info_get_name() on a GITypeInfo. 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.
2018-12-15 23:33:32 +00:00
Jasper St. Pierre
e01e11be42 giobjectinfo: Fix some documentation for find_vfunc_using_interfaces
See #66
2018-12-15 11:09:23 +01:00
Tomasz Miąsko
292afa1d58 docs: Field offsets are in the units of bytes 2018-12-14 16:28:58 +01:00
Christoph Reiter
5e8e1a761e docs: Remove everything not related to libgirepository and restructure. Fixes #244
The gtk-doc docs were including some bits of overal g-i docs but mostly unfinished
and outdated.

We now have the general docs in sphinx so remove the duplication and make the gtk-docs
just about the libgirepository API and nothing more.

This also renames some titles and fixes some missing links in the struct hierarchy
while at it.
2018-12-14 11:29:11 +01:00
Christoph Reiter
722518e5bc docs: fix gtk-doc warnings and update version infos
Move things around and rename things until gtk-doc is happy.

This also moves the "Since" annotations to the next stable releases and
adds version added info for g_callable_info_get_instance_ownership_transfer()
and g_struct_info_find_field().
2018-12-09 18:26:26 +01:00
Thibault Saunier
4b32b6e116 writer: Include documentation and symbol position in source files
Some documentation tool (as hotdoc[0]) need to have information about
symbol declaration and documentation positions in the source files
to be able to do smart indexing (automatically build the documenation
index).

[0] https://hotdoc.github.io/

Fixes #175
2018-11-28 09:29:07 -03:00
Christoph Reiter
8c36d53cba girnode: remove wrongly added g_assert_not_reached(). Fixes #218
Added in 9535fc48. After the switch it calls _g_ir_node_build_typelib() again
handling the other types.
2018-08-03 08:06:08 +02:00
Christoph Reiter
a060582afe girepository: port from g_type_class_add_private() to G_ADD_PRIVATE()
This lets us enable -Wdeprecated-declarations
2018-07-30 07:53:01 +02:00
Christoph Reiter
cff8329f70 build: enable -Wredundant-decls
The ffi decls were added in cbdd9ee09e367e4dd to work around broken
ffi headers. Let's assume this is fixed now.
2018-07-29 18:57:03 +02:00
Christoph Reiter
a718ebac86 build: enable -Wswitch-default
In case the surrounding code handles missing cases break, otherwise add
a g_assert_not_reached().

The generated parser code triggers this as well, so disable it there only.
2018-07-29 18:57:03 +02:00
Christoph Reiter
7be196f295 build: enable -Wtype-limits
hashv is unsigned, no need to check if >= 0
2018-07-29 18:57:03 +02:00
Christoph Reiter
f02e90f265 build: enable -Wimplicit-fallthrough
and fix a missplaced break
2018-07-29 18:57:03 +02:00
Christoph Reiter
3a5b0c2ae2 build: enable -Wshadow 2018-07-29 18:57:03 +02:00
Christoph Reiter
7cdf5d0d1d build: enable -Wcast-function-type
Where it's easy add dummy args to match the cast; where the target is a subset just
prevent the warning with a cast to void*.

Provide a real copy function for the boxed type code in regress_foo.
This code is never executed afaics, but why not.
2018-07-29 18:56:58 +02:00
Christoph Reiter
ee2ec3343e build: enable -Wsuggest-attribute=format
And use G_GNUC_PRINTF for the suggested function.
2018-07-29 16:50:19 +02:00
Christoph Reiter
573fe41788 build: enable -Wdouble-promotion 2018-07-29 16:49:53 +02:00
Christoph Reiter
9018e7b13c build: enable -Wincompatible-pointer-types 2018-07-29 16:49:23 +02:00
Christoph Reiter
16f2c2ad0b build: enable -Wdiscarded-qualifiers
Except for the Python module because nothing in the CPython API is marked const
and we'd have to cast everywhere.
2018-07-29 16:48:18 +02:00
Rico Tzschichholz
c704898e26 gdump: Fix print-format error while GFlagsValue->value is an unsigned int 2018-07-04 16:56:32 +02:00
Chun-wei Fan
4dafb4d5cf girepository: Properly acquire and check pointer values
On Windows (Visual Studio at least), unsigned longs are always 4 bytes,
on both 32-bit and x64 Windows, so we cannot use unsigned longs to deal
with pointers on 64-bit builds, as pointers are 8 bytes on 64-bit
Windows, which may well render the pointer (which we acquired from
libffi) invalid.

This will fix crashes in PyGObject which are manifested when launching
the cairo-demo example sript (intermittent) and when clicking on
"Interactive Dialog" button in the Dialog demo in the PyGObject GTK+
Code demos before entering anything in Entry 1 and Entry 2, when running
on x64 Visual Studio builds of the GTK+/PyGObject stack.

Also use size_t instead of unsigned long in gthash.c when we check that
memory & 0x3 is 0, to silence compiler warnings from enabling /Wp64,
which is used to detect portability problems on Visual Studio when
doing x86->x64 code builds.

https://bugzilla.gnome.org/show_bug.cgi?id=702788
2018-04-20 18:26:08 +02:00