Commit Graph

950 Commits

Author SHA1 Message Date
Michael Catanzaro
0818da5308 testgdate: fix -Wmisleading-indentation warning
No behavior changes. Just reindent the existing code to avoid a GCC
warning spam.

I considered changing the code to not run fflush() on every iteration of
the loop, but I doubt it matters much, so I left it be.
2021-06-16 12:22:28 -05:00
Jasper St. Pierre
edb40c7171 gobject: Allow passing %NULL for @data in g_object_remove_toggle_ref
gjs has some situations where it's not always aware of the @data that
was passed into g_object_add_toggle_ref, so allow passing %NULL to
just match on @notify.

Rebased and updated by Nitin Wartkar

Closes #817
2021-05-27 21:09:45 +05:30
Emmanuel Fleury
a369efd207 Fix missing initializer warning in tests/slice-threadinit.c
tests/slice-threadinit.c:34:30: warning: missing field 'sample' initializer
} pages[N_PAGES] = { { NULL, }, };
                             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00: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
Emmanuel Fleury
5299ee541a Fix signedness warning in tests/unicode-collate.c
tests/unicode-collate.c: In function ‘main’:
tests/unicode-collate.c:77:11: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
   77 |  if (argc > i)
      |           ^
2021-05-06 14:35:46 +02:00
Emmanuel Fleury
1d02b96655 Fix signedness warnings in tests/gio-test.c
tests/gio-test.c: In function ‘recv_message’:
tests/gio-test.c:172:24: error: comparison of unsigned expression in ‘>= 0’ is always true
  172 |       g_assert (nbytes >= 0 && nbytes < BUFSIZE);
      |                        ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/gio-test.c:172:7: note: in expansion of macro ‘g_assert’
  172 |       g_assert (nbytes >= 0 && nbytes < BUFSIZE);
      |       ^~~~~~~~
tests/gio-test.c:188:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  188 |    for (j = 0; j < nbytes; j++)
      |                  ^
tests/gio-test.c:189:30: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
  189 |             g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
      |                              ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/gio-test.c:189:13: note: in expansion of macro ‘g_assert’
  189 |             g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
      |             ^~~~~~~~
2021-05-06 14:35:20 +02:00
Emmanuel Fleury
4d3c741ddb Fix several signedness warnings in tests/testglib.c
tests/testglib.c: In function ‘gnode_test’:
tests/testglib.c:302:34: error: comparison of integer expressions of different signedness: ‘char’ and ‘guint’ {aka ‘unsigned int’}
  302 |       g_assert (P2C (node->data) == ('C' + i));
      |                                  ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/testglib.c:302:7: note: in expansion of macro ‘g_assert’
  302 |       g_assert (P2C (node->data) == ('C' + i));
      |       ^~~~~~~~
tests/testglib.c:306:76: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  306 |     g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
      |                                                                            ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
  941 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
tests/testglib.c:306:5: note: in expansion of macro ‘g_assert’
  306 |     g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
      |     ^~~~~~~~
tests/testglib.c: In function ‘test_arrays’:
tests/testglib.c:1316:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1316 |     if (g_array_index (garray, gint, i) != i)
      |                                         ^~
tests/testglib.c:1324:41: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1324 |     if (g_array_index (garray, gint, i) != (100 - i - 1))
      |                                         ^~
2021-05-06 14:21:40 +02:00
Emmanuel Fleury
65d93a16ab Fix several signedness warnings in tests/testglib.c
tests/testglib.c: In function ‘glist_test’:
tests/testglib.c:90:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   90 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c:95:54: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
   95 |     if (g_list_position (list, g_list_nth (list, i)) != i)
      |                                                      ^~
tests/testglib.c:112:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  112 |       if (*((gint*) t->data) != i)
      |                              ^~
tests/testglib.c:130:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  130 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c:150:30: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  150 |       if (*((gint*) t->data) != (9 - i))
      |                              ^~
tests/testglib.c: In function ‘gslist_test’:
tests/testglib.c:170:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  170 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
tests/testglib.c:188:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  188 |       if (*((gint*) st->data) != i)
      |                               ^~
tests/testglib.c:206:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  206 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
tests/testglib.c:226:31: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  226 |       if (*((gint*) st->data) != (9 - i))
      |                               ^~
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
249f46ac76 Fix signedness warning in tests/timeloop.c
tests/timeloop.c: In function ‘read_all’:
tests/timeloop.c:41:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   41 |   while (bytes_read < len)
      |                     ^
