Commit Graph

23442 Commits

Author SHA1 Message Date
Emmanuele Bassi
b3981e97ac Merge branch 'format-diff-many-files-better-than-one' into 'master'
clang-format-diff: Output diff for multiple files, not just one

See merge request GNOME/glib!1280
2019-12-16 12:41:55 +00:00
Emmanuele Bassi
829ec978ed Merge branch '650-signal-lookup-warnings' into 'master'
gsignal: Drop unnecessary warnings from g_signal_lookup()

Closes #650

See merge request GNOME/glib!1247
2019-12-16 12:41:31 +00:00
Emmanuele Bassi
a172aa3662 Merge branch '1130-codegen-docs' into 'master'
Resolve "gdbus-codegen: Add an option to strictly generate markdown in source comments"

Closes #1130

See merge request GNOME/glib!1264
2019-12-16 12:39:23 +00:00
Emmanuele Bassi
4ad429c7ca Merge branch 'revert-1277-i-got-it-wrong' into 'master'
Revert "Revert "docs: remove GDBusObjectManager example""

See merge request GNOME/glib!1282
2019-12-16 12:37:34 +00:00
Philip Withnall
a097342ae9 Merge branch 'autocleanup-class' into 'master'
gtype: Define auto-cleanup functions for Module class

See merge request GNOME/glib!1289
2019-12-16 12:13:08 +00:00
Philip Withnall
7aa91a0289 Merge branch 'th/atomic-compare-and-exchange' into 'master'
atomic/tests: test g_atomic_pointer_compare_and_exchange() with const pointers

See merge request GNOME/glib!1287
2019-12-16 11:14:58 +00:00
Philip Withnall
8deebeca17 Merge branch 'master' into 'master'
Fix typo: threfore -> therefore

Closes #1961

See merge request GNOME/glib!1285
2019-12-13 23:48:25 +00:00
Marco Trevisan (Treviño)
ab25fa42cc gtype: Define auto-cleanup functions for Module class
While we automatically define cleanup functions for the module, we don't
do it for the module class.

This will allow to manage the ownership of the class when reffing it
without having to cast it to GTypeClass.
2019-12-13 20:07:51 +01:00
Thomas Haller
ef9ce8ea00 atomic/tests: test g_atomic_pointer_compare_and_exchange() with const pointers
g_atomic_pointer_compare_and_exchange() should work with const pointers.
Add a test for that.

It seems clang 9.0.0-2.fc32 does not like this:

    ../glib/tests/atomic.c:93:9: warning: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'const char **' [-Wincompatible-pointer-types]
      res = g_atomic_pointer_compare_and_exchange (&vp_str, NULL, str);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
        __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                               ^~~~~~~~~~~~~~
    ../glib/tests/atomic.c:96:9: warning: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'const char **' [-Wincompatible-pointer-types]
      res = g_atomic_pointer_compare_and_exchange (&vp_str_vol, NULL, str);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../glib/gatomic.h:192:44: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
        __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                               ^~~~~~~~~~~~~~

Note that this clang version already issues various compiler warnings for
this test. This merely adds another case to check.

Eventually g_atomic_pointer_compare_and_exchange() should be fixed to
avoid compiler warnings.

Actually there is a problem. When you try to use g_atomic_pointer_compare_and_exchange()
with const pointers, it is also not working, because the implementation
as a function expects "void *" arguments. As the test also shows. As such,
it's probably not portable to use g_atomic_pointer_compare_and_exchange()
with const pointers at all. However, the macro implementation is (with the right
compiler) fine with that, so it's an easy "mistake" to make.
2019-12-13 15:07:35 +01:00
Christoph Reiter
a8263add45 Merge branch 'fix-gio-module-path-msvc' into 'master'
giomodule: gio modules are no longer installed in bindir on MSVC

See merge request GNOME/glib!1254
2019-12-12 18:29:07 +00:00
Philip Withnall
1810c80832 Merge branch 'piotrdrag/update-potfiles-191212' into 'master'
Update POTFILES.in 191212

See merge request GNOME/glib!1284
2019-12-12 16:39:47 +00:00
Yaobin Wen
639b426742 Fix typo: threfore -> therefore
Closes GNOME/glib#1961
2019-12-12 16:33:33 +00:00
Patrick Welche
62f6c80e63 gmodule: change _g_module_close to only take a handle.
Since is_unref |= 1, the second argument, gboolean is_unref, has had
no effect.
2019-12-12 16:15:05 +00:00
Piotr Drąg
aeb85dd3cf Update POTFILES.in 2019-12-12 17:13:00 +01:00
Philip Withnall
407eae1969 Merge branch 'ptr-array-steal-example' into 'master'
gptrarray: Add an example to the g_ptr_array_steal() docs

See merge request GNOME/glib!1172
2019-12-12 13:08:03 +00:00
Philip Withnall
a07bc20557 gsignal: Drop unnecessary warnings from g_signal_lookup()
The `G_TYPE_IS_INSTANTIATABLE()` check is redundant with a precondition
on the function.

