gentoo-ebuilds/media-sound/rhythmbox/files/rhythmbox-3.4.7-implicit-declaration.patch
Pacho Ramos e50e5e28a5
media-sound/rhythmbox: Multiple bugfixes
Cherry picks from upstream master to fix implicit declarations,
libxml2 and python 3.12 compat issues.

Closes: https://bugs.gentoo.org/898926
Closes: https://bugs.gentoo.org/929668
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
2024-05-18 10:47:26 +02:00

72 lines
2 KiB
Diff

From 10369b9a6b896dc79d7ae715fe67bf3b4c581c22 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Tue, 9 May 2023 15:48:56 -0400
Subject: [PATCH] build: Define _GNU_SOURCE for pthread_getname_np
With clang-16, implicit function definitions are treated as errors. As a
result, the check for pthread_getname_np fails because
pthread_getname_np is only provided under _GNU_SOURCE (see
pthread_getname_np(3))
> Checking if "pthread_getname_np" : links: NO
The compilation failure is
> error: implicit declaration of function 'pthread_getname_np' [-Werror,-Wimplicit-function-declaration]
The inclusion of pthread.h lib/rb-debug.c must be moved above the system
headers because they may include pthread.h themselves (and in practice
unistd.h does). If that change is not done, lib/rb-debug.c will fail to
compile for the same reason as the configure test.
Note that to test this, one must disable prctl() detection.
Bug: https://bugs.gentoo.org/898926
---
lib/rb-debug.c | 11 ++++++-----
meson.build | 1 +
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/rb-debug.c b/lib/rb-debug.c
index a5b4ccac6..b9e0ec81d 100644
--- a/lib/rb-debug.c
+++ b/lib/rb-debug.c
@@ -30,17 +30,18 @@
#include "config.h"
+#if defined(HAVE_PRCTL)
+#include <sys/prctl.h>
+#elif defined(HAVE_PTHREAD_GETNAME_NP)
+#define _GNU_SOURCE
+#include <pthread.h>
+#endif
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>
#include <time.h>
-#if defined(HAVE_PRCTL)
-#include <sys/prctl.h>
-#elif defined(HAVE_PTHREAD_GETNAME_NP)
-#include <pthread.h>
-#endif
#include <glib.h>
diff --git a/meson.build b/meson.build
index 681e084e8..bbe014246 100644
--- a/meson.build
+++ b/meson.build
@@ -110,6 +110,7 @@ have_prctl = cc.has_function('prctl', prefix: '#include <sys/prctl.h>')
cdata.set('HAVE_PRCTL', have_prctl)
have_pthread_getname_np = cc.links('''
+ #define _GNU_SOURCE
#include <pthread.h>
int main() {
char nm[17];
--
GitLab