Commit Graph

23800 Commits

Author SHA1 Message Date
Emmanuele Bassi
2910ffd383 Merge branch 'test-bug-numbers' into 'master'
tests: Drop use of g_test_bug_base()

See merge request GNOME/glib!2104
2021-05-13 21:56:15 +00:00
Philip Withnall
447f727284 tests: Use a temporary file in the bookmarkfile tests
Rather than always writing to `out.xbel` in the build directory, which
could cause issues when running tests in parallel, or expecting the
tests to not touch the build directory.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 22:53:38 +01:00
Matthias Clasen
f3e65b1af7 gbookmarkfile: Don't crash if we're not visited
Rewrite bookmark_item_dump to not crash if any of
the timestamps is NULL. Also, avoid some of the gratitious
extra string copying.

Tweaked by Philip Withnall to pass the unit tests.
2021-05-13 22:50:34 +01:00
Philip Withnall
43c28fcd5a gdbusproxy: Recommend it is not used for stateless services
For the reasons given in the new bit of documentation, GDBusProxy should
not be used for connecting to stateless D-Bus services which may be
restarted at any point.

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

https://gitlab.gnome.org/GNOME/glib/issues/1036
2021-05-13 22:24:26 +01:00
Philip Withnall
7e9585177d tests: Drop use of g_test_bug_base()
Include the base URI in the `g_test_bug()` calls instead. This resolves
inconsistencies between the old bug base (bugzilla.gnome.org) and the
new bug base (gitlab.gnome.org). It also has the advantage that the URI
passed to `g_test_bug()` is now clickable in the code editor, rather
than being split across two locations.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 22:16:27 +01:00
Philip Withnall
46ab6821a3 gtestutils: Allow full URIs in g_test_bug()
Even if `g_test_bug_base()` has been called.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 21:57:40 +01:00
Philip Withnall
0f7950f199 gtestutils: Improve documentation formatting for g_test_bug_base()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 21:57:25 +01:00
Philip Withnall
3bca6ee2e4 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2101
2021-05-13 20:16:46 +00:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Philip Withnall
82e2517257 Merge branch 'carlosgc/remove-dot-segments' into 'master'
guri: always apply the remove dot segments algorithm

Closes #2342

See merge request GNOME/glib!2084
2021-05-13 13:13:34 +00:00
Philip Withnall
53834ee319 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings (clang)

See merge request GNOME/glib!2091
2021-05-13 12:04:42 +00:00
Philip Withnall
56ddba7c34 Merge branch 'serializ' into 'master'
docs: Standardize spelling of serializ*

Closes #2399

See merge request GNOME/glib!2096
2021-05-13 11:37:11 +00:00
Emmanuel Fleury
82fc86dcd4 Fix missing initializer warning in gio/gio-tool-info.c
gio/gio-tool-info.c:41:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
8a3e184db9 Fix missing initializer warning in gio/gio-tool-copy.c
gio/gio-tool-copy.c:50:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c395e865bf Fix missing initializer warning in gio/gio-tool-cat.c
gio/gio-tool-cat.c:42:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
27454ed557 Fix missing initializer warning in gio/glib-compile-schemas.c
gio/glib-compile-schemas.c:2181:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
4301110174 Fix missing initializer warning in gio/tests/socket-client.c
gio/tests/socket-client.c:37:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
689b9b545f Fix missing initializer warning in gio/tests/socket-server.c
gio/tests/socket-server.c:43:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
66af256621 Fix missing initializer warning in glib/tests/spawn-path-search-helper.c
glib/tests/spawn-path-search-helper.c:82:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f9904fe7ae Fix missing initializers warnings in glib/tests/utf8-validate.c
glib/tests/utf8-validate.c:271:11: warning: missing field 'max_len' initializer
  { NULL, }
          ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c65ec0bfbf Fix many missing initializers warnings in glib/tests/option-context.c
glib/tests/option-context.c:36:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
glib/tests/option-context.c:43:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
glib/tests/option-context.c:319:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
...
           ^
glib/tests/option-context.c:2538:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
glib/tests/option-context.c:2576:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
f2d14a8770 Fix missing field initializer warning in glib/tests/option-argv0.c
glib/tests/option-argv0.c:38:14: warning: missing field 'short_name' initializer
      { NULL } };
             ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
2e4524cd36 Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays 2021-05-13 12:57:06 +02:00
Philip Withnall
c0b339372c Merge branch 'mcatanzaro/string-test' into 'master'
tests: Add missing return value check in string test

See merge request GNOME/glib!2100
2021-05-11 22:27:44 +00:00
Philip Withnall
940613e598 Merge branch 'gmacros-gnoreturn-cleanup' into 'master'
gmacros.h: G_NORETURN: remove useless checks

