Commit Graph

30456 Commits

Author SHA1 Message Date
Matthijs Velsink
f2df7c3115 docs: Add GTYPE_TO_POINTER/GPOINTER_TO_TYPE
Commit d0e03f09 introduced GTYPE_TO_POINTER/GPOINTER_TO_TYPE, on which
work started before the move of conversion macros to Markdown. It did
get merged after that move, but the macros never made it into the docs.

Let's do so now.
2024-05-27 23:24:42 +02:00
Jordi Mas i Hernandez
7cf878df83 Update Catalan translation
(cherry picked from commit 0043895879)
2024-05-27 14:56:38 +00:00
Philip Withnall
c02f50f0ba Merge branch 'clear-pointer-doc' into 'main'
gmem.c: Update g_clear_pointer() documentation

See merge request GNOME/glib!4093
2024-05-24 10:16:51 +00:00
Chun-wei Fan
3f11a55983 gmem.c: Update g_clear_pointer() documentation 2024-05-24 10:16:51 +00:00
Simon McVittie
2032d150b0 Merge branch 'wip/pwithnall/macos-symlink' into 'main'
tests: Fix compilation failure on macOS due to missing include

See merge request GNOME/glib!4094
2024-05-24 09:38:08 +00:00
Philip Withnall
6187d40a0f
tests: Fix compilation failure on macOS due to missing include
It’s needed for the `symlink()` function.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-05-24 09:52:55 +01:00
Philip Withnall
60845fce0a Merge branch 'dont-rm-rf-root' into 'main'
gtestutils: Don't follow symlinks when deleting tests' tempdir

Closes #3290

See merge request GNOME/glib!4018
2024-05-23 23:08:39 +00:00
Will Thompson
56c6e28c68 Test that isolate-dirs doesn't follow symlinks during cleanup 2024-05-23 23:01:32 +01:00
Will Thompson
dc97423ead Test cleaning up unreadable temporary test directory
Neither the new nftw()-based rm_rf() implementation, nor the fallback
implementation, should fail the test if there is an error during cleanup
of the directory tree. And the output on stderr that the nftw()-based
implementation emits should not interfere with Meson parsing the TAP
stream on stdout.

The test is run in a subprocess so that we can clean up after ourselves.
2024-05-23 23:01:32 +01:00
Philip Withnall
31c85d3985 Merge branch 'gpattern-docs' into 'main'
gpattern: Port the docs to gi-docgen syntax

See merge request GNOME/glib!4081
2024-05-23 09:55:32 +00:00
Philip Withnall
d6abaf7921
gpattern: Port the docs to gi-docgen syntax
And make a few formatting fixes.

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

Helps: #3250
2024-05-23 10:36:50 +01:00
Philip Withnall
4fde1a6cfc Merge branch 'ebassi/override-test-c_args' into 'main'
build: Use C89 for the standard version check

See merge request GNOME/glib!4091
2024-05-23 08:53:00 +00:00
Will Thompson
5f6dda5bdc gtestutils: Don't follow symlinks when deleting tests' tempdir
Previously, when cleaning up the temporary directory tree created by
passing G_TEST_OPTION_ISOLATE_DIRS, any symbolic links in that tree
would be followed recursively. If the test case has created a symbolic
link in its temporary directory to a directory outside that tree, this
could lead to unexpected data loss; in particular, if the test case
author has (unwisely) created a symbolic link to /, they could lose all
data on the system.

On systems that have the ftw.h header, replace the current rm_rf()
implementation with one that uses nftw() to perform a depth-first
traversal (FTW_DEPTH) without following symbolic links (FTW_PHYS), and
without crossing mount points (FTW_MOUNT) in case a test has mounted
some other filesystem in the temporary directory.

The callback logs any error to the standard error stream, but returns 0
rather than -1 to allow nftw() to keep walking the tree rather than
terminating immediately. Suppose we are trying to clean up the following
tree:

    tmpdir/
      a/
        f/ (directory not readable for some reason)
        g/
          p
      b/
        c
        d

