Commit Graph

21006 Commits

Author SHA1 Message Date
Peter Wu
a3d90c0726 gatomic: Fix false positive with Clang+TSAN
__atomic_load_8 and friends do not exist under clang. Use the generic
__atomic_load variant instead that are documented here:
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

These have the additional benefit that the exact size of gint (4 bytes)
or gpointer (4 or 8 bytes) no longer have to be checked.

I initially tried `__typeof__(*(atomic)) val;`, but that caused warnings
in Clang (-Wincompatible-pointer-types-discards-qualifiers) when
"atomic" points to a volatile variable. Aside from that, it is
apparently not supported everywhere, see the g_has_typeof macro.
Another reason not to use it are new warnings under Clang, including:

    glib/deprecated/gthread-deprecated.c:683:11: warning: incompatible pointer types initializing 'typeof (*(&mutex->mutex.mutex))' (aka 'union _GMutex *') with an expression of type 'GRecMutex *' (aka 'struct _GRecMutex *') [-Wincompatible-pointer-types]
              g_atomic_pointer_set (&mutex->mutex.mutex, result);

Hence, cast the atomic variable to gint/gpointer pointers, the size was
already statically asserted so the cast should be safe.

The macros use a (hopefully) rare "gaps_temp" name instead of something
like "val" to avoid an issue with GCC builds:

    glib/tests/once.c:123:test_once4: assertion failed (val == "foo"): (NULL == "foo")

Closes #1843
2019-07-26 02:11:35 +01:00
Philip Withnall
78b1278d44 Merge branch '488-assert-gobjects-dont-leak' into 'master'
gobject: Add a g_assert_finalize_object() macro

Closes #1780 and #488

See merge request GNOME/glib!859
2019-07-25 15:42:39 +00:00
Philip Withnall
b6d4da7684 tests: Use g_object_assert_last_unref() in various tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-25 15:23:21 +01:00
Simon McVittie
b76bf3ca72 gobject: Add a g_assert_finalize_object() macro
With modifications by Philip Withnall.

Fixes: #488
2019-07-25 15:23:21 +01:00
Emmanuele Bassi
17be9e5c4c Merge branch '436-test-coredumps' into 'master'
Fix tests creating coredumps

Closes #436

See merge request GNOME/glib!959
2019-07-25 13:49:09 +00:00
Emmanuele Bassi
298ee8f87c Merge branch '1791-macos-get-mime-dirs' into 'master'
gcontenttype: Add no-op versions of {get,set}_mime_dirs() on win32/macOS

Closes #1791

See merge request GNOME/glib!927
2019-07-25 13:48:04 +00:00
Philip Withnall
3de1b88339 gcontenttype: Add no-op versions of {get,set}_mime_dirs() on win32/macOS
These are here to prevent linker errors, since `gcontenttype.[ch]`
aren’t compiled on Windows or macOS.

The implementations are stubs to be filled out by someone who knows each
platform, at some point in the future.

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

Fixes: #1791
2019-07-24 14:50:53 +01:00
Philip Withnall
0c0cf59858 Merge branch 'meson-bump' into 'master'
Bump the required version of Meson

See merge request GNOME/glib!924
2019-07-24 12:57:32 +00:00
Emmanuele Bassi
bd372e3174 ci: Fix non-build jobs
All non-build jobs must share the same Docker image with the Fedora
build job.
2019-07-24 13:32:55 +01:00
Emmanuele Bassi
85dc45e548 build: Bump up the required version of Meson
We cannot bump to the latest stable version of Meson, even if it would
make our life easier. We can, though, use the version of Meson shipped
by the next, soon to be released Debian stable.
2019-07-24 13:08:06 +01:00
Emmanuele Bassi
f0d713e50d ci: Use the new Docker images 2019-07-24 13:08:06 +01:00
Emmanuele Bassi
fa6f2d4516 ci: Update the MSYS2 build script 2019-07-24 13:08:06 +01:00
Emmanuele Bassi
772a6e3262 ci: Update the MSVC build script 2019-07-24 13:08:06 +01:00
Emmanuele Bassi
f6b4012c9d ci: Update the MingW Docker image 2019-07-24 13:08:06 +01:00
Emmanuele Bassi
ed7c258996 ci: Update the Android NDK Docker image 2019-07-24 13:08:06 +01:00
Emmanuele Bassi
14d2c4872e ci: Update Fedora's Docker image
Match the version of Meson we install with the one we require.
2019-07-24 13:08:06 +01:00
Emmanuele Bassi
9fdc27657d ci: Update Debian's Docker image
New stable release of Debian is out, and we need to bump the version of
Meson to match our requirements.
2019-07-24 13:08:06 +01:00
Emmanuele Bassi
00d7568e4f build: Remove unsupported install directives
We're using the `install` argument for configure_file() all over the
place.