tests/timeloop.c: In function ‘write_all’:
tests/timeloop.c:65:24: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   65 |   while (bytes_written < len)
      |                        ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
026611b5a9 Fix several signedness warnings in tests/slice-threadinit.c
tests/slice-threadinit.c: In function ‘main’:
tests/slice-threadinit.c:77:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
   77 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:108:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  108 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:113:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  113 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:131:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  131 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:139:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  139 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
tests/slice-threadinit.c:161:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  161 |   for (j = 0; j < N_MAGAZINE_PROBES; j++)
      |                 ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
7b78f0b8ce Fix signedness warnings in tests/gobject/performance-threaded.c
I did it wrong last time... my bad...

tests/gobject/performance-threaded.c: In function ‘main’:
tests/gobject/performance-threaded.c:361:21: warning: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
  361 |       for (k = 1; k < argc; k++)
      |                     ^
2021-05-04 16:13:41 +02:00
Emmanuel Fleury
c339e29d46 Fix signedness warning in tests/mainloop-test.c
tests/mainloop-test.c: In function ‘cleanup_crawlers’:
tests/mainloop-test.c:358:15: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  358 |   for (i=0; i < crawler_array->len; i++)
      |               ^
2021-05-04 08:46:10 +02:00
Emmanuel Fleury
dcd3af7023 Fix signedness warning in tests/dirname-test.c
tests/dirname-test.c: In function ‘main’:
tests/dirname-test.c:105:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  105 |   for (i = 0; i < n_dirname_checks; i++)
      |                 ^