Since tmpdir/a/f is not readable, we can expect to fail to delete
tmpdir/a/f, tmpdir/a and tmpdir; but it is preferable to (attempt) to
delete the rest of the tree rather than failing outright. The cost is
that three errors will be logged (for tmpdir/a/f, tmpdir/a and tmpdir).

nftw() is part of POSIX.1-2001, SUSv1, and glibc ≥ 2.1, so should be
available on effectively every platform except Windows. (And Windows
does not enable symbolic links by default so the developer error is less
likely to occur there.)

The macOS ftw(3) manpage says:

> These functions are provided for compatibility with legacy code.  New
> code should use the fts(3) functions.

fts(3) does not seem to be part of any standard, but it does seem to be
equally widely supported. The Linux manpages do not indicate that
nftw() is deprecated.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3290
2024-05-22 22:43:42 +01:00
Matthijs Velsink
9b153495b6 docs: Improve conversion-macros formatting
There is no need to use double backticks. Also, insert extra newlines
between header and item, which paragraphs the item [1, 2], increading
readability by giving a little more "breathing" room between items. This
is also done in `macros.md`. Also, indentation of the definition block
should technically be 4 if extra paragraphs are needed, but it's better
to use 4 indentation always to prevent future problems after edits.

[1] https://python-markdown.github.io/extensions/definition_lists/
[2] https://michelf.ca/projects/php-markdown/extra/#def-list
2024-05-22 22:40:31 +02:00
Emmanuele Bassi
11157ca936 build: Use override_options for C standard selection
Do not try to inject the C standard into `c_args`: Meson already
generates a compiler command line with the appropriate C standard, and
adding another one into it at a random position is either potentially
undefined behaviour, or it's going to break the build because the
compiler does not accept more than one switch.

Meson has an `override_options` argument for the executable() object,
and we are already using it in places.
2024-05-22 17:05:03 +01:00
Emmanuele Bassi
4fcdbd6f84 build: Use C89 for the standard version check
The '90' version is for ISO C90, but Meson does not understand it. As
far as GCC and Clang are concerned, `-std=c89` is exactly the same as
`-std=c90`. As of VS 2017, MSVC supports `/std:c11` as the minimum
version of the C standard, with C89 (plus Microsoft extensions) being
the default.

See:

- GCC: https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/C-Dialect-Options.html
- MSVC: https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170#c-standards-support-1
2024-05-22 17:04:51 +01:00
Philip Withnall
dc24e78286 Merge branch 'gobject_fix_links_to_param_name_rules' into 'main'
gobject: fix broken links to parameters and signals naming rules

See merge request GNOME/glib!4083
2024-05-21 22:32:21 +00:00
gwillems
d6e0cf9884 gobject: fix broken links to parameters and signals naming rules 2024-05-21 22:32:20 +00:00
Philip Withnall
317739c8e2 Merge branch 'ebassi/revert-bool-constants' into 'main'
Revert "Alias TRUE and FALSE to C99's true and false"

See merge request GNOME/glib!4089
2024-05-21 22:31:14 +00:00
Emmanuele Bassi
db419ffbde Revert "Alias TRUE and FALSE to C99's true and false"
This reverts commit 67d89a5a87.

Turns out that C++ doesn't like it when stuff goes from an integer to a
boolean.

See: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/2900
2024-05-21 21:56:04 +01:00
Emmanuele Bassi
af7c7c0495 Merge branch '3369-dead-links' into 'main'
docs: Fix broken links in gdbus-codegen documentation

Closes #3369

See merge request GNOME/glib!4086
2024-05-21 10:27:29 +00:00
Philip Withnall
38d21dcbfa Merge branch 'wip/pwithnall/musl-systemtap' into 'main'
ci: Disable systemtap on musl CI build

See merge request GNOME/glib!4087
2024-05-21 10:09:55 +00:00
Philip Withnall
9e8b0f6730
ci: Disable systemtap on musl CI build
It’s not needed, and is now failing with:
```
meson.build:2578:36: ERROR: Feature systemtap cannot be enabled: Cannot enable systemtap because dtrace feature is disabled
A full log can be found at /builds/GNOME/glib/_build/meson-logs/meson-log.txt
```

