Commit Graph

23475 Commits

Author SHA1 Message Date
Princeton Ferro
30ed2ea263 improve console check in gspawn-win32
We use the return value of AllocConsole (GetCurrentProcessId ()) to
determine whether the spawning process is attached to a console.
2021-04-19 10:25:06 +00:00
Philip Withnall
d602523988 Merge branch 'g_string_replace_doc_fix' into 'master'
g_string_replace(): Fix documentation of 'limit' parameter

See merge request GNOME/glib!2052
2021-04-19 09:28:25 +00:00
Nelson Ben
225fec1329 g_string_replace(): Fix documentation of 'limit' parameter 2021-04-18 18:31:32 +00:00
Sebastian Dröge
b63f7ec70b Merge branch 'patch-2' into 'master'
Add nullable annotations in GUnixMountEntry

See merge request GNOME/glib!2051
2021-04-18 16:35:27 +00:00
Sophie Herold
98c3710522 Add nullable annotations in GUnixMountEntry 2021-04-18 18:13:08 +02:00
Philip Withnall
9e4a6dac7c Merge branch 'fix-typo' into 'master'
Fix typo in g_socket_listener_accept_async()'s comment

See merge request GNOME/glib!2049
2021-04-16 14:29:00 +00:00
demotomohiro
e724e6ed04
Fix typo in g_socket_listener_accept_async()'s comment 2021-04-16 23:08:09 +09:00
Philip Withnall
8e19113dac Merge branch 'clang-attributes' into 'master'
gmacros.h: use g_macro__has_attribute() where possible

See merge request GNOME/glib!2043
2021-04-16 12:00:12 +00:00
Aleksandr Mezin
56be1f8d82 gmacros.h: raise minimum GCC version for attribute __noreturn__
`#define G_GNUC_NORETURN __attribute__((__noreturn__))` was previously under
`#if G_GNUC_CHECK_VERSION(2, 4)`.

But `# define G_NORETURN __attribute__ ((__noreturn__))` was under
`#if G_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)`.

Take the latter for `g_macro__has_attribute(__noreturn__)` fallback. This will
disable `G_GNUC_NORETURN` for GCC 2.4-2.7 though.
2021-04-16 14:51:41 +06:00
Aleksandr Mezin
2b9bf7b162 gmacros.h: use g_macro__has_attribute() where possible
Fall back to compiler version checks only when `__has_attribute()` is not
available.

clang-cl doesn't define `__GNU__`, but still accepts attributes. This change
gets rid of a lot of warnings when building GLib with clang-cl. For GCC and
non-cl Clang nothing should change.
2021-04-16 14:45:03 +06:00
Pawan Chitrakar
a78b7ebb20 Update Nepali translation
(cherry picked from commit e9587a480a)
2021-04-15 22:04:02 +00:00
Sebastian Dröge
1afb4c0b96 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2047
2021-04-15 09:22:17 +00:00
Emmanuel Fleury
fd926b1ea7 Fix missing initializer in gio/tests/gdbus-example-peer.c
gio/tests/gdbus-example-peer.c:120:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  120 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
1c084ca717 Fix missing initializer warning in gio/tests/gdbus-example-export.c
gio/tests/gdbus-example-export.c:229:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  229 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
4d52358fe2 Fix signedness warning in gio/tests/gsettings.c
gio/tests/gsettings.c: In function ‘strv_set_equal’:
gio/tests/gsettings.c:2268:41: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
 2268 |     res = g_strv_length ((gchar**)strv) == count;
      |                                         ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
83a9ba7790 Fix missing initializer warning in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c:806:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  806 | };
      | ^
In file included from gio/gio.h:53,
                 from gio/tests/gdbus-testserver.c:1:
gdbusconnection.h:395:12: note: ‘padding’ declared here
  395 |   gpointer padding[8];
      |            ^~~~~~~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
5133acdaff Fix multiple signedness warnings in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c: In function ‘handle_method_call’:
gio/tests/gdbus-testserver.c:334:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  334 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:343:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  343 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:352:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  352 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:361:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  361 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:370:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  370 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:379:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  379 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:388:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  388 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:397:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  397 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:406:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  406 |         for (i = 0; i < n_elts; i++)
      |                       ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
c3c1f6c4b9 Fix signedness warning in gio/tests/mimeapps.c
gio/tests/mimeapps.c: In function ‘strv_equal’:
gio/tests/mimeapps.c:31:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
   31 |     res = g_strv_length (strv) == count;
      |                                ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
e7aec308e9 Fix signedness warning in gio/tests/proxy-test.c
gio/tests/proxy-test.c: In function ‘do_echo_test’:
gio/tests/proxy-test.c:855:25: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  855 |   for (total = 0; total < nwrote; total += nread)
      |                         ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
8608eccf9a Fix signedness warning in gio/tests/file.c
gio/tests/file.c: In function ‘written_cb’:
gio/tests/file.c:358:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
  358 |   if (data->pos < strlen (data->data))
      |                 ^
