Commit Graph

18663 Commits

Author SHA1 Message Date
Philip Withnall
27eb6b4290 tests: Compare month names case-insensitively in date tests
This has the same rationale as the corresponding change to the gdatetime
tests; commit 9cadb90b35.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

https://gitlab.gnome.org/GNOME/glib/issues/1447
2018-07-17 20:51:47 +02:00
Emmanuele Bassi
bb8420f117 Merge branch 'coverity' into 'master'
Minor memory leak fixes from Coverity

See merge request GNOME/glib!184
2018-07-17 10:29:26 +00:00
Philip Withnall
e487df31e1 gvariant: Fix some memory leaks on error paths
Coverity CID: #1393955
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2018-07-17 12:14:36 +02:00
Philip Withnall
b5948c1a39 gsettings: Fix some memory leaks on error paths
Coverity CID: #1393949
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2018-07-17 12:14:07 +02:00
Philip Withnall
2c79b357b2 gio-tool: Fix a memory leak when returning command line help
Coverity CID: #1393952
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2018-07-17 12:13:21 +02:00
Philip Withnall
7f55c768ce Merge branch '1444-install-tests' into 'master'
Install unit tests

Closes #1444

See merge request GNOME/glib!183
2018-07-17 09:51:12 +00:00
Philip Withnall
16c6a73586 Merge branch 'add-g-has-typeof-1440' into 'master'
gmacros: Add new private g_has_typeof to abstract __typeof__ checks

Closes #1440

See merge request GNOME/glib!172
2018-07-17 09:27:12 +00:00
Philip Withnall
4dc6a01241 Merge branch 'type-safe-g-clear-pointer-1425' into 'master'
Type safe g clear pointer 1425

Closes #1425

See merge request GNOME/glib!177
2018-07-17 09:23:29 +00:00
Xavier Claessens
1bba3276bb Meson: Install glib tests
Fixes: #1444.
2018-07-16 15:36:20 -04:00
Xavier Claessens
a84cbf1434 Meson: Group all glib tests into a single dict 2018-07-16 15:33:58 -04:00
Xavier Claessens
5f3db543f8 Meson: Remove hack that got fixed a while ago 2018-07-16 15:04:03 -04:00
Xavier Claessens
f456e311cd Meson: Use environment() for test_env 2018-07-16 15:04:03 -04:00
Iain Lane
4c621fb7ee gmacros: Add new private g_has_typeof to abstract __typeof__ checks
We have this same check in a few places now, and we might as well
abstract it out.

Fixes #1440.
2018-07-16 15:59:44 +01:00
Iain Lane
f9a9902aac gmem.h: Use __typeof__() in the g_clear_pointer() macro
Type punning is used on the existing implementation, which hides errors
such as:

  GSList *list = NULL;
  g_clear_pointer (&list, g_error_free);

Let's use __typeof__ to cast the passed-in pointer before it's passed to
the free function so it trips -Wincompatible-pointer-types if it's wrong.

Fixes #1425
2018-07-16 15:34:27 +01:00
Mario Blättermann
8d2d0a8aa1 Update German translation 2018-07-14 19:08:10 +00:00
Emmanuele Bassi
d91d18cc78 Merge branch '976-disable-assert-checks' into 'master'
Document difference between g_assert() and g_assert_*() wrt G_DISABLE_ASSERT

Closes #976

See merge request GNOME/glib!174
2018-07-13 16:00:18 +00:00
Xavier Claessens
c96f987f0d Merge branch '786-gio-test-leaks' into 'master'
Fix memory leaks in libgio tests and ensure tests are run under Meson

Closes #786

See merge request GNOME/glib!151
2018-07-13 15:46:21 +00:00
Philip Withnall
b9d390dc44 Merge branch 'indentation_correction_gspawn' into 'master'
gspawn: correct indentation in do_posix_spawn

See merge request GNOME/glib!180
2018-07-13 12:21:13 +00:00
Thomas Hindoe Paaboel Andersen
102bcaffa2 gspawn: correct indentation in do_posix_spawn
The indentation was slightly wrong for this section when introduced
in commit 61f54591ac
2018-07-13 13:37:11 +02:00
Philip Withnall
b7f7f75bf1 Merge branch '889-stdiowrappers-symlink-failure' into 'master'
tests: Fix running fileutils test in cwd which is a symlink

Closes #889