See https://gitlab.gnome.org/GNOME/glib/-/jobs/3901860

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-05-21 10:44:50 +01:00
Andre Klapper
9dae1dc62f DOAP: Link to GitLab Issues instead of New Issue URL
When not logged in, the New Issue URL only redirects to an unhelpful
login page while the Issues page allows you to search for existing
issues and still offers a "New Issue" button.
2024-05-20 17:36:29 +02:00
Philip Withnall
3472a51dc6 Merge branch 'wip/jtojnar/strfunc-docs' into 'main'
docs: Improve g_strescape & g_strcompress descriptions

See merge request GNOME/glib!4084
2024-05-20 15:16:07 +00:00
Philip Withnall
f5322fdfa8 Merge branch 'ebassi/issue-3372' into 'main'
build: Add docs.c to the GLib GIR

Closes #3372

See merge request GNOME/glib!4085
2024-05-20 15:06:59 +00:00
Philip Withnall
066a2cd8cc
docs: Fix broken links in gdbus-codegen documentation
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3369
2024-05-20 13:50:46 +01:00
Emmanuele Bassi
e7ef715883 build: Add docs.c to the GLib GIR
For historical reasons, some doc blocks are included in an ancillary
file. Add it to the list of sources parsed by g-ir-scanner, to increase
the coverage of various macros.

Fixes: #3372
2024-05-20 13:34:19 +01:00
Jan Tojnar
c068c1cd74 docs: Remove hex escape mention in gvariant-text-format bytestring
bytestring_parse does not actually support hexadecimal escape sequences.
2024-05-20 13:31:03 +01:00
Balázs Úr
974b89e707 Update Hungarian translation 2024-05-19 10:19:18 +00:00
Jan Tojnar
460a9c299c docs: Adjust gvariant-text-format reference on bytestring escapes
- Do not refer to people’s expectation, they can wildly differ.
- Do not link to `strcompress`, that confusingly does not support `\a`. Link Wikipedia instead.
- Reiterate the C escape sequences from string section, they are not that many.
- Mention escaping newline and other characters (also copied from string section).
- Mention Unicode escapes not being supported to contrast with strings.
2024-05-19 00:55:45 +02:00
Jan Tojnar
32b8a8400d docs: Link Wikipedia on C escapes in gvariant-text-format for strings
Unlike in the bytestring section there is no link to explanation.
2024-05-19 00:55:45 +02:00
Jan Tojnar
56d8f14ab2 docs: Correct octal format in gvariant-text-format
There is no o or 0 prefix, just one to three octal numbers.
2024-05-19 00:31:25 +02:00
Jan Tojnar
701412530b gstrfuncs: Remove g_strescape docs from the header
They are not visible in the API reference with gi-docgen.
2024-05-18 23:34:20 +02:00
Jan Tojnar
c167562b38 docs: Describe g_strcompress processing
GVariant Text Format section on bytestrings links to `g_strcompress`
but what it does was only briefly described in the header file,
which is not visible in the gi-docgen-built reference. To really
find out one would have to guess to continue through the rabbit hole
to `g_strescape`.

Let’s merge the description from the header and elaborate on it a bit.
2024-05-18 23:31:59 +02:00
Jan Tojnar
4acedc8669 docs: Improve g_strescape description wording
Saying that it inserts a backslash before special character is incorrect
for anything but a double quote and backslash itself. Instead, it replaces
the special characters with a C escape sequence.

Let’s fix that and also make it less C focused by using Unicode names
of the characters instead of assuming everyone knows C escape sequences
by heart.
2024-05-18 23:00:21 +02:00
Jan Tojnar
275330009a docs: Fix g_strescape rendering escape sequences
In the gi-docgen Markdown flavour, \' will just prevent the apostrophe
from turning into a curly single quote.
2024-05-18 22:55:58 +02:00
Michael Catanzaro
c88cbd06de Merge branch 'mcatanzaro/#3354' into 'main'
Convert dtrace and systemtap to feature option type, and fix sysprof option

Closes #3354

