archrelease: copy trunk to extra-x86_64
[arch-packages.git] / speech-dispatcher / repos / testing-x86_64 / glib2.68.patch
blobb4f7a840fba86c490459f392b382d281cafbbf3c
1 From a2faab416e42cbdf3d73f98578a89eb7a235e25a Mon Sep 17 00:00:00 2001
2 From: Michael Catanzaro <mcatanzaro@gnome.org>
3 Date: Tue, 2 Feb 2021 14:50:23 -0600
4 Subject: [PATCH] Fix build after glib e38982df
6 glib.h now includes <type_traits> when building as C++. But kali.cpp
7 includes it (via module_utils.h) inside an extern "C" block. This is
8 illegal.
10 Best practice is to use extern "C" in project header files, not around
11 include statements. So let's do that. module_utils.h already includes
12 glib.h, so we can use G_BEGIN_DECLS/G_END_DECLS there. spd_audio.h does
13 not, so I decided to write out the usual boilerplate, as including all
14 of glib.h just for G_BEGIN_DECLS/G_END_DECLS seemed like overkill.
15 Finally, I'll move config.h at the very top of kali.cpp, since I'm
16 touching this code anyway and that is the usual place to put it.
18 This is the minimum viable change required for speech-dispatcher to
19 build with glib master. As long as speech-dispatcher is combining C and
20 C++, it would be advisible to use extern "C" in all headers that declare
21 C functions and might be included from C++.
22 ---
23 src/modules/kali.cpp | 10 +++++-----
24 src/modules/module_utils.h | 4 ++++
25 src/modules/spd_audio.h | 8 ++++++++
26 3 files changed, 17 insertions(+), 5 deletions(-)
28 diff --git a/src/modules/kali.cpp b/src/modules/kali.cpp
29 index 193975d8..7b497626 100644
30 --- a/src/modules/kali.cpp
31 +++ b/src/modules/kali.cpp
32 @@ -21,21 +21,21 @@
33 * $Id: kali.c,v 1.59 2008-06-09 10:38:02 hanke Exp $
36 +#ifdef HAVE_CONFIG_H
37 +#include <config.h>
38 +#endif
40 #include <stdio.h>
41 #include <string.h>
42 #include <unistd.h>
43 #include <kali/Kali/kali.h>
44 -extern "C" {
45 -#ifdef HAVE_CONFIG_H
46 -#include <config.h>
47 -#endif
49 #include <semaphore.h>
50 #include "spd_audio.h"
52 #include <speechd_types.h>
54 #include "module_utils.h"
56 #define MODULE_NAME "kali"
57 #define MODULE_VERSION "0.0"
58 #define DEBUG_MODULE 1
59 diff --git a/src/modules/module_utils.h b/src/modules/module_utils.h
60 index 6081e7e1..e82850b2 100644
61 --- a/src/modules/module_utils.h
62 +++ b/src/modules/module_utils.h
63 @@ -41,6 +41,8 @@
64 #include <speechd_types.h>
65 #include "spd_audio.h"
67 +G_BEGIN_DECLS
69 typedef struct SPDMarks {
70 unsigned num;
71 unsigned allocated;
72 @@ -420,4 +422,6 @@ char *module_getvoice(char *language, SPDVoiceType voice);
73 gboolean module_existsvoice(char *voicename);
74 char *module_getdefaultvoice(void);
76 +G_END_DECLS
78 #endif /* #ifndef __MODULE_UTILS_H */
79 diff --git a/src/modules/spd_audio.h b/src/modules/spd_audio.h
80 index 25045e2f..b9de3cd5 100644
81 --- a/src/modules/spd_audio.h
82 +++ b/src/modules/spd_audio.h
83 @@ -28,6 +28,10 @@
85 #define SPD_AUDIO_LIB_PREFIX "spd_"
87 +#ifdef __cplusplus
88 +extern "C" {
89 +#endif
91 AudioID *spd_audio_open(char *name, void **pars, char **error);
93 int spd_audio_play(AudioID * id, AudioTrack track, AudioFormat format);
94 @@ -47,4 +51,8 @@ void spd_audio_set_loglevel(AudioID * id, int level);
96 char const *spd_audio_get_playcmd(AudioID * id);
98 +#ifdef __cplusplus
100 +#endif
102 #endif /* ifndef #__SPD_AUDIO_H */