2021-04-15 10:19:29 +02:00
Sebastian Dröge
55d18fd3dc Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2040
2021-04-15 07:24:57 +00:00
Sebastian Dröge
7c217b1c6a Merge branch '2368-task-docs' into 'master'
gtask: Clarify what counts as ‘too many tasks’ for rate limiting

Closes #2368

See merge request GNOME/glib!2045
2021-04-15 07:22:05 +00:00
Emmanuel Fleury
4d1f76ec50 Fix signedness warning in gio/tests/gdbus-test-codegen.c
gio/tests/gdbus-test-codegen.c: In function ‘check_object_manager’:
gio/tests/gdbus-test-codegen.c:2344:20: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
 2344 |   if (om_signal_id != -1)
      |                    ^~
2021-04-15 00:00:22 +02:00
Emmanuel Fleury
34cd8a98c7 Fix signedness warning in gio/tests/testfilemonitor.c
gio/tests/testfilemonitor.c: In function ‘check_expected_events’:
gio/tests/testfilemonitor.c:124:39: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  124 |   for (i = 0, li = 0, l = recorded; i < n_expected && l != NULL;)
      |                                       ^
2021-04-14 23:43:36 +02:00
Emmanuel Fleury
0a741d85a7 Fix signedness warning in gio/tests/socket.c
gio/tests/socket.c: In function ‘test_get_available’:
gio/tests/socket.c:1696:53: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’
 1696 |           if (g_socket_get_available_bytes (server) > sizeof (data))
      |                                                     ^
2021-04-14 23:43:25 +02:00
Emmanuel Fleury
5595b65476 Fix multiple missing initializer warnings in gio/tests/gdbus-export.c
gio/tests/gdbus-export.c:130:1: error: missing initializer for field ‘properties’ of ‘GDBusInterfaceInfo’ {aka ‘const struct _GDBusInterfaceInfo’}
  130 | };
      | ^
In file included from gio/gio.h:57,
                 from gio/tests/gdbus-export.c:21:
gio/gdbusintrospection.h:156:25: note: ‘properties’ declared here
  156 |   GDBusPropertyInfo   **properties;
      |                         ^~~~~~~~~~
...
2021-04-14 23:26:15 +02:00
Emmanuel Fleury
60d2cfb6ae Fix missing initializer warning in gio/tests/gdbus-connection.c
gio/tests/gdbus-connection.c:90:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   90 | };
      | ^
2021-04-14 23:26:15 +02:00
Emmanuel Fleury
8ad4f752b1 Fix signedness warning in glib/gstring.c
glib/gstring.c: In function ‘g_string_replace’:
glib/gstring.c:998:13: warning: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  998 |       if (n == limit)
      |             ^~
2021-04-14 23:26:15 +02:00
Emmanuele Bassi
7a0bc25792 Merge branch 'gerror-utf8-docs' into 'master'
gerror: Clarify docs around message requirements

See merge request GNOME/glib!2046
2021-04-14 20:25:39 +00:00
Matthias Clasen
63fa4e7d34 gerror: Clarify docs around message requirements
Make it clear that error->message is a user-visible string
that must be in UTF-8, and point out helpers for that.
2021-04-14 14:55:23 -04:00
Philip Withnall
13ba8d82ab gtask: Clarify what counts as ‘too many tasks’ for rate limiting
However, GLib still can’t guarantee to do rate limiting, as the type of
rate limiting which is appropriate depends on what tasks are being run,
and the GTask thread pool is shared between all tasks (of many different
types) in a process space.

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

Fixes: #2368
2021-04-14 11:38:13 +01:00
Philip Withnall
23277fbcad Merge branch 'wip/clarify-ref-count-api' into 'master'
refcount: Clarify when the ref count ends up undefined

See merge request GNOME/glib!2041
2021-04-13 13:41:19 +00:00
Philip Withnall
73d759e8dd Merge branch 'clarify-refcount-init-api' into 'master'
grefcount: Clarify that the initial reference count is 1

See merge request GNOME/glib!2042
2021-04-13 13:41:12 +00:00
Dor Askayo
eb6ca282f0 grefcount: Clarify that the initial reference count is 1 2021-04-09 13:15:30 +03:00
Jonas Ådahl
21cc809158 refcount: Clarify when the ref count ends up undefined
Calling g_atomic_ref_count_dec() or g_ref_count_dec() and the reference
count reaches zero results in different side effects depending on
whether the reference count is atomic or not.

The intended side effect when this happens is undefined, i.e. one should
not rely on the reference count actually reaching zero, or staying 1, or
becoming something else, and one should treat the grefcount /
gatomicrefcount to be unusable until reinitialized.

This wasn't documented, so add a paragraph about this.
2021-04-09 11:13:36 +02:00
Philip Withnall
346e4867ea Merge branch 'mcatanzaro/coverity-noreturn' into 'master'
Implement G_ANALYZER_NORETURN for Coverity