The `g_type_class_peek()` check seems like a pointless restriction: it
should be possible to check for a signal from a class init function.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #650
2019-12-12 13:00:54 +00:00
Emmanuele Bassi
f9bbee7db2 Merge branch '1726-codegen-glib-min-version' into 'master'
gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/ min-version

Closes #1726

See merge request GNOME/glib!1263
2019-12-12 12:49:34 +00:00
Emmanuele Bassi
ec3589b93f Merge branch 'signal-underscores' into 'master'
Signal name handling improvements

See merge request GNOME/glib!1224
2019-12-12 12:10:55 +00:00
Philip Withnall
4c20fb990a gptrarray: Add an example to the g_ptr_array_steal() docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-12 11:59:59 +00:00
Philip Withnall
9ec69ae6af clang-format-diff: Output diff for multiple files, not just one
A bug in `clang-format-diff.py` was causing it to only output the
formatting diff for the first incorrectly-formatted file, rather than
the diffs for all files.

That’s not so helpful for reformatting an entire MR in one go. Fix it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-12 11:43:23 +00:00
Philip Withnall
742a7b125e clang-format-diff: Reformat script to satisfy PEP8 and pylint
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-12 11:43:23 +00:00
Philip Withnall
df8745fabc Revert "Revert "docs: remove GDBusObjectManager example""
This reverts commit df4fb2cd32.

It needed to be coupled with the other commit from !978, and introduces
breakage into the documentation when compiled by itself. My mistake for
not testing properly.

See discussion on https://gitlab.gnome.org/GNOME/glib/merge_requests/1277#note_666761
2019-12-12 11:30:36 +00:00
Philip Withnall
2efa399abd Merge branch 'wip/hadess/update-installed-tests-ci' into 'master'
Update installed tests CI

See merge request GNOME/glib!1278
2019-12-12 10:34:37 +00:00
Bastien Nocera
5a174d105d ci: Fix permission error in valgrind analysis stage
The valgrind analysis stage inherits from existing artefacts, so make
sure to reset the permissions on the glib build directory to avoid a new
build failing.

$ meson ${MESON_COMMON_OPTIONS} --werror -Dsystemtap=true -Ddtrace=true -Dfam=true -Dinstalled_tests=true _build
<snip>
PermissionError: [Errno 13] Permission denied: '/builds/GNOME/glib/_build/meson-logs/meson-log.txt'
2019-12-12 10:59:47 +01:00
Bastien Nocera
c782042087 ci: Disable xdg-desktop-portal tests
They're not needed to actually run xdg-desktop-portal itself, and
we won't need libportal then.
2019-12-11 15:23:31 +01:00
Bastien Nocera
4b6ad93c86 ci: GMemoryMonitor support is now merged in gobject-introspection 2019-12-11 15:12:01 +01:00
Bastien Nocera
5a58da36d2 ci: Fix installed-tests until a newer GLib is released
Force-enable portal memory monitor until 2.63.3 is released
2019-12-11 14:15:54 +01:00
Bastien Nocera
bf91e3adf7 ci: GMemoryMonitor support is now merged in xdg-desktop-portal 2019-12-11 14:15:54 +01:00
Philip Withnall
fcc1367383 Merge branch 'gtkdoc-check-fix' into 'master'
Various gtk-doc improvements

See merge request GNOME/glib!1277
2019-12-11 13:02:20 +00:00
Philip Withnall
2f6010eabf Merge branch 'wip/hadess/add-dbus-tests-debug' into 'master'
tests: Enable GDBus debug for a number of unreliable tests

See merge request GNOME/glib!1271
2019-12-11 12:52:55 +00:00
Philip Withnall
cedeccec85 Merge branch 'wip/hadess/add-memory-monitor' into 'master'
gio: Add GMemoryMonitor to monitor for low-memory

See merge request GNOME/glib!1005
2019-12-11 12:31:53 +00:00
Philip Withnall
7a3c4a415c gtask: Fix GIR annotation
Spotted by gtk-doc.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-11 12:30:47 +00:00
Xavier Claessens
df4fb2cd32 Revert "docs: remove GDBusObjectManager example"
This reverts commit 398c048c66.

It got removed because it used to cause build issues, but now that we
have a CI let's hope it won't be a problem any more.
2019-12-11 12:16:27 +00:00
Philip Withnall
fa4cbfdd94 glib: Sort #includes in top-level header files
This should shut the code style checker up every time someone adds a new
`#include`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-12-11 11:48:41 +00:00
Bastien Nocera
9ea7947e22 tests: Disable another timeout test by default
Don't run this timeout test unless "thorough" tests are requested.

See commit 3894335dc6
2019-12-11 11:44:42 +00:00
Bastien Nocera
8e8ee82580 tests: Add GMemoryMonitor installed-tests
Those tests require Python, gobject-introspection and python-dbusmock
making them unsuitable to be run within the uninstalled test suite.