The support for an `install` argument for configure_file() was added in
Meson 0.50, but we haven't bumped the minimum version of Meson we
require, yet; which means we're getting compatibility warnings when
using recent versions of Meson, and undefined behaviour when using older
versions.

The configure_file() object defaults to `install: false`, unless an
install directory is used. This means that all instances of an `install`
argument with an explicit `true` or `false` value can be removed,
whereas all instances of `install` with a value determined from a
configuration option must be turned into an explicit conditional.
2019-07-24 12:45:02 +01:00
Simon McVittie
3f1a79a4fa Merge branch 'allow_guid_key_in_dbus_addresses' into 'master'
Allow guid key in dbus addresses

Closes #1018

See merge request GNOME/glib!995
2019-07-23 13:01:09 +00:00
Nirbheek Chauhan
c50304fdc6 Merge branch 'master' into 'master'
Add (out) annotation to (optional) parameters

Closes #1837

See merge request GNOME/glib!999
2019-07-23 12:14:18 +00:00
Дилян Палаузов
74583affe0 Add (out) annotation to (optional) parameters
… as the parameters are not (inout).

Closes #1837
2019-07-23 11:41:42 +00:00
Philip Withnall
b649946c00 gdbusconnection: Clarify nullability in a documentation comment
The comment previously said ‘never %NULL’, but it wasn’t clear whether
this meant `(not nullable)` or `(not optional)`. From looking at the
code, it means `(not optional)`.

Clarify things by removing the prose. The annotations themselves should
be clear and explicit enough.

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

Closes: #1836
2019-07-23 11:34:59 +01:00
Emmanuele Bassi
ab544aa8c0 docs: Remove mentions of mailing lists
And drop FTP from the list of places where to find release archives.
This is not 1998.
2019-07-23 11:27:30 +01:00
Emmanuele Bassi
4d73e1f014 Use GitLab to reserve a new fundamental type slot
Even though you *really* shouldn't do that at all.
2019-07-23 11:27:30 +01:00
Emmanuele Bassi
bcf208ba4c Bugs should be reported on GitLab
Not on mailing lists that do not exist any more.
2019-07-23 11:27:30 +01:00
Emmanuele Bassi
6a207c329f doap: Update the <mailing-list> element 2019-07-23 11:27:30 +01:00
Emmanuele Bassi
dd42b8f01f docs: Remove mentions of mailing lists
We use a tag on Discourse, now.
2019-07-23 11:27:30 +01:00
Emmanuele Bassi
11715d17db docs: The mailing lists are no more
Don't send people to mailing lists that do not exist any more. We moved
to Discourse.
2019-07-23 11:05:17 +01:00
Rafael Fontenelle
8c5a14adf3 Update Brazilian Portuguese translation 2019-07-22 03:28:50 +00:00
Emmanuele Bassi
204c6255e4 Merge branch 'fix_G_DECLARE_DERIVABLE_TYPE_documentation' into 'master'
Fix typo in G_DECLARE_DERIVABLE_TYPE documentation

Closes #1838

See merge request GNOME/glib!1000
2019-07-20 14:38:43 +00:00
Emmanuel Fleury
79da3551e3 Fix typo in G_DECLARE_DERIVABLE_TYPE documentation
Closes issue #1838
2019-07-20 16:05:12 +02:00
Philip Withnall
249299a76f Merge branch 'doc-fixes' into 'master'
Various doc fixes

See merge request GNOME/glib!982
2019-07-17 10:58:21 +00:00
Philip Withnall
fa4423d435 Merge branch 'clang-cl-support' into 'master'
Experimental clang-cl support

