Commit 67f591a9 authored by Max Kellermann's avatar Max Kellermann

gcc.h: add macro gcc_unreachable()

parent 105b431e
......@@ -99,7 +99,7 @@ decoder_control::IsCurrentSong(const Song *_song) const
}
assert(false);
return false;
gcc_unreachable();
}
void
......
......@@ -123,7 +123,7 @@ audio_output_load_mixer(struct audio_output *ao,
}
assert(false);
return NULL;
gcc_unreachable();
}
bool
......
......@@ -55,9 +55,8 @@ replay_gain_get_mode_string(void)
return "album";
}
/* unreachable */
assert(false);
return "off";
gcc_unreachable();
}
bool
......
......@@ -69,7 +69,7 @@ sample_format_to_string(enum sample_format format)
/* unreachable */
assert(false);
return "?";
gcc_unreachable();
}
const char *
......
......@@ -253,7 +253,7 @@ sample_format_size(enum sample_format format)
}
assert(false);
return 0;
gcc_unreachable();
}
/**
......
......@@ -104,7 +104,7 @@ flac_convert(void *dest,
case SAMPLE_FORMAT_FLOAT:
case SAMPLE_FORMAT_DSD:
case SAMPLE_FORMAT_UNDEFINED:
/* unreachable */
assert(false);
gcc_unreachable();
}
}
......@@ -93,6 +93,7 @@ ChainFilter::CloseUntil(const Filter *until)
/* this assertion fails if #until does not exist (anymore) */
assert(false);
gcc_unreachable();
}
static const struct audio_format *
......
......@@ -79,6 +79,12 @@
#endif
#if defined(__GNUC__) || defined(__clang__)
#define gcc_unreachable() __builtin_unreachable()
#else
#define gcc_unreachable()
#endif
#ifdef __cplusplus
#ifdef __GNUC__
......
......@@ -257,7 +257,7 @@ get_bitformat(enum sample_format sample_format)
}
assert(false);
return SND_PCM_FORMAT_UNKNOWN;
gcc_unreachable();
}
static snd_pcm_format_t
......
......@@ -696,6 +696,7 @@ mpd_jack_write_samples(JackOutput *jd, const void *src,
default:
assert(false);
gcc_unreachable();
}
}
......
......@@ -110,9 +110,8 @@ pcm_add_vol(void *buffer1, const void *buffer2, size_t size,
return true;
}
/* unreachable */
assert(false);
return false;
gcc_unreachable();
}
template<typename T, typename U, unsigned bits>
......@@ -184,9 +183,8 @@ pcm_add(void *buffer1, const void *buffer2, size_t size,
return true;
}
/* unreachable */
assert(false);
return false;
gcc_unreachable();
}
bool
......
......@@ -188,7 +188,6 @@ pcm_volume(void *buffer, size_t length,
return true;
}
/* unreachable */
assert(false);
return false;
gcc_unreachable();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment