Commit Graph

26173 Commits

Author SHA1 Message Date
Simon McVittie
d0ff4055af gstdio: Warn if g_autofd is used with GLIB_VERSION_MAX_ALLOWED < 2.76
Fixes: b3934133 "gstdio: Add g_clear_fd() and g_autofd"
Helps: #2796
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-27 13:13:48 +01:00
Philip Withnall
16169c8773 Merge branch 'python-testing' into 'main'
ci: Move shellcheck/black/flake8 checks to a new CI job which can fail

See merge request GNOME/glib!3023
2022-10-27 09:58:40 +00:00
Philip Withnall
424cf3a966 ci: Move shellcheck/black/flake8 checks to a new CI job which can fail
We were regressing on Python style too often. Since Python code style is
a lot easier to enforce than C code style, split it (and the shellcheck
checks) out from `style-check-diff` into a new CI job which is allowed
to fail the pipeline.

Only trigger it when .sh or .py files have changed, which should reduce
resource consumption.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-27 10:09:58 +01:00
Marco Trevisan
83beedddc9 Merge branch 'fix_coding_style_gitlab_ci_check-missing-install.tag.py' into 'main'
Fix coding style issue in .gitlab-ci/check-missing-install-tag.py

See merge request GNOME/glib!3022
2022-10-27 09:06:01 +00:00
Emmanuel Fleury
da178b1938 Fix coding style issue in .gitlab-ci/check-missing-install-tag.py 2022-10-27 09:51:28 +02:00
Philip Withnall
0f471fabfb Merge branch 'kgx' into 'main'
Add kgx (gnome console) to known terminals lists

See merge request GNOME/glib!3021
2022-10-26 23:16:20 +00:00
Maxime Gervais
ae65753b16 Add kgx (gnome console) known terminals lists 2022-10-27 00:21:39 +02:00
Philip Withnall
14fcafe2f7 Merge branch 'wip/smcv/equivalent-types' into 'main'
docs: Soft-deprecate types that are just aliases for a standard C type

See merge request GNOME/glib!3003
2022-10-26 21:59:02 +00:00
Philip Withnall
77180daca5 Merge branch 'wip/smcv/standard-va-copy' into 'main'
Soft-deprecate G_VA_COPY in favour of va_copy

See merge request GNOME/glib!2999
2022-10-26 21:34:57 +00:00
Philip Withnall
2ae9c405df Merge branch 'wip/smcv/autofd' into 'main'
gstdio: Add g_clear_fd() and g_autofd

See merge request GNOME/glib!3007
2022-10-26 21:25:31 +00:00
Simon McVittie
b393413321 gstdio: Add g_clear_fd() and g_autofd
Inspired by libglnx's glnx_close_fd() and glnx_autofd, these let us
have the same patterns as g_clear_object() and g_autoptr(GObject), but
for file descriptors. g_clear_fd() is cross-platform, while g_autofd
is syntactic sugar requiring a supported compiler (gcc or clang).

Now that g_close() checks for EBADF as a programming error, we can
implement the equivalent of glnx_autofd as an inline function without
needing to have errno and EBADF in the header file.

g_clear_fd() is like glnx_close_fd(), but with error checking.
The private _g_clear_fd_ignore_error() function used to implement
g_autofd is a closer equivalent of glnx_close_fd().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 19:05:33 +01:00
Simon McVittie
65016fddd9 Replace all uses of G_VA_COPY with Standard C va_copy
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Simon McVittie
b8f37a543c glib: Always implement G_VA_COPY as va_copy()
C99 guarantees that va_copy() exists, so use it, instead of probing
for __va_copy(), va_copy(), or a reimplementation from first principles.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Simon McVittie
fe7eb71c43 docs: Soft-deprecate G_VA_COPY in favour of va_copy
We now require C99, which guarantees that va_copy is available.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Marco Trevisan
b9e68b0bd4 Merge branch 'support-xdg-terminal-exec' into 'main'
Add support for xdg-terminal-exec for handling desktop applications using 'Terminal=true'

See merge request GNOME/glib!2839
2022-10-26 17:03:12 +00:00
Marco Trevisan
0d425bc276 Merge branch 'fix-install-tag-check' into 'main'
ci: Fix check for missing install tag

