1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00

445 Commits

Author SHA1 Message Date
Rudi Heitbaum
a9a9906537 Fix const qualifiers where discarded
This patch fixes several const qualifiers by adjusting where required.

Since glibc-2.43 and ISO C23, the functions bsearch, memchr, strchr,
strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr
that return pointers into their input arrays now have definitions as
macros that return a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-02-23 11:44:02 +00:00
Nirbheek Chauhan
2556270ff0 meson: Remove host_system = ios and warn if cross files set it
Prior to the addition of subsystem support in Meson, people who wanted
to cross-compile to iOS often set `system = 'ios'` in the cross file and
meson happily plumbed that to `host_machine.system()`.

However, we now use subsystems, so we should stop accepting
host_system == ios.
2026-02-03 21:52:11 +05:30
Luca Bacci
84931d5926 Use test-profile-dep in tests 2026-01-30 12:07:21 +01:00
Luca Bacci
4ecaccc4ae gmodule.c: Fix warning about use of deprecated G_MODULE_SUFFIX macro 2026-01-24 15:15:12 +01:00
Luca Bacci
525c916632 gmodule/dl: Document thread-safety of dlerror in musl libc 2026-01-24 14:35:12 +01:00
Luca Bacci
749b9b46ef gmodule/dl: Add support for Cygwin in _g_module_build_path 2026-01-24 14:35:12 +01:00
Luca Bacci
958e88b093 tests/gmodule: G_MODULE_BIND_LOCAL is not supported on Cygwin
https://cygwin.com/pipermail/cygwin-patches/2010q3/007041.html
2026-01-24 14:35:12 +01:00
Luca Bacci
da9cae80f7 gmodule/win32: Drop support for Cygwin
We use gmodule-dl.c on Cygwin, there's no point in keeping
Cygwin-specific code paths in gmodule-win32.c.

Note: the official Cygwin glib2 package patches meson.build
to use gmodule-win32.c. However:

 1. It didn't use those Cygwin-specific code paths anyway.
 2. We now include everything that Cygwin needs. The
    official glib2 package need not patch meson.build
    anymore.
2026-01-24 14:31:23 +01:00
Luca Bacci
a91339a86f gmodule/win32: Drop unused function 2026-01-24 12:29:52 +01:00
Luca Bacci
a8fc5711a9 gmodule: Fix library prefix on MSYS
MSYS uses "msys-" instead of "cyg"
2026-01-24 12:29:52 +01:00
Ailin Nemui
ac1c48dd02 gmodule: Fix library extension on Cygwin
Fixes #3741
2026-01-24 12:29:23 +01:00
Yaakov Selkowitz
1e487c9170 gmodule: Traverse dependencies when searching symbols on Cygwin
While Cygwin has the standard dlopen/dlclose/dlsym APIs, one thing
it cannot handle is opening a module to find a symbol among its
dynamically linked dependencies. Here we implement a workaround
based on the Tool Help library.

Co-authored-by: Luca Bacci <luca.bacci@outlook.com>
2026-01-22 14:25:13 +01:00
Philip Withnall
097fa12dd4 gmodule: Enable -Wshorten-64-to-32 warnings for gmodule
There were no such warnings in this library, so we can
enable the warning flag to prevent any being added in future.

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

Helps: #3527
2026-01-16 13:06:30 +00:00
Luca Bacci
ef0edb01ad Use template library RC file 2025-11-20 11:00:59 +01:00
Luca Bacci
663ee11fda Add OS profile app to executables
Fixes #3733
2025-11-20 11:00:59 +01:00
Philip Chimento
0a87b5bc1a all: Apply G_GNUC_FLAG_ENUM to all flags enums 2025-11-07 22:44:35 -08:00
Nick Steel
267b1246d7 docs: Calling gmodule funcs in constructors may deadlock
Fixes #1443.
2025-07-15 11:18:27 +00:00
Philip Withnall
ecc1f86e92 gmodule: Fix a minor -Wsign-conversion error on Windows
Spotted by CI: https://gitlab.gnome.org/pwithnall/glib/-/jobs/4968919

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

Helps: #3405
2025-04-12 16:25:03 +01:00
Philip Withnall
95fa8de2c3 gmodule: Enable -Wsign-conversion for gmodule subdirectory
There was only one `-Wsign-conversion` warning in the whole
subdirectory, so that was easy.

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

Helps: #3405
2025-04-11 23:56:08 +01:00
Mavroudis Chatzilazaridis
cb1502ed66 docs: Fix invalid references and broken links
This commit fixes quite a few broken links and references, minor typos,
and improves wording in some sections.
2025-02-05 22:28:26 +02:00
Benjamin Gilbert
b7203e9406 build: Drop redundant install_tag arguments for headers
All supported versions of Meson will autodetect the tag.
2024-09-11 22:04:39 -07:00
Philip Withnall
82295998ac Revert "gmodule-dl: Use RTLD_DEFAULT on FreeBSD too"
This reverts commit bb2ab2647d.

