From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zycpc-0008OR-Td for qemu-devel@nongnu.org; Tue, 17 Nov 2015 04:45:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZycpZ-000566-Hi for qemu-devel@nongnu.org; Tue, 17 Nov 2015 04:45:44 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:33922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZycpZ-00055d-6h for qemu-devel@nongnu.org; Tue, 17 Nov 2015 04:45:41 -0500 Received: by wmvv187 with SMTP id v187so217857518wmv.1 for ; Tue, 17 Nov 2015 01:45:40 -0800 (PST) Sender: Paolo Bonzini References: <1447687010-4471-1-git-send-email-peter.maydell@linaro.org> From: Paolo Bonzini Message-ID: <564AF742.1070601@redhat.com> Date: Tue, 17 Nov 2015 10:45:38 +0100 MIME-Version: 1.0 In-Reply-To: <1447687010-4471-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw/audio/fmopl.c: Avoid clang warning about shifting negative number List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Gerd Hoffmann , patches@linaro.org On 16/11/2015 16:16, Peter Maydell wrote: > Newer versions of clang warn: > > hw/audio/fmopl.c:1085:39: warning: shifting a negative signed value is undefined [-Wshift-negative-value] > data = Limit( outd[0] , OPL_MAXOUT, OPL_MINOUT ); > ^~~~~~~~~~ > hw/audio/fmopl.c:75:28: note: expanded from macro 'OPL_MINOUT' > #define OPL_MINOUT (-0x8000< ~~~~~~~^ > > Rephrase the definition of OPL_MINOUT to avoid the undefined behaviour. > > Signed-off-by: Peter Maydell > --- > hw/audio/fmopl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c > index 81c0c1b..807b29c 100644 > --- a/hw/audio/fmopl.c > +++ b/hw/audio/fmopl.c > @@ -72,7 +72,7 @@ static int opl_dbg_maxchip,opl_dbg_chip; > /* final output shift , limit minimum and maximum */ > #define OPL_OUTSB (TL_BITS+3-16) /* OPL output final shift 16bit */ > #define OPL_MAXOUT (0x7fff< -#define OPL_MINOUT (-0x8000< +#define OPL_MINOUT (-(0x8000<