Commit Graph

26392 Commits

Author SHA1 Message Date
Simon McVittie
054b96fd09 Merge branch '2812-missing-field-initializers' into 'main'
build: Explicitly enable -Wmissing-field-initializers

Closes #2812

See merge request GNOME/glib!3074
2022-11-21 16:07:43 +00:00
Philip Withnall
7d55571c13 build: Explicitly enable -Wmissing-field-initializers
It was previously only enabled (by default) on macOS, which led to
code being committed which triggered warnings, as that CI job is not
always run.

Avoid that risk by always enabling the warning.

The reasoning for using this warning is that explicit initialisation is
clearer than implicit. We also want to support GLib’s public headers
being used in projects which build with
`-Werror=missing-field-initializers`, but can’t easily enable the
warning for our public headers but not our internal code. So enable it
everywhere.

Make it a warning rather than an error, as there’s a risk that system
header changes will trigger it in distro release builds, which would
cause false build failures. By making it a warning, GLib developers can
build with `-Werror` and promote it to an error, while distros can
choose not to.

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

Helps: #2812
2022-11-21 10:49:03 +00:00
Мирослав Николић
4f406f3de6 Update Serbian translation
(cherry picked from commit 25df888507)
2022-11-20 14:27:25 +00:00
Marco Trevisan
7ab85b329a Merge branch 'nonnull-in-meson' into 'main'
build: Move -Wnonnull flag to meson.build

See merge request GNOME/glib!3078
2022-11-18 18:17:08 +00:00
Marco Trevisan
92f39d37c5 Merge branch 'scan-build-fixes' into 'main'
A few test improvements for scan-build

See merge request GNOME/glib!3080
2022-11-18 18:12:52 +00:00
Philip Withnall
e5771df643 gvariant: Add an assertion to clarify some tuple logic
This should quell a scan-build error about dereferencing `member_info`
when it’s `NULL` at the end of the function, due to having zero
iterations of the `for` loop.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-18 17:00:42 +00:00
Philip Withnall
146a0a001d gslice: Tag mem_error() as not returning because it aborts
This should quell some scan-build warnings about code breaking after
returning from mem_error() in a weird state.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-18 16:36:47 +00:00
Philip Withnall
0781e12f45 tests: Add additional assertions to gsubprocess test
This should quell a scan-build warning about passing `NULL` to
`strlen()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-18 16:34:06 +00:00
Philip Withnall
4ff6ecbeff build: Move -Wnonnull flag to meson.build
It should be enabled in all builds, not just CI builds. Otherwise
developers might miss it locally.

This updates commit f11b96f255.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-18 13:33:20 +00:00
Simon McVittie
c1a4aca743 Merge branch 'coverity-build' into 'main'
gmodule: Fix redeclaration of symbol

See merge request GNOME/glib!3075
2022-11-16 18:41:07 +00:00
Philip Withnall
66bb4ab8cc Merge branch 'misc-docs-and-tests-fixes' into 'main'
Misc docs fixes and test improvements in GAction and GNotificationBackend

See merge request GNOME/glib!3073
2022-11-16 12:16:07 +00:00
Philip Withnall
20266f6089 gmodule: Fix redeclaration of symbol
This should fix the Coverity build, which is currently broken:
https://gitlab.gnome.org/GNOME/glib/-/jobs/2389979
```
../gmodule/gmodule-deprecated.c:8: error: "GLIB_DISABLE_DEPRECATION_WARNINGS" redefined [-Werror]
    8 | #define GLIB_DISABLE_DEPRECATION_WARNINGS
      |
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 12:02:06 +00:00
Philip Withnall
5f51cc844c gapplicationcommandline: Fix a minor typo in the documentation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
fec865cb0c gapplicationcommandline: Add a missing transfer annotation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
73f445b099 tests: Add some missing error checks to actions test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
b836ed5c13 tests: Stop using GMainLoop in actions test
Instead, iterate the `GMainContext` directly. This allows tests on
asynchronously returned values to be done in the actual test function,
rather than a callback, which should make the tests a little clearer.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
19eee4bc41 gtestdbus: Use g_timeout_add_seconds() rather than g_timeout_add()
This makes the code a little easier to understand and allows the kernel
a little bit more leeway in scheduling the callback, which is fine
because we don’t need high accuracy here.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
e8c068db50 gnotificationbackend: Fix a GDBusConnection leak
`g_notification_backend_new_default()` adds a reference on
`backend->dbus_connection` (if non-`NULL`), but nothing ever unreffed
that.