See merge request GNOME/glib!979
2019-07-17 10:30:28 +00:00
Philip Withnall
81b1ff8300 Merge branch 'atomic' into 'master'
fix atomic detection on older gcc versions

See merge request GNOME/glib!991
2019-07-17 10:22:00 +00:00
Stefan Sauer
77cc96ae88 Update the instructions in .gitlab-ci.
These where a copied, but not adapted. This is similar to a change in the
gtkdoc module.
2019-07-16 21:12:24 -07:00
Philip Withnall
f6666f5e09 Merge branch 'dbus-address-transfer-annotation' into 'master'
gdbusaddress: Add missing transfer annotation

See merge request GNOME/glib!997
2019-07-16 21:07:20 +00:00
Matthew Leeds
0c495f3dbf gdbusaddress: Add missing transfer annotation 2019-07-16 13:43:20 -07:00
Emmanuele Bassi
298c6adf32 Merge branch 'docs-examples' into 'master'
docs: Add example to g_test_summary() documentation

See merge request GNOME/glib!992
2019-07-16 13:51:41 +00:00
Philip Withnall
c0f13f3cc8 garray: Fix binary search for non-existent elements on the left
If searching for an element which is smaller than every element in the
array (i.e. the element being searched for is not in the array), the
previous g_array_binary_search() implementation would underflow in the
calculation `right = middle - 1`, and end up trying to dereference an
element way off the right of the array.

Fix that by checking the additions/subtractions before doing them, and
bailing if the bounds are hit. We don’t need to check `middle <
G_MAXUINT`, as `middle` is bounded above by `right`, which is always `<=
_array->len - 1`, and `_array->len <= G_MAXUINT`.

Add some tests for that, and for not-present elements in the middle of
the array. Previously, the tests only checked for not-present elements
which were bigger than every element in the array.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 12:14:53 +01:00
Philip Withnall
ec61daf503 garray: Rewrite binary search calculation to avoid integer overflow
If `right` and `left` are both near `G_MAXUINT`, it’s possible for the
addition to overflow, even if the eventual result would fit in a
`guint`. Avoid that by operating on the difference instead.

The difference is guaranteed to be positive due to the prior `left <=
right` check.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 11:35:18 +01:00
Philip Withnall
bc0fcddc18 tests: Use g_ptr_array_set_free_func() rather than manual free()
We don’t need to free array elements manually.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:17:20 +01:00
Philip Withnall
121b6bc599 tests: Add missing array length checks
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:17:08 +01:00
Philip Withnall
625055f60e tests: Fix array length calculations in array tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:16:41 +01:00
Philip Withnall
b4943aa360 gptrarray: Correctly set copied array length in g_ptr_array_copy()
The allocation size was set correctly before, but not the array length,
so the copied array appeared to have zero elements.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:15:57 +01:00
Philip Withnall
1ac8d50331 gptrarray: Set free func on copied array in g_ptr_array_copy()
Otherwise its elements (which have just all been copied) will leak.

Spotted by Xavier Claessens in
https://gitlab.gnome.org/GNOME/glib/merge_requests/918#note_555867.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-16 10:15:09 +01:00
Emmanuel Fleury
6a1512ed65 Allow guid key in dbus addresses
Original patch from William Hua

Fix issue #1018
2019-07-16 10:34:42 +02:00
Nirbheek Chauhan
d076c4c688 Merge branch 'gio-docs-fixes' into 'master'
gio: Fix minor docs mistakes

See merge request GNOME/glib!994
2019-07-15 23:39:18 +00:00
Matthew Leeds
ce9ea30b1d gio: Fix minor docs mistakes 2019-07-15 16:07:18 -07:00
Philip Withnall
2ac44f3111 Merge branch 'key-file-no-file' into 'master'
key file: Handle filename being NULL

Closes #1825

See merge request GNOME/glib!984
2019-07-15 12:50:45 +00:00
Philip Withnall
493b8ca021 Merge branch 'keyfile-portal-fixes' into 'master'
Keyfile portal fixes

See merge request GNOME/glib!985
2019-07-15 12:32:01 +00:00