2021-05-04 08:45:56 +02:00
Emmanuel Fleury
0ddadf14cc Fix several signedness warnings in tests/gobject/performance-threaded.c
tests/gobject/performance-threaded.c: In function ‘run_test’:
tests/gobject/performance-threaded.c:302:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
  302 |     for (i = 0; i < n_threads; i++) {
      |                   ^
tests/gobject/performance-threaded.c:308:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
  308 |     for (i = 0; i < n_threads; i++) {
      |                   ^
tests/gobject/performance-threaded.c: In function ‘find_test’:
tests/gobject/performance-threaded.c:324:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  324 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
tests/gobject/performance-threaded.c: In function ‘main’:
tests/gobject/performance-threaded.c:351:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  351 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
tests/gobject/performance-threaded.c:369:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  369 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
2021-05-04 08:44:44 +02:00
Emmanuel Fleury
7ddcc082e2 Fix signedness warnings in tests/gobject/timeloop-closure.c
tests/gobject/timeloop-closure.c: In function ‘read_all’:
tests/gobject/timeloop-closure.c:42:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   42 |   while (bytes_read < len)
      |                     ^
tests/gobject/timeloop-closure.c: In function ‘write_all’:
tests/gobject/timeloop-closure.c:66:24: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
   66 |   while (bytes_written < len)
      |                        ^
2021-05-04 08:43:29 +02:00
Emmanuel Fleury
7c69a1d5f6 Fix signedness warnings in tests/refcount/objects.c
tests/refcount/objects.c: In function ‘main’:
tests/refcount/objects.c:133:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘const unsigned int’}
  133 |   for (i = 0; i < n_threads; i++) {
      |                 ^
tests/refcount/objects.c:149:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘unsigned int’
  149 |   for (i = 0; i < 2 * n_threads; i++) {
      |                 ^
2021-05-04 08:43:29 +02:00
Emmanuel Fleury
3b424d746c Fix signedness warnings in tests/gobject/performance.c
tests/gobject/performance.c: In function ‘find_test’:
tests/gobject/performance.c:1019:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
 1019 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
tests/gobject/performance.c: In function ‘main’:
tests/gobject/performance.c:1054:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
 1054 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                     ^
2021-05-04 08:43:22 +02:00
Emmanuel Fleury
b419761189 Fix signedness warning in tests/onceinit.c
tests/onceinit.c: In function ‘stress_concurrent_initializers’:
tests/onceinit.c:267:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  267 |   for (i = 0; i < G_N_ELEMENTS (initializers); i++)
      |                 ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
b04ebbf67b Fix missing initializer warning in tests/gobject/defaultiface.c
tests/gobject/defaultiface.c: In function ‘test_dynamic_iface_register’:
tests/gobject/defaultiface.c:126:5: error: missing initializer for field ‘class_data’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  126 |     };
      |     ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
277d206d38 Fix multiple missing initializer warnings in tests/gobject/testcommon.h
tests/gobject/testmodule.c: In function ‘test_module_get_type’:
tests/gobject/testmodule.c:34:1: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   34 | DEFINE_TYPE (TestModule, test_module,
      | ^~~~~~~~~~~

tests/gobject/defaultiface.c: In function ‘test_static_iface_get_type’:
tests/gobject/defaultiface.c:58:1: error: missing initializer for field ‘class_finalize’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   58 | DEFINE_IFACE (TestStaticIface, test_static_iface,
      | ^~~~~~~~~~~~
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
76af9efbff Fix several missing initializer in tests/gobject/testgobject.c
tests/gobject/testgobject.c: In function ‘test_iface_get_type’:
tests/gobject/testgobject.c:53:7: error: missing initializer for field ‘class_init’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   53 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘test_object_get_type’:
tests/gobject/testgobject.c:182:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  182 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘derived_object_get_type’:
tests/gobject/testgobject.c:349:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  349 |       };
      |       ^
2021-04-29 12:40:05 +02:00
Simon McVittie
d499c53158 threadpool test: Don't leak the thread pool
Detected by AddressSanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-29 20:26:05 +00:00
Sebastian Dröge
fa8a39c6c6 Merge branch 'py-fixes' into 'master'
Python formatting improvements

See merge request GNOME/glib!1757
2020-11-20 18:10:40 +00:00
Philip Withnall
1a7f0002a0 tests: Fix non-atomic access to some shared variables
And drop the `volatile` qualifier from the variables, as that doesn’t
help with thread safety.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
7cdb68713c tests: Drop unnecessary volatile qualifiers from tests
These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
2020-11-20 14:40:19 +00:00
Philip Withnall
d270b6c3db py: Various flake8 cleanups
None of these are particularly significant, but they do get the CI
output clean.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Philip Withnall
905b22a17e py: Reformat all Python files consistently
This commit is the unmodified results of running
```
black $(git ls-files '*.py')
```
with black version 19.10b0. See #2046.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-17 15:50:07 +00:00
Frederic Martinsons
e817a049f0 Correct shellcheck errors (and ignore world splitting when we want it)
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2020-11-15 17:34:27 +01:00
Maciej S. Szmigiero
6569529e18 GLib test: test GTree "lower bound" and "upper bound" operations
"lower bound" and "upper bound" operations have been recently added to
GTree.
Let's add some tests for them where other GTree tests live.

Since adding keys in-order doesn't exercise the GTree insertion code very
well let's make sure they are inserted in a random order instead.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
2020-10-06 11:07:11 +01:00
Philip Withnall
00bfb3ab44 tree: Fix various typos and outdated terminology
This was mostly machine generated with the following command:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
using the latest git version of `codespell` as per [these
instructions](https://github.com/codespell-project/codespell#user-content-updating).

Then I manually checked each change using `git add -p`, made a few
manual fixups and dropped a load of incorrect changes.

There are still some outdated or loaded terms used in GLib, mostly to do
with git branch terminology. They will need to be changed later as part
of a wider migration of git terminology.

If I’ve missed anything, please file an issue!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 15:01:08 +01:00
Simon McVittie
44c004c84e Normalize C source files to end with exactly one newline
Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to GLib,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-10 09:48:02 +01:00
Philip Withnall
a19e554517 glib: Update Unicode Character Database to version 13.0.0
Using commands:
```
glib/gen-unicode-tables.pl -both 13.0.0 path/to/UCD
tests/gen-casefold-txt.py 13.0.0 path/to/UCD/CaseFolding.txt \
   > tests/casefold.txt
tests/gen-casemap-txt.py 13.0.0 path/to/UCD/UnicodeData.txt \
   path/to/UCD/SpecialCasing.txt > tests/casemap.txt
```

Using UCD release https://www.unicode.org/Public/zipped/13.0.0/UCD.zip

With some manual additions to `GUnicodeScript` for the 4 new scripts
added in 13.0, using the first assigned character in each block in
`glib/tests/unicode.c`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-18 14:50:36 +00:00
Philip Withnall
c5d661b4c4 build: Fix shellcheck warnings in various old build and test scripts
Most of these scripts can probably just be deleted (see issue #2045),
but for now it was easier to just mechanically fix the shellcheck
warnings in them, rather than think about whether we actually needed the
script.

Fixes done using shellcheck 0.7.0 with default options. I haven’t tested
any of the changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-02-27 10:33:45 +00:00
Marco Trevisan (Treviño)
d407b9e705 testgdate: Exit with failure if there are not passed tests 2019-12-10 17:58:16 +01:00
Sebastian Dröge
4dcad56fb2 Merge branch '1750-more-atomic-intrinsics' into 'master'
gatomic: Use new __atomic_*() intrinsics for all atomic operations

Closes #1750

See merge request GNOME/glib!1123
2019-11-14 13:40:47 +00:00
Philip Withnall
543a0c4091 tests: Fix unused variable in the threadpool-test
It looks like `continue_timeout` should be returned here, rather than
being set and never read. Spotted by `scan-build`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-30 15:24:08 +00:00
Jonas Ådahl
15e3b6f136 gmessages: Add g_warning_once()
In many places the pattern

    static gboolean warned_once = FALSE;
    if (!warned_once)
      {
        g_warning ("This and that");
        warned_once = TRUE;
      }

is used to not spam the same warning message over and over again. Add a
helper in glib for this, allowing the above statement to be changed to

    g_warning_once ("This and that");
2019-10-09 16:39:31 +02:00
Philip Withnall
30dd30d05a tests: Remove redundant old atomic test
The test in `glib/tests/atomic.c` does everything this test did, and
more.

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

Helps: #1434
2019-10-08 12:10:20 +01:00
Tom Schoonjans
036f6ca7e3 gmodule: write test for shared libraries 2019-09-06 19:03:31 +01:00
Philip Withnall
12bd86a2ee Merge branch 'G_SIGNAL_RUN_CLEANUP_do_not_call_accumulate' into 'master'
Run the accumulator function for RUN_CLEANUP object handlers too

Closes #512

See merge request GNOME/glib!1053
2019-08-26 06:19:07 +00:00
Sebastian Dröge
153ac4c82a Run the accumulator function for RUN_CLEANUP object handlers too
Closes issue #512
2019-08-25 19:31:48 +02:00
Christoph Reiter
6095b9bd3c win32: don't assume the format specifier for the stdlib printf/scanf like functions
When using the mingw printf shims for C99 compat the msvc format specifiers don't work
and the build fails.

Ideally we would use glib functions which abstract this away, but in the error handler context
we shouldn't call back into glib. And for scanf we don't have a glib wrapper.

Instead call the "secure" versions provided by the win32 API (_snprintf_s/fprintf_s/sscanf_s)
which mingw doesn't replace.
2019-08-10 21:56:33 +02:00
Chun-wei Fan
dbea8d5449 Fix module tests on Visual Studio builds
On Visual Studio, Meson builds modules as xxxx.dll, not libxxxx.dll when
xxxx is specified as the name for the shared_module() build directive.

This means that in the test programs if we expect for libxxxx for the
module name, the test will fail as there is no libxxxx.dll but there is
xxxx.dll.  This makes the test program look for the module files
correctly.
2019-06-24 10:58:58 +08:00
Philip Withnall
e62e89f2f8 Fix various deprecation warnings in code and tests
This code uses, or tests, deprecated functions, types or macros; so
needs to be compiled with deprecation warnings disabled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
505f45ef95 tests: Remove redundant --tap options
Now that TAP output is used by default, passing `--tap` is unnecessary.

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

Helps: #1619
2019-05-14 12:42:51 +01:00
Philip Withnall
64ddd32b79 glib: Update Unicode Character Database to version 12.1.0
Using commands:
```
glib/gen-unicode-tables.pl -both 12.1.0 path/to/UCD
tests/gen-casefold-txt.py 12.1.0 path/to/UCD/CaseFolding.txt \
   > tests/casefold.txt
tests/gen-casemap-txt.py 12.1.0 path/to/UCD/UnicodeData.txt \
   path/to/UCD/SpecialCasing.txt > tests/casemap.txt
```

Using UCD release https://www.unicode.org/Public/zipped/12.1.0/UCD.zip.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-08 13:07:55 +01:00