Fix that by adding a dispose method.

In practice this is not really a problem, because the notification
backend is held alive by a `GApplication`, which lives as long as the
process. It’ll be a problem if someone is to ever add unit tests for
`GNotificationBackend`s though. So let’s fix it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
683c7d05a3 gnotification: Fix a couple of minor typos in a documentation comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
18574d1ba9 gnotification: Improve docs around GVariant ownership
Add a few missing introspection annotations too.

This doesn’t change any of the ownership handling behaviour, just
documents what’s there. What’s there seems to be correct, to the extent
that I can see.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
af6bf2dc02 ggtknotificationbackend: Fix a minor typo in a comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
716189c4c7 gfdonotificationbackend: Improve internal docs around floating GVariants
The code is correct, but from a quick read-through it wasn’t entirely
clear to me how it handled floating `GVariant`s in object state or the
`parameter` argument.

Add an assertion and some comments to hopefully clarify things a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
d470e7227a gaction: Improve documentation around floating GVariants
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
4748db5fd3 gaction: Improve docs formatting for g_action_parse_detailed_name()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
5ac06ac8ea gaction: Add missing annotations to g_action_parse_detailed_name()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
96bc6d6e7c Merge branch 'wip/smcv/type-flags-test' into 'main'
type-flags test: Force G_ENABLE_DIAGNOSTIC=1 to be set

See merge request GNOME/glib!3070
2022-11-14 13:40:47 +00:00
Philip Withnall
55c1fc7dfc Merge branch 'wip/smcv/hidden-inotify' into 'main'
gio: Use hidden symbol visibility in static libraries

Closes #2811

See merge request GNOME/glib!3069
2022-11-14 13:21:51 +00:00
Philip Withnall
c54773f26f Merge branch 'fix-cross' into 'main'
tests/meson.build: do not use can_run_host_binaries()

See merge request GNOME/glib!3067
2022-11-14 13:01:48 +00:00
Alexander Kanavin
a9fa7589c6 tests: Work around Meson bug with using exe_wrapper
Do not use can_run_host_binaries() as it returns true even though
custom_target() does not currently correctly wrap target-built
tool binaries with exe_wrapper so they can be run on the host.

See https://github.com/mesonbuild/meson/issues/11029
2022-11-14 13:01:47 +00:00
Simon McVittie
b13e12b363 type-flags test: Force G_ENABLE_DIAGNOSTIC=1 to be set
Otherwise this test will succeed at build-time, but will fail when run
as an as-installed test via ginsttest-runner.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-14 12:36:32 +00:00
Simon McVittie
c1ee1a99bc gio: Use hidden symbol visibility in static libraries
Building GLib 2.75.0 on Linux adds various inotify-related internal
symbols to the ABI, which doesn't seem to have been intentional.
I went through the other libraries in the build system, and it looks
as though the BSD kqueue backend would have the same problem.

GNU symbol visibility probably doesn't do anything for gio/win32, but
for completeness I've set that to use hidden symbols too, on the basis
that it'll be easier to get this right if we're consistent.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2811
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-14 12:36:22 +00:00
Philip Withnall
84284521b2 Merge branch 'wip/smcv/full-initializer' into 'main'
gthread: Fully initialize GThreadFunctions structure in test

Closes #2812

See merge request GNOME/glib!3072
2022-11-14 12:31:28 +00:00
Philip Withnall
c477e7aafe Merge branch 'fix-visibility-dep' into 'main'
gio: Fix missing visibility header dependency

See merge request GNOME/glib!3068
2022-11-14 12:24:39 +00:00
Simon McVittie
2b4977635c gthread: Fully initialize GThreadFunctions structure in test
The macOS CI builds with -Werror=missing-field-initializers by default,
making incomplete initializers a compile-time error (even though their
meaning is well-defined: missing fields are initialized as if with
.field = 0).

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2812
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-14 09:43:29 +00:00
Xavier Claessens
b65d6f497d gio: Fix missing visibility header dependency 2022-11-12 10:20:49 -05:00
Philip Withnall
f64f88baae Merge branch 'gtask-must-have-result' into 'main'
gtask: Warn if a GTask is finalised without returning

See merge request GNOME/glib!385
2022-11-10 22:26:18 +00:00
Marco Trevisan
240c99d5a4 Merge branch 'coverage-exclusions' into 'main'
ci: Exclude copylibs and fuzz tests from code coverage