See merge request GNOME/glib!3019
2022-10-26 16:51:17 +00:00
Simon McVittie
1464d6ab36 glib-init: Add static assertions for int, short, long type aliases
Helps: #1484
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 17:50:07 +01:00
Simon McVittie
d6ea9292d7 docs: Soft-deprecate types that are just aliases for a standard C type
There is usually no reason to use the GLib-specific type names here,
other than consistency. The GLib-specific one-word type names can
sometimes be a little more convenient when generating a family of
function names from macros.

Because these types are simple aliases for a hard-coded standard C type,
there should be no API or ABI issues caused by changing existing code to
use the standard C names: a `char **` can already be used interchangeably
with `gchar **`, and name-mangling for a C++ method that takes an `int`
parameter is equivalent to a `gint` parameter.

Helps: #1484
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 17:50:07 +01:00
Max Gautier
dd9bc7cf59 gio: test xdg-terminal-exec usage 2022-10-26 18:41:26 +02:00
Max Gautier
22e1b9bcc0 gio: add xdg-terminal-exec as a known terminal
Allow users to select their terminal of choice by using the
xdg-terminal-exec wrapper.

It is a temporary temporary solution while waiting for the
xdg-default-apps specification
(https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/54), in
accordance with this comment:
https://gitlab.gnome.org/GNOME/glib/-/issues/338#note_1076172
2022-10-26 18:41:26 +02:00
Max Gautier
b64347d279 gio: add support for terminal with no option
Introduce support for terminals executing commands without an option,
i.e., the command is passed directly as argument to the terminal emulator.
This is needed for xdg-terminal-exec.
2022-10-26 18:41:26 +02:00
Max Gautier
eb2d1d8fc8 gio: Refactor the known terminals search
Get rid of multiple conditionals branch by using a loop and storing the
options needed by particular terminal emulators directly in an array.
Remove intermediate variable term_argv as we don't need it.

Advantages:
- simpler logic, less branching
- the terminal emulator list is more readable, by virtue of being
  condensed in one array. Launch options to execute a terminal program
  are also more explicitly specified
- the logic become independent from the order
- one less allocation
2022-10-26 18:15:26 +02:00
Xavier Claessens
a4eb39dde8 ci: Fix failing tests not failing CI job 2022-10-26 11:55:56 -04:00
Xavier Claessens
9ba01dc7fc ci: Fix check for missing install tag
Better check the installation plan json file instead of parsing logs.
2022-10-26 11:55:56 -04:00
Xavier Claessens
b8a0ffa1b9 meson: Add missing install tags 2022-10-26 11:55:56 -04:00
Marco Trevisan
1590e7636c Merge branch 'ebassi/version-header-install' into 'main'
Install gversionmacros.h in the right place

See merge request GNOME/glib!3018
2022-10-26 15:04:01 +00:00
Emmanuele Bassi
0ea1d3fecc Install gversionmacros.h in the right place
The gversionmacros.h header is referenced from glib/, so it needs to go
into glib's include directory, not in the top-level alongside glib.h,
glib-object.h, gmodule.h, and glib-unix.h.
2022-10-26 15:05:36 +01:00
Philip Withnall
e11bf10eac Merge branch 'RTLD_DEFAULT' into 'main'
Handle plugable g_modules through RTLD_DEFAULT for NetBSD

Closes #19

See merge request GNOME/glib!3014
2022-10-26 09:47:51 +00:00
Philip Withnall
010d831e0e Merge branch 'fix-desktop-app-info-leak' into 'main'
gio/gdesktopappinfo: Free the wrapped argv array on launch failure

See merge request GNOME/glib!3008
2022-10-26 09:28:08 +00:00
Philip Withnall
ed05da29f7 Merge branch 'cesun/fix-add-instance-private-typo' into 'main'
Fix function name typo in comment of gtype.c

Closes #2791

See merge request GNOME/glib!3016
2022-10-26 08:32:40 +00:00
sunce
ea1b2cba0c Fix function name typo in comment of gtype.c
The function adjusting private struct size to private struct offset
should be `g_type_class_adjust_private_offset`, instead of the
previously misspelled `g_type_class_add_instance_private` in comment.

Fixes #2791
2022-10-26 10:17:39 +08:00
Philip Withnall
e562c3b8a3 Merge branch 'wip/3v1n0/clang-warning-fixes' into 'main'
tests: Fix few new clang warnings