There are no restrictions of dependencies when it comes to installed
tests so use those to exercise GMemoryMonitor.
2019-12-11 11:44:42 +00:00
Bastien Nocera
ae26695843 ci: Add dependencies for newer installed tests 2019-12-11 11:44:42 +00:00
Bastien Nocera
e08b10e997 gio: Add stub test program for GMemoryMonitor
"memory-monitor --watch" will watch over any events coming from either
low-memory-monitor or the portal.
2019-12-11 11:44:42 +00:00
Bastien Nocera
cd6612dfb7 gio: Add GMemoryMonitor to monitor for low-memory
Add a memory monitor object, with D-Bus and Portal based
implementations. The D-Bus implementation uses the Linux-only
low-memory-monitor Freedesktop project.

Low Memory Monitor D-Bus API:
https://hadess.pages.freedesktop.org/low-memory-monitor/

Android API:
https://developer.android.com/reference/android/content/ComponentCallbacks2.html#onTrimMemory(int)

iOS API:
https://developer.apple.com/documentation/uikit/app_and_environment/managing_your_app_s_life_cycle/responding_to_memory_warnings

Win32 API:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.systemevents.lowmemory?view=netframework-4.8

Tizen API:
https://samsung.github.io/TizenFX/master/api/Tizen.Applications.EventManager.SystemEvents.LowMemory.html
2019-12-11 11:44:42 +00:00
Philip Withnall
8f5d2c370d Merge branch 'gdate-copy-fixes' into 'master'
gdate: Add autoptr support

See merge request GNOME/glib!1256
2019-12-11 11:02:42 +00:00
Philip Withnall
57409724c6 Merge branch 'trash-portal-symlinks' into 'master'
trash portal: Don't follow symlinks

See merge request GNOME/glib!1274
2019-12-11 10:51:15 +00:00
Philip Withnall
37449ce072 Merge branch 'actiongroup-docs' into 'master'
Small doc correction

See merge request GNOME/glib!1275
2019-12-11 10:49:43 +00:00
Bastien Nocera
145dc5a49e gdbus: Fix runtime warning with debug enabled
With debug enabled, g_dbus_connection_call_done() will throw a
g_warning() if the call failed (on purpose or not) while trying to the
serial of a non-existant reply.

(/builds/GNOME/glib/_build/gio/tests/gdbus-connection:26921): GLib-GIO-CRITICAL **: 10:10:16.311: g_dbus_message_get_reply_serial: assertion 'G_IS_DBUS_MESSAGE (message)' failed
2019-12-11 11:42:03 +01:00
Philip Withnall
e3f80b9254 gdbus-codegen: Emit GUnixFDLists if an arg has type h w/ min-version
This is a reimplementation of commit
4aba03562b from Will Thompson, but
conditional on the caller passing `--glib-min-version 2.64` to
`gdbus-codegen` to explicitly opt-in to the new behaviour.

From the commit message for that commit:

Previously, if a method was not annotated with org.gtk.GDBus.C.UnixFD
then the generated code would never contain GUnixFDList parameters, even
if the method has 'h' (file descriptor) parameters. However, in this
case, the generated code is essentially useless: the method cannot be
called or handled except in degenerate cases where the file descriptors
are missing or ignored.

Check the argument types for 'h', and if present, generate code as if
org.gtk.GDBus.C.UnixFD annotation were specified.

Includes a unit test too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1726
2019-12-11 10:40:07 +00:00
Philip Withnall
90f0733858 gdbus-codegen: Add a --glib-min-version argument
This can be used by callers to opt-in to backwards-incompatible changes
to the behaviour or output of `gdbus-codegen` in future. This commit
doesn’t introduce any such changes, though.

Documentation and unit tests included.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1726
2019-12-11 10:40:07 +00:00
Bastien Nocera
8fd71dccc5 tests: Enable GDBus debug for a number of unreliable tests
As those tests keep failing in the CI, enable GDBus debugging to catch
some debug leads when the problems happen.
2019-12-11 11:04:10 +01:00
Bastien Nocera
5ed4e18bdf Merge branch 'wip/hadess/log-successful-installed-tests' into 'master'
ci: Work-around successful installed tests having no logs

See merge request GNOME/glib!1268
2019-12-11 10:02:11 +00:00
Bastien Nocera
8520163bdf ci: Work-around successful installed tests having no logs
This works around a bug in gnome-desktop-testing.

See: https://gitlab.gnome.org/GNOME/gnome-desktop-testing/merge_requests/2
2019-12-11 10:32:13 +01:00
Matthias Clasen
c3ab139841 trash portal: Don't follow symlinks
We got a complaint here that trashing via the
portal deletes the target of a symlink, not the
symlink itself. It turns out that following the
symlink already happens on the glib side.

https://github.com/flatpak/xdg-desktop-portal/issues/412
2019-12-10 15:16:33 -05:00
Matthias Clasen
1503cfa36e Small doc correction
Add a transfer annotation to some GActionGroup apis.
2019-12-10 15:15:13 -05:00