See merge request GNOME/glib!2099
2021-05-11 22:26:44 +00:00
Michael Catanzaro
82d162da83 tests: Add missing return value check in string test
Coverity noticed that we were not testing the return value here. Good
Coverity!
2021-05-11 16:24:39 -05:00
Aleksandr Mezin
55f13da1f5 gmacros.h: G_NORETURN: remove useless checks
GCC >= 2.8 and MSVC >= 1200 are already handled by `#if` branches above. So:

- `(__GNUC__ == 4 && __GNUC_MINOR__ >= 7)` is always false here

- `!(__GNUC__ == 4 && __GNUC_MINOR__ == 7)` is always true

- `(_MSC_VER >= 1900)` is always false
2021-05-11 22:27:40 +06:00
Philip Withnall
4cd1a1c03d Merge branch 'optimise_g_atomic_ref_count_dec' into 'master'
grefcount: Optimise g_atomic_ref_count_dec

See merge request GNOME/glib!2098
2021-05-11 11:00:26 +00:00
Nishal Kulkarni
8cba1f4c17 grefcount: Optimise g_atomic_ref_count_dec
Currently, `g_atomic_ref_count_dec ()` does two operations.
We try to get this down to one operation.

Replace `g_atomic_int_dec_and_test ()` with `g_atomic_int_add ()`
Passing -1 as value.

Note: changes current behaviour, checks are now done after decrement.
2021-05-11 15:08:20 +05:30
Sebastian Dröge
ea4721422f Merge branch 'optimise_gatomicrefcount' into 'master'
grefcount: Optimise g_atomic_ref_count_inc

Closes #1583

See merge request GNOME/glib!2086
2021-05-11 07:27:24 +00:00
Geyslan G. Bem
6b867cd474 docs: Standardize spelling of serializ*
Changes serialis* to serializ*.

Fixes: #2399

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-10 15:28:12 -03:00
Philip Withnall
e8329b5219 Merge branch 'mywork' into 'master'
glib: Improved documentation of GSourceFuncs

Closes #1864

See merge request GNOME/glib!2095
2021-05-10 15:15:58 +00:00
nitinosiris
15e3b9e219 glib: documentation of GSourceFuncs
Only finalize has a comment to indicate that it can be NULL
However, prepare and check can both be NULL too.

Fixes: 1864
2021-05-10 20:03:12 +05:30
Philip Withnall
2549187b18 Merge branch 'windows-known-folders' into 'master'
Use SHGetKnownFolderPath() on Windows

Closes #2397

See merge request GNOME/glib!2089
2021-05-10 14:13:01 +00:00
Thomas Haller
bdd6b753ca main: document notify function gets called during g_source_destroy()
This seems non-obvious to me. Document it.

It also seems important to know, because it means that the data pointer
might already be destroyed, before the source is unreferenced for good.
For example, if the data pointer keeps a reference to the GSource,
and it might seem sensible to call:

    g_source_destroy(data->source);
    g_source_unref(data->source); /* <<< data is already destroyed? */