See merge request GNOME/glib!170
2018-07-13 11:20:53 +00:00
Philip Withnall
24c5f98c91 Merge branch 'python-none-equality' into 'master'
python: avoid equality check for None

See merge request GNOME/glib!179
2018-07-12 22:25:53 +00:00
Thomas Hindoe Paaboel Andersen
a8b416f9fe python: avoid equality check for None
PEP8 says that:
"Comparisons to singletons like None should always be done with is or
is not, never the equality operators."

glib uses a mix of "== None" and "is None". This patch changes all
cases to the latter.
2018-07-12 23:48:41 +02:00
Philip Withnall
c557c6de81 Merge branch 'gitlab-ci-freebsd-manual' into 'master'
ci: switch the freebsd-11 job to manual mode

See merge request GNOME/glib!178
2018-07-12 09:27:13 +00:00
Christoph Reiter
31d34c22d2 ci: switch the freebsd-11 job to manual mode
So it doesn't block the pipeline until it times out.
According to the runner info page it hasn't been up for 16 days.
2018-07-12 11:05:56 +02:00
Iain Lane
2aacef39b1 gobject: Make g_clear_object take a non-volatile GObject **
The implementation is silently discarding this anyway, and
g_object_unref() is using atomic operations. So this should be safe.

Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer()
is fixed to use __typeof__().
2018-07-12 08:47:40 +01:00
Emmanuele Bassi
449dcca106 Merge branch 'revert-08f41d80' into 'master'
Revert "Merge branch 'type-safe-g-clear-pointer-1425' into 'master'"

See merge request GNOME/glib!176
2018-07-11 22:05:47 +00:00
Emmanuele Bassi
d3881bb1bf Revert "Merge branch 'type-safe-g-clear-pointer-1425' into 'master'"
This reverts merge request !165
2018-07-11 21:52:31 +00:00
Matej Urbančič
aa6721f1ee Updated Slovenian translation 2018-07-11 21:12:00 +02:00
Emmanuele Bassi
bdf70242b7 Merge branch '640-appinfo-skip-display' into 'master'
tests: Fix skipping of appinfo tests when DISPLAY is unset

Closes #640

See merge request GNOME/glib!171
2018-07-11 18:08:48 +00:00
Philip Withnall
08f41d802a Merge branch 'type-safe-g-clear-pointer-1425' into 'master'
gmem.h: Use __typeof__() in the g_clear_pointer() macro

Closes #1425

See merge request GNOME/glib!165
2018-07-11 15:57:55 +00:00
Philip Withnall
ca23acdb24 gtestutils: Bail out of g_test_init() if G_DISABLE_ASSERT is defined
If G_DISABLE_ASSERT is defined, g_assert() is a no-op. Despite it now
being standard practice to *not* use g_assert() in unit tests (use
g_assert_*() instead), a lot of existing unit tests still use it.
Compiling those tests with G_DISABLE_ASSERT would make them silently
no-ops. Avoid that by warning the user loudly.

Note that it’s pretty rare for people to compile with G_DISABLE_ASSERT,
so it’s not expected that this will be hit often.

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

https://gitlab.gnome.org/GNOME/glib/issues/976
2018-07-11 17:41:46 +02:00
Philip Withnall
51ce8d204c gtestutils: Document difference between g_assert() and g_assert_*()
g_assert() must not be used in tests. g_assert_*() must not be used in
production code.

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

https://gitlab.gnome.org/GNOME/glib/issues/976
2018-07-11 17:29:49 +02:00
Philip Withnall
3890f7f5cb tests: Fix skipping of appinfo tests when DISPLAY is unset
Use g_test_skip() so that the TAP output is correct for the tests,
rather than printing using g_printerr().

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

https://gitlab.gnome.org/GNOME/glib/issues/640
2018-07-11 15:58:48 +02:00
Philip Withnall
d1d17e83c6 tests: Fix running fileutils test in cwd which is a symlink
If the fileutils test was run in a directory which is a symlink (for
example, on macOS, /tmp is often a symlink to /private/tmp), a path
comparison was failing. Compare the paths as inodes instead.

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

https://gitlab.gnome.org/GNOME/glib/issues/889
2018-07-11 15:43:22 +02:00
Philip Withnall
c182cd68c9 Merge branch 'sign-compare' into 'master'
Fix some -Wsign-compare warnings

