From 7e43b2a6792b81166bc63153c09646865bf984da Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Sat, 18 Apr 2020 18:03:42 +0100 Subject: [PATCH] wmix: fix multiple definitions of global variables. The mixer API variables are declared in a header with no explicit linkage. This results in there being definitions of them in multiple object files, which causes a link failure with GCC 10, since this uses -fno-common by default. Add `extern` to the header declarations and separate declarations with no linkage in mixer.c where they are assigned. Link: https://bugs.debian.org/957947 Signed-off-by: Jeremy Sowden --- wmix/include/mixer.h | 50 ++++++++++++++++++++++---------------------- wmix/wmix.c | 25 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/wmix/include/mixer.h b/wmix/include/mixer.h index 116d8ed..fa567a2 100644 --- a/wmix/include/mixer.h +++ b/wmix/include/mixer.h @@ -55,28 +55,28 @@ * - Muting must occur independently of the volume level. */ -void (*mixer_init)(const char *mixer_device, - bool verbose, - const char *exclude[]); -bool (*mixer_is_changed)(void); -int (*mixer_get_channel_count)(void); -int (*mixer_get_channel)(void); -const char *(*mixer_get_channel_name)(void); -const char *(*mixer_get_short_name)(void); -void (*mixer_set_channel)(int channel); -void (*mixer_set_channel_rel)(int delta_channel); -float (*mixer_get_volume)(void); -void (*mixer_set_volume)(float volume); -void (*mixer_set_volume_rel)(float delta_volume); -float (*mixer_get_balance)(void); -void (*mixer_set_balance)(float balance); -void (*mixer_set_balance_rel)(float delta_balance); -void (*mixer_toggle_mute)(void); -void (*mixer_toggle_rec)(void); -bool (*mixer_is_muted)(void); -bool (*mixer_is_stereo)(void); -bool (*mixer_is_rec)(void); -bool (*mixer_can_rec)(void); -bool (*is_exclude)(const char *short_name, - const char *exclude[]); -void (*mixer_tick)(void); +extern void (*mixer_init)(const char *mixer_device, + bool verbose, + const char *exclude[]); +extern bool (*mixer_is_changed)(void); +extern int (*mixer_get_channel_count)(void); +extern int (*mixer_get_channel)(void); +extern const char *(*mixer_get_channel_name)(void); +extern const char *(*mixer_get_short_name)(void); +extern void (*mixer_set_channel)(int channel); +extern void (*mixer_set_channel_rel)(int delta_channel); +extern float (*mixer_get_volume)(void); +extern void (*mixer_set_volume)(float volume); +extern void (*mixer_set_volume_rel)(float delta_volume); +extern float (*mixer_get_balance)(void); +extern void (*mixer_set_balance)(float balance); +extern void (*mixer_set_balance_rel)(float delta_balance); +extern void (*mixer_toggle_mute)(void); +extern void (*mixer_toggle_rec)(void); +extern bool (*mixer_is_muted)(void); +extern bool (*mixer_is_stereo)(void); +extern bool (*mixer_is_rec)(void); +extern bool (*mixer_can_rec)(void); +extern bool (*is_exclude)(const char *short_name, + const char *exclude[]); +extern void (*mixer_tick)(void); diff --git a/wmix/wmix.c b/wmix/wmix.c index a26cab8..c42c978 100644 --- a/wmix/wmix.c +++ b/wmix/wmix.c @@ -41,6 +41,31 @@ #include "include/mixer-oss.h" #include "include/mixer-alsa.h" +void (*mixer_init)(const char *mixer_device, + bool verbose, + const char *exclude[]); +bool (*mixer_is_changed)(void); +int (*mixer_get_channel_count)(void); +int (*mixer_get_channel)(void); +const char *(*mixer_get_channel_name)(void); +const char *(*mixer_get_short_name)(void); +void (*mixer_set_channel)(int channel); +void (*mixer_set_channel_rel)(int delta_channel); +float (*mixer_get_volume)(void); +void (*mixer_set_volume)(float volume); +void (*mixer_set_volume_rel)(float delta_volume); +float (*mixer_get_balance)(void); +void (*mixer_set_balance)(float balance); +void (*mixer_set_balance_rel)(float delta_balance); +void (*mixer_toggle_mute)(void); +void (*mixer_toggle_rec)(void); +bool (*mixer_is_muted)(void); +bool (*mixer_is_stereo)(void); +bool (*mixer_is_rec)(void); +bool (*mixer_can_rec)(void); +bool (*is_exclude)(const char *short_name, + const char *exclude[]); +void (*mixer_tick)(void); static Display *display; static bool button_pressed = false;