From ffbe7a75fd903e1655c8906c9c600a91fe0287e0 Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Fri, 26 Aug 2011 17:16:30 +0000 Subject: [PATCH] Cast away the unused state argument value to silence gcc 4.6 warnings. The WebRTC C wrapper for the G711 codec doesn't actually use the 'state' argument, but declares one anyway for API uniformity. At the beginning of functions like WebRTCG711_EncodeA(), there's a stanza: // Set to avoid getting warnings state = NULL; This might work around an unused parameter warning, but under gcc 4.6.0 it ends up generating another warning, that state is set but not used. Casting the assignment to void silences the warning, restoring compilation under -Werror. Reported as https://code.google.com/p/webrtc/issues/detail?id=50 Review URL: http://webrtc-codereview.appspot.com/135002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@463 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../codecs/G711/main/source/g711_interface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/audio_coding/codecs/G711/main/source/g711_interface.c b/src/modules/audio_coding/codecs/G711/main/source/g711_interface.c index 73646d16d..a49abdbe8 100644 --- a/src/modules/audio_coding/codecs/G711/main/source/g711_interface.c +++ b/src/modules/audio_coding/codecs/G711/main/source/g711_interface.c @@ -20,8 +20,8 @@ WebRtc_Word16 WebRtcG711_EncodeA(void *state, int n; WebRtc_UWord16 tempVal, tempVal2; - // Set to avoid getting warnings - state = NULL; + // Set and discard to avoid getting warnings + (void)(state = NULL); // Sanity check of input length if (len < 0) { @@ -59,8 +59,8 @@ WebRtc_Word16 WebRtcG711_EncodeU(void *state, int n; WebRtc_UWord16 tempVal; - // Set to avoid getting warnings - state = NULL; + // Set and discard to avoid getting warnings + (void)(state = NULL); // Sanity check of input length if (len < 0) { @@ -97,8 +97,8 @@ WebRtc_Word16 WebRtcG711_DecodeA(void *state, int n; WebRtc_UWord16 tempVal; - // Set to avoid getting warnings - state = NULL; + // Set and discard to avoid getting warnings + (void)(state = NULL); // Sanity check of input length if (len < 0) { @@ -135,8 +135,8 @@ WebRtc_Word16 WebRtcG711_DecodeU(void *state, int n; WebRtc_UWord16 tempVal; - // Set to avoid getting warnings - state = NULL; + // Set and discard to avoid getting warnings + (void)(state = NULL); // Sanity check of input length if (len < 0) {