See merge request GNOME/glib!3064
2022-11-10 15:52:48 +00:00
Marco Trevisan
57ee7f914c Merge branch 'gthread-tests' into 'main'
tests: Add some trivial tests for g_thread_init()

See merge request GNOME/glib!3065
2022-11-10 15:51:08 +00:00
Philip Withnall
5585d15d9c tests: Add some trivial tests for g_thread_init()
It’s deprecated, but the big red 0/0/0 line for the `glib/gthread`
directory in the lcov output for GLib is driving me nuts.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 15:33:34 +00:00
Philip Withnall
e960529532 ci: Exclude copylibs and fuzz tests from code coverage
The fuzz tests are run on a separate CI system, and we don’t care what
their code coverage is. The only reason they’re run on our CI systems at
all is as a smokecheck. They are not unit tests that we want to check
are running every line.

Similarly, exclude copylibs/subprojects as GLib is not responsible for
testing them. They have (or should have) their own unit tests and code
coverage metrics in their upstreams.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 14:56:34 +00:00
Philip Withnall
9b68c31b38 tests: Add a missing g_task_return_boolean() in gdbus-server-auth tests
Otherwise the task never returned a value.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/385

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 14:25:47 +00:00
Philip Withnall
fe89940572 gtask: Emit a debug message if a GTask is finalised without returning
This typically indicates a bug in the program, where a GTask has been
created, but a bug in the control flow has caused it to not return a
value.

There is one situation where it might be legitimate to finalise a GTask
without returning: if an error happens in your *_async() start function
after you’ve created a GTask, but before the async operation returns to
the main loop; and you report the error using g_task_report_*error()
rather than reporting it using the newly constructed GTask.

Another situation is where you are just using GTask as a convenient way
to move some work to another thread, without the complexity of creating
and running your own thread pool. GDBus does this with
g_dbus_interface_method_dispatch_helper(), for example.

In most other cases, it’s a bug. Emit a debug message about it, but not
a full-blown warning, as that would create noise in the legitimate
cases.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2022-11-10 14:25:47 +00:00
Philip Withnall
7077e7d819 build: Post-release version bump
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 09:27:34 +00:00
Philip Withnall
069fd1d8cf
2.75.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 09:18:47 +00:00
Philip Withnall
116f84910d docs: Fix date formatting for a few entries in NEWS
ISO 8601, please.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 09:15:44 +00:00
Philip Withnall
1d7dfb68e8 Merge branch 'type-deprecation' into 'main'
Add G_TYPE_FLAG_DEPRECATED

See merge request GNOME/glib!2993
2022-11-09 12:24:06 +00:00
Matthias Clasen
fd0dd9e93c gobject: Add G_TYPE_FLAG_DEPRECATED
This can be used to mark entire types as deprecated,
and trigger a warning when they are instantiated
and `G_ENABLE_DIAGNOSTIC=1` is set in the environment.

There's currently no convenient macros for defining
types with the new flag, but you can do:

```c
_G_DEFINE_TYPE_EXTENDED_BEGIN (GtkAppChooserWidget,
                               gtk_app_chooser_widget,
                               GTK_TYPE_WIDGET,
                               G_TYPE_FLAG_DEPRECATED)
...
_G_DEFINE_TYPE_EXTENDED_END ()
```

Includes a unit test by Philip Withnall.
2022-11-09 12:07:31 +00:00
Philip Withnall
abdb81efa2 Merge branch 'slow-slow-slow-your-boat' into 'main'
tests: Shorten internal codegen test timeout

See merge request GNOME/glib!3050
2022-11-08 19:13:09 +00:00
Ray Strode
4a00ac91c6 tests: Shorten internal codegen test timeout
the gio dbus codegen test has 10 test cases in it.
Each test case is given 100 seconds to complete.

That is far longer than they should need.

Furthermore, the entire test is only given 60s
to complete.

This commit makes the internal timeout more consistent
with the external timeout, by giving each of the 10
test cases 6 seconds instead of 100s.
2022-11-08 13:08:53 -05:00
Philip Withnall
6e57afdefd Merge branch '2782-variant-maybe-wrapper-speedup' into 'main'
gvariant-parser: Speed up maybe_wrapper() by an order of magnitude

Closes #2782

See merge request GNOME/glib!3061
2022-11-08 17:11:07 +00:00