Skip to content

Commit

Permalink
Update subtree: libglnx 2024-08-23
Browse files Browse the repository at this point in the history
* Fix function detection when using -Werror=return-type
  (Resolves: flatpak#5778)
* Add a fallback definition for G_PID_FORMAT
* Avoid warnings for g_steal_fd() when targeting older GLib
* Include <glib-unix.h> from glnx-backports.h

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Aug 23, 2024
2 parents 6902959 + 87f2768 commit db5f037
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions subprojects/libglnx/glnx-backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <string.h>

#include <glib-unix.h>
#include <gio/gio.h>

G_BEGIN_DECLS
Expand Down Expand Up @@ -80,6 +81,10 @@ gboolean glnx_set_object (GObject **object_ptr,
#define G_OPTION_FLAG_NONE ((GOptionFlags) 0)
#endif

#ifndef G_PID_FORMAT /* added in 2.50 */
#define G_PID_FORMAT "i"
#endif

#if !GLIB_CHECK_VERSION(2, 60, 0)
#define g_strv_equal _glnx_strv_equal
gboolean _glnx_strv_equal (const gchar * const *strv1,
Expand Down Expand Up @@ -125,16 +130,22 @@ _glnx_memdup2 (gconstpointer mem,
(((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon))
#endif

#if !GLIB_CHECK_VERSION(2, 70, 0)
#define g_steal_fd _glnx_steal_fd
static inline int
_glnx_steal_fd (int *fdp)
{
#if GLIB_CHECK_VERSION(2, 70, 0)
/* Allow it to be used without deprecation warnings, even if the target
* GLib version is older */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return g_steal_fd (fdp);
G_GNUC_END_IGNORE_DEPRECATIONS
#else
int fd = *fdp;
*fdp = -1;
return fd;
}
#endif
}
#define g_steal_fd _glnx_steal_fd

#if !GLIB_CHECK_VERSION(2, 74, 0)
#define G_APPLICATION_DEFAULT_FLAGS ((GApplicationFlags) 0)
Expand Down
2 changes: 1 addition & 1 deletion subprojects/libglnx/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ foreach check_function : check_functions
#include <linux/random.h>
#include <sys/mman.h>
int func (void) {
void func (void) {
(void) ''' + check_function + ''';
}
''',
Expand Down

0 comments on commit db5f037

Please sign in to comment.