It appears to break the use of `G_MODULE_BIND_LOCAL`, as evidenced by
the `test_local_binding()` test in `module-test.c` failing on FreeBSD
ever since that test was added. See #3415.

Looking back at the merge request (!3656), I should have pressed for
detail on why this change was needed.

Fixes: #3415
2024-08-20 14:47:23 +01:00
Philip Withnall
84fe784b51 tests: Run GModule tests in subprocesses
While we try to unload the test modules that we load, at the end of each
test, it’s not always possible: musl, for example, explicitly doesn’t
support unloading modules (see
https://wiki.musl-libc.org/functional-differences-from-glibc.html#Unloading_libraries).

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

Fixes: #3415
2024-07-24 17:07:23 +02:00
Randy Eckenrode
3ab13ddc4b gmodule: skip local-binding test on Windows 2024-07-11 00:47:42 -04:00
Randy Eckenrode
73d913519d gmodule-dl: fix G_MODULE_BIND_LOCAL on Darwin
According to POSIX, the default behavior of `dlopen` is unspecified when
its flags include neither `RTLD_LOCAL` nor `RTLD_GLOBAL`. Consequently,
different platforms have different default behavior.

The default on Linux is `RTLD_LOCAL`, but the default on Darwin is
`RTLD_GLOBAL`. By passing `0` to `dlopen`, this results in the opposite
of the caller's intent when using `G_MODULE_BIND_LOCAL`.

Passing `RTLD_LOCAL` for `G_MODULE_BIND_LOCAL` allows the correct
behavior to be observed regardless of the platform's default.
2024-07-10 20:00:22 -04:00
Philip Withnall
f7b48b5c25 gmodule: Fix various implicit conversions from size_t to smaller types
Basically various trivial instances of the following MSVC compiler
warning:
```
../gio/gio-tool-set.c(50): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-25 12:39:39 +01:00
L. E. Segovia
6e0632a29e gmodule-dl: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:44:29 -03:00
L. E. Segovia
6e664dbe33 gmodule: Use __ANDROID__ to test for the OS, not __BIONIC__
See https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md
2024-04-02 08:43:55 -03:00
Hailey Somerville
c65e163240 gio, gmodule, gthread: compile windows resources only in shared build
When linking static libraries, multiple resources is an error unless
handled in a special way. glib and gobject do not have this problem,
as they already only include resources when building a shared lib.
2024-01-21 18:51:52 +11:00
Philip Withnall
12373227d1 Merge branch 'gmoduleopen_docs_clarify' into 'main'
docs: Clarify >=2.76 changes to g_module_open()

See merge request GNOME/glib!3818
2024-01-15 16:17:54 +00:00
Logan Rathbone
f45a58569f docs: Clarify >=2.76 changes to g_module_open() 2024-01-11 16:39:12 -05:00
Marco Trevisan (Treviño)
9c4ff01feb build: Move gir generation to an introspection folder
Generating gir and typelib files has inter-dependencies that may depend
on other elements.

For example, glib requires gobject and gdump generated files require
gmodule, so we've a cyclic dependency because gmodule requires gobject,
that requires glib.

To prevent this, let's just generate the introspection files at once in
a different meson file so that we don't have to deal with this.

As per this we could even revert commit fa37ab6d0 since gio is now
compiled before the gir files.
2023-12-20 21:35:53 +01:00
Emmanuele Bassi
fe32c3f5c5 Generate introspection data
Currently, the introspection data for GLib and its sub-libraries is
generated by gobject-introspection, to avoid the cyclic dependency
between the two projects.

Since gobject-introspection is generally available on installed systems,
we can check for its presence, and generate the introspection data
directly from GLib.

This does introduce a cyclic dependency, which is why it's possible to
build GLib without introspection, then build gobject-introspection, and
finally rebuild GLib.

By having introspection data available during the GLib build, we can do
things like generating documentation; validating newly added API; and
close the loop between adding new API and it becoming available to non-C
consumers of the C ABI (i.e. language bindings).
2023-10-23 11:26:53 +01:00
Gleb Popov
bb2ab2647d gmodule-dl: Use RTLD_DEFAULT on FreeBSD too 2023-10-22 21:41:33 +03:00
Matthias Clasen
390d9a446d docs: Move GModule documentation to Markdown
Helps: #3037
2023-10-11 14:01:29 +01:00
Harald van Dijk
6e29fbec2d Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"
This reverts commit 004f48f4fc.

Per the discussion on #3356, this change was prompted by a
misunderstanding of ldflags/link_args, and it resulted in various other
packages using glib no longer getting symbols exported. This commit
restores the glib 2.76 behaviour.
2023-07-18 18:26:49 +01:00
Marco Trevisan (Treviño)
fe38a02c62 gmodule: Define a gmodule include dependency and use it in gio modules
Various gio modules include gmodule.h that requires the
gmodule-visibility.h to be already built.

To make this easier, just provide a dependency and use it where we are
building modules that do not depend on libgio_dep (that already includes
that).

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2982
2023-04-19 21:10:29 +02:00
Marco Trevisan
9f111c3416 Merge branch 'valgrind-variable' into 'main'
meson: Add glib_valgrind_suppressions variable to glib pkg-config file

See merge request GNOME/glib!3361
2023-04-17 12:52:28 +00:00
Marco Trevisan (Treviño)
ade79bcb50 meson: Add tests for generated pkg-config files
Ensure things are generated as we expect and avoid we regress on that.
2023-04-17 14:25:52 +02:00
Jan Tojnar
004f48f4fc build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags
Previously, `-Wl,--export-dynamic` was in `Libs` key of `gmodule-2.0.pc`,
even though `-Wl` is a compiler flag, rather than a linker one.
This caused issues with API reference builds in evolution-data-server,
which passes the output of `pkg-config --libs` through `--ldflags`
argument of `gtkdoc-scan`, which are forwarded unchanged to `ld`:

    ld: unrecognized option '-Wl,--export-dynamic'

Let’s move the flag to `Cflags` so that the compiler can deal with it.

https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/463
2023-03-31 20:44:14 +02:00
Maciej S. Szmigiero
3f2e18b07c Use O_CLOEXEC in {g_,}open () calls for race-free setting of the close-on-exec flag
The remaining call sites are either Windows-only, between fork () and
exec () or in xdgmime copylib.

Hope I haven't missed any site.
2023-02-21 12:42:55 +00:00
Marco Trevisan (Treviño)
1594cf77eb meson: Use exitcode protocol for some c++ and gobject definition tests
In all these cases we don't really care about running the test file,
while building and basic execution it is relevant.

Also they don't support TAP at all.
2023-01-17 21:08:48 +01:00
Marco Trevisan (Treviño)
58031feb17 meson: Use 'tap' test protocol by default
Meson supports tap protocol results parsing, allowing us to track better
the tests that are running (and the ones that are actually skipped) without
manually parsing the test output.

However this also implies that using the verbose mode for a test doesn't
show its output by default (unless there are failures).
2023-01-17 21:08:48 +01:00
Emmanuele Bassi
684d9aa0c3 build: Don't overwrite build variables
We cannot use `gvisibility_h` for different visibility header files; you
never know when you're going to refer to the variable again, and
projects might end up needing to retrieve the variable contents—like,
for instance, gobject-introspection using glib as a subproject.
2023-01-08 00:33:14 +00:00
Roman Stratiienko
8c5ca546d4 Fix gmodule/COPYING symlink path
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-11-28 12:13:21 +02: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
e2b9e28ece Merge branch 'wip/3v1n0/meson-fix-tests-binary-dependencies' into 'main'
test/meson: Add tests dependencies on built programs, libraries and modules

See merge request GNOME/glib!3015
2022-11-08 12:30:53 +00:00
Philip Withnall
7b52ccbfc4 Revert "gio, glib: Use G_OS_DARWIN for code that is for such environments"
This reverts commit 476e33c3f3.

We’ve decided to remove `G_OS_DARWIN` in favour of recommending people
use `__APPLE__` instead. As per the discussion on #2802 and linked
issues,
 * Adding a new define shifts the complexity from “which of these
   platform-provided defines do I use” to “which platform-provided
   defines does G_OS_DARWIN use”
 * There should ideally be no cases where a user of GLib has to use
   their own platform-specific code, since GLib should be providing
   appropriate abstractions
 * Providing a single `G_OS_DARWIN` to cover all Apple products (macOS
   and iOS) hides the complexity of what the user is actually testing:
   are they testing for the Mach kernel, the Carbon and/or Cocoa user
   space toolkits, macOS vs iOS vs tvOS, etc

Helps: #2802
2022-11-07 11:30:32 +00:00
Xavier Claessens
f6edb52bda Merge branch 'wip/3v1n0/some-meson-fixmes' into 'main'
meson: Handle various build system FIXME's

See merge request GNOME/glib!3012
2022-11-01 23:36:04 +00:00
Marco Trevisan (Treviño)
eef2b0b39e gmodule/tests/meson: Make tests depending on loaded libraries and modules 2022-11-01 01:56:27 +01:00