Define SPA_FALLTHROUGH to make fall-through annotations work for all compilers

This is needed for example for Clang compiler which uses different
annotations than GCC. It will make WebRTC to happily use PipeWire
since the spa library is header-only and WebRTC defaults to use
Clang with -Wimplicit-fallthrough.
This commit is contained in:
Jan Grulich 2020-10-13 09:58:43 +02:00 committed by Wim Taymans
parent 406b99c4c5
commit 743cf58fb7
17 changed files with 73 additions and 46 deletions

View file

@ -1114,7 +1114,7 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
}
pa_log_warn("Could not recover alsa device from SUSPENDED state, trying to restart PCM");
}
/* Fall through */
SPA_FALLTHROUGH
default:

View file

@ -25,6 +25,8 @@
extern "C" {
#endif
#include <spa/utils/defs.h>
#define PA_CHANNELS_MAX 64
#define PA_CHANNEL_MAP_SNPRINT_MAX 336
@ -161,17 +163,17 @@ static inline pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsign
case 8:
m->map[6] = PA_CHANNEL_POSITION_SIDE_LEFT;
m->map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT;
/* Fall through */
SPA_FALLTHROUGH
case 6:
m->map[5] = PA_CHANNEL_POSITION_LFE;
/* Fall through */
SPA_FALLTHROUGH
case 5:
m->map[4] = PA_CHANNEL_POSITION_FRONT_CENTER;
/* Fall through */
SPA_FALLTHROUGH
case 4:
m->map[2] = PA_CHANNEL_POSITION_REAR_LEFT;
m->map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
/* Fall through */
SPA_FALLTHROUGH
case 2:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
m->map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;

View file

@ -18,6 +18,6 @@ acp_lib = static_library(
'acp',
acp_sources,
c_args : acp_c_args,
include_directories : [configinc],
include_directories : [configinc, spa_inc ],
dependencies : [ alsa_dep, mathlib, ]
)

View file

@ -516,7 +516,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
break;
case SPA_NODE_COMMAND_Suspend:
configure_format(this, 0, NULL);
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;

View file

@ -808,7 +808,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
case SPA_NODE_COMMAND_Suspend:
clean_convert(this);
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;

View file

@ -172,17 +172,17 @@ static uint64_t default_mask(uint32_t channels)
case 8:
mask |= _MASK(RL);
mask |= _MASK(RR);
/* fallthrough */
SPA_FALLTHROUGH
case 5:
case 6:
mask |= _MASK(SL);
mask |= _MASK(SR);
if ((channels & 1) == 0)
mask |= _MASK(LFE);
/* fallthrough */
SPA_FALLTHROUGH
case 3:
mask |= _MASK(FC);
/* fallthrough */
SPA_FALLTHROUGH
case 2:
mask |= _MASK(FL);
mask |= _MASK(FR);
@ -466,7 +466,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true;
break;
case SPA_NODE_COMMAND_Suspend:
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;

View file

@ -248,7 +248,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true;
break;
case SPA_NODE_COMMAND_Suspend:
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;

View file

@ -348,7 +348,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true;
break;
case SPA_NODE_COMMAND_Suspend:
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;

View file

@ -262,7 +262,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
update_rate_match(this);
break;
case SPA_NODE_COMMAND_Suspend:
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
resample_reset(&this->resample);
this->started = false;

View file

@ -330,7 +330,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true;
break;
case SPA_NODE_COMMAND_Suspend:
/* fallthrough */
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Pause:
this->started = false;
break;