See merge request GNOME/glib!162
2018-07-11 10:07:34 +00:00
Philip Withnall
a5d9fd2900 Merge branch '1044-prlimit-fix' into 'master'
Fix prlimit() error handling in tests

Closes #1044

See merge request GNOME/glib!164
2018-07-11 10:03:44 +00:00
Iain Lane
0da6265939 gmem.h: Use __typeof__() in the g_clear_pointer() macro
Type punning is used on the existing implementation, which hides errors
such as:

  GSList *list = NULL;
  g_clear_pointer (&list, g_error_free);

Let's use __typeof__ to cast the passed-in pointer before it's passed to
the free function so it trips -Wincompatible-pointer-types if it's wrong.

Fixes #1425
2018-07-11 10:52:53 +01:00
Iain Lane
747c2f5720 gobject: Make g_clear_object take a non-volatile GObject **
The implementation is silently discarding this anyway, and
g_object_unref() is using atomic operations. So this should be safe.

Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer()
is fixed to use __typeof__().
2018-07-11 10:52:53 +01:00
Emmanuele Bassi
ad3947c42e Merge branch '927-resource-path-fix' into 'master'
gresource: Fix potential array overflow if using empty paths

Closes #927

See merge request GNOME/glib!150
2018-07-11 09:24:03 +00:00
Philip Withnall
17e6a3a2f4 gvariant: Fix -Wsign-compare warnings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-11 10:43:17 +02:00
Philip Withnall
6be9f065cb tests: Fix error reporting on prlimit() call failure
prlimit() returns its error code in errno, not as a return value.

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

https://gitlab.gnome.org/GNOME/glib/issues/1044
2018-07-11 10:06:06 +02:00
Philip Withnall
3475afc255 Merge branch '1402-real-time' into 'master'
glib: Don’t use time(NULL) to get current time

Closes #1402

See merge request GNOME/glib!154
2018-07-11 07:51:06 +00:00
Iain Lane
40b306b81c Merge branch '340-gdbus-fixme' into 'master'
Remove an outdated TODO comment

Closes #340

See merge request GNOME/glib!168
2018-07-10 21:28:20 +00:00
Emmanuele Bassi
51065370a0 Merge branch '1041-atomic-bad-function-cast' into 'master'
Allow g_atomic_pointer_get() to be used by projects which enable -Wbad-function-cast

Closes #1041

See merge request GNOME/glib!166
2018-07-10 21:24:54 +00:00
Philip Withnall
034bbfd873 gdbusconnection: Drop an outdated TODO comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/340
2018-07-10 19:16:35 +02:00
Philip Withnall
194df27f5a gatomic: Tweak __atomic_load*() calls to work with -Wbad-function-cast
When compiling third-party projects with -Wbad-function-cast, the inline
g_atomic_pointer_get() implementation which uses C11 __atomic_load*()
calls on GCC was causing compilation errors like:

   error: cast from function call of type ‘long unsigned int’ to non-matching type ‘void *’

While we don’t want to compile all of GLib with -Wbad-function-cast, we
should support its headers being included in projects which do enable
that warning.

It doesn’t seem to be possible to cast away the warning (e.g. by casting
the function’s result through (void)), so we have to assign to an
intermediate integer of the right size first.

The same has to be done for the bool return value from
__sync_bool_compare_and_swap(). In that case, casting from bool to
gboolean raises a -Wbad-function-cast warning, since gboolean is
secretly int.

The atomic tests have been modified to enable -Wbad-function-cast to
catch regressions of this in future. The GLib build has conversely been
modified to set -Wno-bad-function-cast, just in case people have it set
in their environment CFLAGS.

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

https://gitlab.gnome.org/GNOME/glib/issues/1041
2018-07-10 17:49:16 +02:00
Philip Withnall
91c0c6f95b grand: Fix -Wsign-compare warning
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-10 14:16:41 +02:00
Philip Withnall
e40e77f9be gqueue: Fix -Wsign-compare warnings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-10 14:16:24 +02:00
Philip Withnall
03bad78947 garray: Fix -Wsign-compare warnings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-07-10 14:15:42 +02:00
Philip Withnall
4a53ed2073 Merge branch 'wip/hughsie/g_ref_string_new_len' into 'master'
Add a g_ref_string_new_len() to allow creating from non-NUL byte arrays

See merge request GNOME/glib!158
2018-07-09 17:30:12 +00:00