This leads to a crash, if the source was attached to a context.
2021-05-10 13:16:05 +02:00
Thomas Haller
b0157af9a6 gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()
Since commit ab285899a6 ('gdbusconnection: Document main context
iteration for unsubscript'), we document when the user is guaranteed
that all resources are gone after g_dbus_connection_signal_unsubscribe().
This is not merely an implementation detail, it's something that the
user needs to be able to rely on. It is good that this is documented.

However, libnm does something different ([1]). It registers to several D-Bus
signals without providing a GDestroyNotify. After unsubscription, it schedules
another idle action with lower priority and uses that to know when
cleanup is complete. I think this is a useful alternative and should
also be guaranteed and documented to work.

Also note that this isn't just some implementation detail that currently
happens to work. GDBusConnection tightly integrates with GMainContext and it
works by scheduling idle sources with G_PRIORITY_DEFAULT priority. It needs to
schedule all events with this same priority, otherwise the ordering is not
preserved. At this point, with GDBusConnection working this way, this is no longer
something that can reasonably be any different. It's how GDBusConnection fundamentally
works, and a user must be able to rely on that. As such, this new promise isn't
something that we would want to break in the future.

Thus document it.

[1] a55c10c6cb/src/libnm-client-impl/nm-client.c (L7918)
2021-05-10 13:16:05 +02:00
Nishal Kulkarni
827b4ec855 grefcount: Optimise g_atomic_ref_count_inc
Currently, `g_atomic_ref_count_inc ()` does three operations.
We try to get this down to one operation.

Fixed by replacing `g_atomic_int_inc ()` with `g_atomic_int_add ()`
which increments by 1 and returns old value

Note: changes current behaviour, checks are now done after increment.

Closes: #1583
2021-05-10 15:45:00 +05:30
Philip Withnall
66fe1da95a Merge branch 'serializ' into 'master'
docs: Standardize spelling of serializ*

See merge request GNOME/glib!2090

Helps: #2399
2021-05-10 09:50:07 +00:00
Руслан Ижбулатов
d270d5b615 Use SHGetKnownFolderPath() on Windows
SHGetSpecialFolderLocation() can cause 200ms delays when getting some
folder locations.

Also, use SHGetKnownFolderPath() normally, without loading it at runtime,
since GLib is Windows 7-or-later now.

Fixes #2397
2021-05-07 12:33:51 +00:00
Geyslan G. Bem
8cc03f8cd8 docs: Standardize spelling of serializ*
Changes serialis* to serializ* as proposed in #2399.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-07 08:51:22 -03:00
Sebastian Dröge
0c259e9fbb Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2088
2021-05-07 06:49:26 +00:00
Emmanuel Fleury
9656e606d2 Fix cast to smaller integer type warning in glib/gscanner.c
glib/gscanner.c:1681:13: warning: cast to smaller integer type 'GTokenType' from 'gpointer' (aka 'void *')
        *token_p = (GTokenType) value_p->v_symbol;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-05-06 23:07:04 +02:00
Emmanuel Fleury
83d46f6a0a Fix missing field initializer in glib/deprecated/gthread.h
glib/deprecated/gthread-deprecated.c:473:42: warning: missing field 'unused' initializer
  static const GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
                                         ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
glib/deprecated/gthread-deprecated.c:659:45: warning: missing field 'unused' initializer
  static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
                                            ^
glib/deprecated/gthread.h:170:35: note: expanded from macro 'G_STATIC_REC_MUTEX_INIT'
                                  ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
glib/deprecated/gthread-deprecated.c:959:42: warning: missing field 'unused' initializer
  static const GStaticRWLock init_lock = G_STATIC_RW_LOCK_INIT;
                                         ^
glib/deprecated/gthread.h:206:33: note: expanded from macro 'G_STATIC_RW_LOCK_INIT'
                                ^
glib/deprecated/gthread.h:128:36: note: expanded from macro 'G_STATIC_MUTEX_INIT'
                                   ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
e3453f39dd Fix missing initializer in gio/tests/fake-service-name.c
gio/tests/fake-service-name.c:55:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   55 | };
      | ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
00a15152f3 Fix signedness warning in tests/memchunks.c
tests/memchunks.c: In function ‘old_mem_chunk_new’:
tests/memchunks.c:140:35: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  140 |   g_return_val_if_fail (area_size >= atom_size, NULL);
      |                                   ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
53157f32b9 Fix several signedness warnings in tests/unicode-encoding.c
tests/unicode-encoding.c: In function ‘process’:
tests/unicode-encoding.c:140:38: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  140 |       if (!ucs4_result || items_read == strlen (utf8))
      |                                      ^~
tests/unicode-encoding.c:161:15: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  161 |    items_read != strlen (utf8) ||
      |               ^~
tests/unicode-encoding.c:198:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  198 |    items_written != strlen (utf8))
      |                  ^~
tests/unicode-encoding.c:260:22: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  260 |       if (items_read != strlen (utf8) ||
      |                      ^~
tests/unicode-encoding.c:294:18: error: comparison of integer expressions of different signedness: ‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
  294 |    items_written != strlen (utf8))
      |                  ^~
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
951105fae5 Fix several signedness warnings in tests/threadpool-test.c
tests/threadpool-test.c: In function ‘test_thread_sort’:
tests/threadpool-test.c:283:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  283 |   for (i = 0; i < limit; i++) {
      |                 ^
tests/threadpool-test.c:296:50: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  296 |   g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
      |                                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/threadpool-test.c:296:3: note: in expansion of macro ‘g_assert’
  296 |   g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
      |   ^~~~~~~~
tests/threadpool-test.c:297:50: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  297 |   g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
      |                                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/threadpool-test.c:297:3: note: in expansion of macro ‘g_assert’
  297 |   g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
      |   ^~~~~~~~
tests/threadpool-test.c: In function ‘test_thread_idle_time’:
tests/threadpool-test.c:355:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  355 |   for (i = 0; i < limit; i++) {
      |                 ^
2021-05-06 22:54:53 +02:00
Emmanuel Fleury
3951ccffae Fix signedness warning in tests/thread-test.c
tests/thread-test.c: In function ‘test_g_static_private’:
tests/thread-test.c:214:60: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  214 |     g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
      |                                                            ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/thread-test.c:214:5: note: in expansion of macro ‘g_assert’
  214 |     g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i * 3);
      |     ^~~~~~~~
2021-05-06 22:54:53 +02:00
Philip Withnall
45cc35c5cc Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2081
2021-05-06 16:43:21 +00:00
Sebastian Dröge
730cc864ef Merge branch 'jomccambridge-master-patch-47329' into 'master'
Update signal accumulator docs.

Closes #2352

See merge request GNOME/glib!2058
2021-05-06 14:00:19 +00:00