See merge request GNOME/glib!2039
2021-04-08 17:23:27 +00:00
Michael Catanzaro
f97ff20adf Implement G_ANALYZER_NORETURN for Coverity
This change is proposed by Kamil Dudka. It teaches Coverity to assume
that g_critical() will never return, which is desirable for the same
reasons it is for scan-build: once you've triggered undefined behavior,
the game is already lost, and there's limited benefit from trying to
avoid every possible memory leak on such codepaths. Notably, this
affects g_return_if_fail().

Arguably it might be desirable to fix every such issue, but if we're
already not doing so for scan-build, it doesn't make sense to hold
developers working with Coverity to a higher standard. This allows
focusing on more serious issues found by Coverity.

Thanks Kamil!
2021-04-08 11:34:21 -05:00
Philip Withnall
80c2981b62 Merge branch 'fix-glib-unavailable-macro' into 'master'
gmacros.h: Complete the use of GLIB_UNAVAILABLE_MACRO

Closes #2376

See merge request GNOME/glib!2037
2021-04-08 15:52:27 +00:00
Gaël Bonithon
52ad3ed717 gmacros.h: Fix stringification in some macros
This makes `GLIB_UNAVAILABLE_MACRO` and `GLIB_DEPRECATED_MACRO_FOR`
print their arguments correctly.
2021-04-08 17:33:07 +02:00
Gaël Bonithon
f20bcf2969 gmacros.h: Complete the use of GLIB_AVAILABLE_MACRO_IN_*
This adds `GLIB_AVAILABLE_MACRO_IN_*` where needed, or a comment when
such use is not possible.

Fixes #2376.
2021-04-08 17:33:07 +02:00
Philip Withnall
ee242bb54f Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2038
2021-04-08 14:20:07 +00:00
Emmanuel Fleury
b9e66a59f6 Fix signedness warning in glib/gdate.c
glib/gdate.c: In function ‘convert_twodigit_year’:
glib/gdate.c:1217:13: warning: comparison of integer expressions of
  different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1217 |       if (y < two)
      |             ^
2021-04-08 13:29:05 +02:00
Emmanuel Fleury
00323ac0e1 Fix several signedness warnings in gio/tests/actions.c
gio/tests/actions.c: In function ‘strv_set_equal’:
gio/tests/actions.c:177:41: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  177 |     res = g_strv_length ((gchar**)strv) == count;
      |                                         ^~
gio/tests/actions.c: In function ‘test_parse_detailed’:
gio/tests/actions.c:473:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  473 |   for (i = 0; i < G_N_ELEMENTS (testcases); i++)
      |                 ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
c3d558df77 Fix multiple missing initializer warnings in gio/tests/actions.c
gio/tests/actions.c: In function ‘test_entries’:
gio/tests/actions.c:375:5: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  375 |     { "foo",    activate_foo                                     },
      |     ^
In file included from gio/gio.h:31,
                 from gio/tests/actions.c:1:
gio/gactionmap.h:63:16: note: ‘parameter_type’ declared here
   63 |   const gchar *parameter_type;
      |                ^~~~~~~~~~~~~~
...
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
0710429598 Fix missing initializer warning in gio/tests/gdbus-peer-object-manager.c
gio/tests/gdbus-peer-object-manager.c: In function ‘mock_interface_get_vtable’:
gio/tests/gdbus-peer-object-manager.c:111:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘struct _GDBusInterfaceVTable’}
  111 |   };
      |   ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
e3f6d4a08b Fix several missing initializer warnings in gio/tests/gdbus-peer.c
gio/tests/gdbus-peer.c:262:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  262 | };
      | ^
gio/tests/gdbus-peer.c:1263:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
 1263 | };
      | ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
7c909db13a Fix multiple missing initializer warning in gio/tests/g-file.c
gio/tests/g-file.c: In function ‘test_g_file_new_for_path’:
gio/tests/g-file.c:114:7: error: missing initializer for field ‘path3’ of ‘const struct TestPathsWithOper’
  114 |       {"/", TRUE, 0, "/./"},
      |       ^
gio/tests/g-file.c:115:7: error: missing initializer for field ‘path3’ of ‘const struct TestPathsWithOper’
  115 |       {"//", TRUE, 0, "//"},
      |       ^
...
2021-04-08 13:24:54 +02:00
Sebastian Dröge
afceb250ce Merge branch 'fix-annotation' into 'master'
Fix annotation of count arguments

See merge request GNOME/glib!2033
2021-04-08 06:56:30 +00:00
Sebastian Dröge
da752d11c5 Merge branch 'gmacros-use-g-gnuc-check-version' into 'master'
gmacros.h: use G_GNUC_CHECK_VERSION

See merge request GNOME/glib!2036
2021-04-08 06:54:47 +00:00
Aleksandr Mezin
2539d70d40 gmacros.h: use G_GNUC_CHECK_VERSION
Remove repeated `__GNUC__ > ... || (__GNUC__ == ... && __GNUC_MINOR__ >= ...)`.

Also effectively adds (missing?) `defined(__GNUC__)` check before
`__GNUC__ > ...` in a few places.
2021-04-07 23:58:51 +06:00