Skip to content

Commit

Permalink
Merge libglnx commit 'b38235ac2d8f1a7b1b8b9960a109eb734b8ec4dd'
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

This commit was created via:

    git remote add --no-tags libglnx https://gitlab.gnome.org/GNOME/libglnx.git
    git fetch libglnx
    git diff HEAD:subprojects/libglnx libglnx/master
    git subtree merge -P subprojects/libglnx libglnx/master
    git commit --amend -s

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed May 2, 2024
2 parents 8c043fd + b38235a commit 425f49d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions subprojects/libglnx/glnx-backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,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 +129,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 425f49d

Please sign in to comment.