See merge request GNOME/glib!4076
2024-05-17 20:38:17 +00:00
Michael Catanzaro
329a69e558 Change sysprof build option default value to 'auto'
Now sysprof can be enabled by default in distros that use
-Dauto_features=enabled or for developers who already have sysprof
installed, while it's still disabled for developers who do not have
sysprof installed. See #3354
2024-05-17 15:22:41 -05:00
Michael Catanzaro
153cda6669 Convert systemtap from bool to feature option type
Now systemtap can be enabled by default in distros that use
-Dauto_features=enabled or for developers who already have systemtap
installed, while it's still disabled for developers who do not have
systemtap installed. See #3354
2024-05-17 15:22:41 -05:00
Michael Catanzaro
ed020a688a Convert dtrace from bool to feature option type
Now dtrace can be enabled by default in distros that use
-Dauto_features=enabled or for developers who already have dtrace
installed, while it's still disabled for developers who do not have
dtrace installed. See #3354
2024-05-17 15:22:41 -05:00
Chun-wei Fan
ef73ce4f7f Introspection: Fix running g-ir-scanner 1.80.x+ on Windows
Since we are now building introspection files for GLib while building
GLib, so we want to make sure that we indeed load the freshly-built
DLLs when running g-ir-scanner, so we add the various needed subdirs
(and if needed, subprojects), to set the GI_EXTRA_BASE_DLL_DIRS
envvar so that g-ir-scanner will look for the newly-built GLib DLLs.

Ideally, upstream g-ir-scanner will need to be updated accordingly to do
something similar to what we are doing here, but this is needed until
the time that we require a g-ir-scanner that contains the update.

This will also fix the g-ir-scanner erroring out when there is no
pre-existing GLib on the system, as the needed DLLs are now found.

Related issue: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/499
Related MR in G-I:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/458
2024-05-17 18:37:32 +08:00
Philip Withnall
04de380f74 Merge branch 'wip/smcv/gdbusconn-comment' into 'main'
gdbusconnection: Fix a misleading comment

See merge request GNOME/glib!4063
2024-05-16 23:42:06 +00:00
Philip Withnall
5b1817c07b Merge branch 'wip/smcv/more-gdbus-constants' into 'main'
gdbus: Make more use of symbolic constants for various aspects of the D-Bus protocol

See merge request GNOME/glib!4069
2024-05-16 23:27:02 +00:00
Philip Withnall
04a6ee3e9b Merge branch 'wip/3v1n0/gi-repository-leak-fixes' into 'main'
girepository/build: Actually use our compiler to generate GLib typelibs and fix parser leaks

See merge request GNOME/glib!4064
2024-05-16 23:15:16 +00:00
Philip Withnall
52e850d54c Merge branch 'ebassi/i18n-docs' into 'main'
Document the magic gettext macros in gi18n.h

Closes #3361

See merge request GNOME/glib!4071
2024-05-16 22:27:48 +00:00
Philip Withnall
5433bb23a0 Merge branch '3303-girepository-typelib-determinicity' into 'main'
girepository: Keep an ordered list of the loaded typelibs

Closes #3303

See merge request GNOME/glib!4033
2024-05-16 22:27:01 +00:00
Simon McVittie
434c105bbe gdbusconnection: Fix a misleading comment
While backporting CVE-2024-34397 fixes I noticed that this comment
claimed that the reference count is immutable after construction, which
is clearly not true. In fact the reference count is the only
mutable field.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-16 22:53:11 +01:00
Simon McVittie
510d0716be gdbus: Use symbolic constants for the most common D-Bus error names
To avoid adding a large block of macros to gdbusprivate.h, I've only
added a subset of the well-known error names. I chose to draw the
line by adding constants for the errors emitted via their string names
in GDBusConnection, but not for error names that are only mentioned
in `gdbuserror.c` or in tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-16 22:52:23 +01:00
Simon McVittie
7c609f8142 gdbus: Use symbolic constants for interfaces from dbus-specification
Most D-Bus interfaces are domain-specific, but these interfaces from the
D-Bus Specification are intended to be commonly used in any context for
which they are found to be appropriate.

Most of these use `gdbusprivate.h`. One exception is that
`gio/tests/gdbus-example-*` redefine the constants locally: due to these
files' dual role as part of the unit tests and as sample code, it seems
desirable to ensure that they can still be compiled outside GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-16 22:52:23 +01:00