From 055257a210015a623062ad3ad3cb8a40fbc6839f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 12 Jun 2012 19:21:53 +0200 Subject: audio-parser, output_thread: work around -Wmaybe-uninitialized False positives in gcc 4.7. --- src/audio_parser.c | 11 +++++++++++ src/output_thread.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/audio_parser.c b/src/audio_parser.c index 139cf1c04..908230cb2 100644 --- a/src/audio_parser.c +++ b/src/audio_parser.c @@ -26,6 +26,7 @@ #include "audio_parser.h" #include "audio_format.h" #include "audio_check.h" +#include "gcc.h" #include #include @@ -160,6 +161,11 @@ audio_format_parse(struct audio_format *dest, const char *src, /* parse sample rate */ +#if GCC_CHECK_VERSION(4,7) + /* workaround -Wmaybe-uninitialized false positive */ + rate = 0; +#endif + if (!parse_sample_rate(src, mask, &rate, &src, error_r)) return false; @@ -171,6 +177,11 @@ audio_format_parse(struct audio_format *dest, const char *src, /* parse sample format */ +#if GCC_CHECK_VERSION(4,7) + /* workaround -Wmaybe-uninitialized false positive */ + sample_format = SAMPLE_FORMAT_UNDEFINED; +#endif + if (!parse_sample_format(src, mask, &sample_format, &src, error_r)) return false; diff --git a/src/output_thread.c b/src/output_thread.c index bf56ca971..4f3ab3e49 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -29,6 +29,7 @@ #include "filter/convert_filter_plugin.h" #include "filter/replay_gain_filter_plugin.h" #include "mpd_error.h" +#include "gcc.h" #include @@ -438,6 +439,10 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk) } size_t size; +#if GCC_CHECK_VERSION(4,7) + /* workaround -Wmaybe-uninitialized false positive */ + size = 0; +#endif const char *data = ao_filter_chunk(ao, chunk, &size); if (data == NULL) { ao_close(ao, false); -- cgit v1.2.3