See merge request GNOME/glib!3013
2022-10-25 16:04:10 +00:00
Emmanuel Fleury
81e4498565 Handle plugable g_modules through RTLD_DEFAULT for NetBSD
fix issue #19
2022-10-25 17:31:25 +02:00
Marco Trevisan (Treviño)
dafd6602dc gio/gdesktopappinfo: Free the wrapped argv array on launch failure
We create an array that we never free, ensure this is the case.
The previous commit gives CI a chance to check this with valgrind job.

Found as part of another review:
 - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839#note_1524922
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
37e61d66c3 gio/tests/desktop-app-info: Add test to check failure on launch as manager
Trying to use invalid Fd's numbers so that this would fail early.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
6bbc72d2c4 gio/tests/desktop-app-info: Add a TestLaunchContext to improve SN testing
Add a custom launch context implementation so that we can test the
startup notification code better.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
ec67c7dbf2 desktop-app-info: Run test without display, they work with no issue 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
d4a31897ab tests/desktop-app-info: Check if launched signal is emitted 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
a156998bee gvariant: Add missing explicit g_variant_dict_lookup tests 2022-10-25 14:31:02 +02:00
Philip Withnall
60ceaa77be Merge branch 'timezone-relative-link-target' into 'main'
gtimezone: Fix symlink checks on relative link targets

See merge request GNOME/glib!3009
2022-10-25 12:21:40 +00:00
Fabio Tomat
f25d7d9060 Update Friulian translation
(cherry picked from commit 142f1712d2)
2022-10-25 11:43:14 +00:00
Marco Trevisan
a3488a38e7 Merge branch 'wip/add-built-headers-deps-v2' into 'main'
meson: Cleanup and fix include files paths, using base path without repetitions

See merge request GNOME/glib!3011
2022-10-25 09:14:15 +00:00
Simon McVittie
7b05defa0e Merge branch 'wip/smcv/pointers-can-be-large' into 'main'
docs: Stop claiming that gsize is wide enough to hold a pointer

See merge request GNOME/glib!3000
2022-10-24 20:29:07 +00:00
Philip Withnall
e33f23a6b5 Merge branch 'wip/smcv/64-bit-hash' into 'main'
ghash: Correctly retrieve low 32 bits of 64-bit values

Closes #2787

See merge request GNOME/glib!2994
2022-10-24 20:22:15 +00:00
Philip Withnall
7b09713963 Merge branch 'floating-variants-grr' into 'main'
Always ref-sink variants in g_object_set

Closes #2774

See merge request GNOME/glib!2934
2022-10-24 20:21:53 +00:00
Philip Withnall
521d481d64 Merge branch 'wip/smcv/standard-offsetof' into 'main'
docs: Soft-deprecate G_STRUCT_OFFSET in favour of offsetof

See merge request GNOME/glib!3002
2022-10-24 20:09:54 +00:00
Marco Trevisan (Treviño)
0de22a8864 tests/strfuncs: Do not compare string literal with pointers
Otherwise clang would complain:

  ../glib/tests/strfuncs.c:2603:32: warning: result of comparison
    against a string literal is unspecified (use an explicit string
    comparison function instead) [-Wstring-compare]
    g_assert_true ((gpointer)str != (gpointer)"");
                                 ^  ~~~~~~~~~~~~
  ../glib/gtestutils.h:187:59: note: expanded from macro 'g_assert_true'
                                               if G_LIKELY (expr) ; else \
                                                            ^~~~
  ../glib/gmacros.h:1186:59: note: expanded from macro 'G_LIKELY'
  #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
                                                            ^~~~
  ../glib/gmacros.h:1180:8: note: expanded from macro '_G_BOOLEAN_EXPR'
     if (expr)
2022-10-24 21:34:35 +02:00
Marco Trevisan (Treviño)
8341a1cf06 tests/sequence: Ensure iterator is set and actually checked
Clang was complaining:

  ../glib/tests/sequence.c:125:7: warning: variable 'i' set but not used
    int i;
        ^
  1 warning generated.
2022-10-24 21:33:18 +02:00
Marco Trevisan (Treviño)
836fd0563d meson: Remove unneeded install_tag's on headers
Meson is able to handle this automatically when we're installing in the
include-dir prefix.
2022-10-24 21:09:49 +02:00
Marco Trevisan (Treviño)
6dd222e753 meson: Cleanup include-dir paths, use base path without repetitions
Avoid setting the subdir all the times, just use the global definition
plus the specific module subdir
2022-10-24 21:09:09 +02:00